From 04645cd1943d17113e1d14b20707c58af0ba5a8f Mon Sep 17 00:00:00 2001 From: Pranav Gaddamadugu <23022326+d0cd@users.noreply.github.com> Date: Mon, 17 Feb 2025 08:55:39 -0800 Subject: [PATCH] Improve docs on testing --- .../src/learn/zkcloud/snarkos_dev_guide.md | 96 ----- documentation/cli/01_deploying.md | 2 + documentation/cli/02_executing.md | 2 + documentation/cli/04_dependencies.md | 1 + documentation/cli/05_query.md | 2 + documentation/concepts/00_overview.md | 11 + documentation/concepts/01_async.md | 4 +- documentation/concepts/02_debuggin.md | 395 ++++++++++++++++++ documentation/testing/00_overview.md | 23 + documentation/testing/01_test_framework.md | 2 + documentation/testing/02_debugger.md | 73 ++++ documentation/testing/03_devnet.md | 69 +++ .../{03_amareleo.md => 04_amareleo.md} | 2 + .../testing/{04_doku.md => 05_doko.md} | 2 + 14 files changed, 587 insertions(+), 97 deletions(-) create mode 100644 documentation/concepts/00_overview.md create mode 100644 documentation/concepts/02_debuggin.md create mode 100644 documentation/testing/03_devnet.md rename documentation/testing/{03_amareleo.md => 04_amareleo.md} (84%) rename documentation/testing/{04_doku.md => 05_doko.md} (82%) diff --git a/archive/src/learn/zkcloud/snarkos_dev_guide.md b/archive/src/learn/zkcloud/snarkos_dev_guide.md index e02aa6fd0..a3d8e09bf 100644 --- a/archive/src/learn/zkcloud/snarkos_dev_guide.md +++ b/archive/src/learn/zkcloud/snarkos_dev_guide.md @@ -129,99 +129,3 @@ snarkos developer scan [OPTIONS] --endpoint ``` -### 3. Local Devnet - -#### 3.1 Install `tmux` - -To run a local devnet with the script, start by installing `tmux`. - -
macOS - -To install `tmux` on macOS, you can use the `Homebrew` package manager. -If you haven't installed `Homebrew` yet, you can find instructions at [their website](https://brew.sh/). -```bash -# Once Homebrew is installed, run: -brew install tmux -``` - -
- -
Ubuntu - -On Ubuntu and other Debian-based systems, you can use the `apt` package manager: -```bash -sudo apt update -sudo apt install tmux -``` - -
- -
Windows - -There are a couple of ways to use `tmux` on Windows: - -### Using Windows Subsystem for Linux (WSL) - -1. First, install [Windows Subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/install). -2. Once WSL is set up and you have a Linux distribution installed (e.g., Ubuntu), open your WSL terminal and install `tmux` as you would on a native Linux system: -```bash -sudo apt update -sudo apt install tmux -``` - -
- -#### 3.2 Start a Local Devnet - -To start a local devnet, run: -```bash -./devnet.sh -``` -Follow the instructions in the terminal to start the devnet. - -#### 3.3 View a Local Devnet - -#### Switch Nodes (forward) - -To toggle to the next node in a local devnet, run: -```bash -Ctrl+b n -``` - -#### Switch Nodes (backwards) - -To toggle to the previous node in a local devnet, run: -```bash -Ctrl+b p -``` - -#### Scroll Node - -To scroll easily run: -```bash -Ctrl+b [ -``` - -#### Select a Node (choose-tree) - -To select a node in a local devnet, run: -```bash -Ctrl+b w -``` - -To quit scroll press `q` - -#### Select a Node (manually) - -To select a node manually in a local devnet, run: -```bash -Ctrl+b :select-window -t {NODE_ID} -``` - -#### 3.4 Stop a Local Devnet - -To stop a local devnet, run: -```bash -Ctrl+b :kill-session -``` -Then, press `Enter`. diff --git a/documentation/cli/01_deploying.md b/documentation/cli/01_deploying.md index 0b7e76d4d..e4dccbfae 100644 --- a/documentation/cli/01_deploying.md +++ b/documentation/cli/01_deploying.md @@ -4,4 +4,6 @@ title: Deploy Your Programs sidebar_label: Deploy --- + + Coming soon! \ No newline at end of file diff --git a/documentation/cli/02_executing.md b/documentation/cli/02_executing.md index fb627cd74..774a78f52 100644 --- a/documentation/cli/02_executing.md +++ b/documentation/cli/02_executing.md @@ -4,4 +4,6 @@ title: Run Your Programs sidebar_label: Execute --- + + Coming soon! \ No newline at end of file diff --git a/documentation/cli/04_dependencies.md b/documentation/cli/04_dependencies.md index 845b0d12b..34fdb006d 100644 --- a/documentation/cli/04_dependencies.md +++ b/documentation/cli/04_dependencies.md @@ -3,5 +3,6 @@ id: dependencies title: Dependency Management sidebar_label: Dependency Management --- + Coming soon! diff --git a/documentation/cli/05_query.md b/documentation/cli/05_query.md index b39d99320..57b65a1e3 100644 --- a/documentation/cli/05_query.md +++ b/documentation/cli/05_query.md @@ -4,5 +4,7 @@ title: Retrieving Network Metadata and State sidebar_label: Querying the Network --- + + Coming soon! diff --git a/documentation/concepts/00_overview.md b/documentation/concepts/00_overview.md new file mode 100644 index 000000000..0256190c8 --- /dev/null +++ b/documentation/concepts/00_overview.md @@ -0,0 +1,11 @@ +--- +id: overview +title: Overview +sidebar_label: Overview +--- + +There is a lot to learn about Leo! To help tame the complexity, we've put together some explainers and tutorials around some of the concepts and tools in Leo. + +- [**The Asynchronous Programming Model**](01_async.md) - Coming soon! + +- [**Debuggin' Out**](./02_debuggin.md) - Learn how to use Leo's interactive debugger. diff --git a/documentation/concepts/01_async.md b/documentation/concepts/01_async.md index 1790a90e4..bb1901b14 100644 --- a/documentation/concepts/01_async.md +++ b/documentation/concepts/01_async.md @@ -1,7 +1,9 @@ --- id: async -title: The Async Programming Model +title: The Asynchronous Programming Model sidebar_label: Async Model --- + + Coming soon! diff --git a/documentation/concepts/02_debuggin.md b/documentation/concepts/02_debuggin.md new file mode 100644 index 000000000..4ddd440eb --- /dev/null +++ b/documentation/concepts/02_debuggin.md @@ -0,0 +1,395 @@ +--- +id: debuggin +title: Debuggin' Out +sidebar_label: Debuggin' Out +--- + +`leo debug` is a powerful tool that developers can use to interactively step through executions and track down bugs. In this workshop, we'll use the Leo debugger to explore and gain a deeper understanding of a variety of programs. You will also build up the skills to adeptly use the debugger in your development work. + +**This tutorial assumes that you are already familiar with Leo. If you'd like a refresher, see the [Developer Docs](https://docs.leo-lang.org/getting_started)**. + +We're always looking to improve Leo's developer experience. If you have any feedback, please feel free to [file](https://github.com/ProvableHQ/leo/issues/new/choose) an issue! + +# Setup + +## Source Material + +Install the latest version of the [workshop](https://github.com/ProvableHQ/workshop/). + +## Leo + +[Install](https://github.com/ProvableHQ/leo?tab=readme-ov-file#%EF%B8%8F%EF%B8%8F-build-guide) Leo. You may also use the [install script](https://github.com/ProvableHQ/workshop/blob/master/install.sh) in the workshop. + +# An Introduction + + +First, let's fire up the debugger. +```bash +leo debug +``` +You'll see this prompt pop up. +
+
+This is the Leo Interpreter. Try the command `#help`.
+? Command? › 
+
+
+Let's go ahead and run the `#help` command. +
+
+✔ Command? · #help
+
+You probably want to start by running a function or transition.
+For instance
+#into program.aleo/main()
+Once a function is running, commands include
+#into    to evaluate into the next expression or statement;
+#step    to take one step towards evaluating the current expression or statement;
+#over    to complete evaluating the current expression or statement;
+#run     to finish evaluating
+#quit    to quit the interpreter.
+
+You can set a breakpoint with
+#break program_name line_number
+
+When executing Aleo VM code, you can print the value of a register like this:
+#print 2
+
+Some of the commands may be run with one letter abbreviations, such as #i.
+
+Note that this interpreter is not line oriented as in many common debuggers;
+rather it is oriented around expressions and statements.
+As you step into code, individual expressions or statements will
+be evaluated one by one, including arguments of function calls.
+
+You may simply enter Leo expressions or statements on the command line
+to evaluate. For instance, if you want to see the value of a variable w:
+w
+If you want to set w to a new value:
+w = z + 2u8;
+
+Note that statements (like the assignment above) must end with a semicolon.
+
+If there are futures available to be executed, they will be listed by
+numerical index, and you may run them using `#future` (or `#f`); for instance
+#future 0
+
+The interpreter begins in a global context, not in any Leo program. You can set
+the current program with
+
+#set_program program_name
+
+This allows you to refer to structs and other items in the indicated program.
+
+The interpreter may enter an invalid state, often due to Leo code entered at the
+REPL. In this case, you may use the command
+
+#restore
+
+Which will restore to the last saved state of the interpreter. Any time you
+enter Leo code at the prompt, interpreter state is saved.
+
+Input history is available - use the up and down arrow keys.
+
+
+ +The `leo debug` initializes a REPL loop in which you may run standalone Leo code. + +
+
+✔ Command? · 1u32 + 2u32
+Result: 3u32
+
+✔ Command? · let x: u32 = 1u32;
+✔ Command? · let y: u32 = 2u32;
+✔ Command? · let z: u32 = x + y;
+✔ Command? · x
+Result: 1u32
+
+✔ Command? · y
+Result: 2u32
+
+✔ Command? · z
+Result: 3u32
+
+
+ + +More often than not, you'll be using the debugger to step through a program. Let's see how that works. + +First, let's go to the program under investigation. In the directory where you installed the source material, run +```bash +cd workshop/learn_to_debug/point_math +leo debug +``` +The debugger will type check the `point_math.aleo` and initialize a REPL loop with access to the program definition. In additional to directly evaluating Leo code, the debugger provides commands with which the user can selectively step through code: +* `#into | #i` - to evaluate **into** the next expression or statement +* `#step | #s` - to take one step towards evaluating the current expression or statement +* `#over | #o` - to complete evaluating the current expression or statement +* `#run | #r` - to finish evaluating +* `#break | #b ` - to set a breakpoint +* `#watch` | `#w ` - to watch an expression. It's value will be printed out each step of the interpreter. + + +`#into` is particularly useful as users can prefix a Leo statement or expression with an `#into` command to step through the associated code. We'll now use the debugger to step through an evaluation of the `sqrt_bitwise` function. + + +
+
+✔ Command? · #i point_math.aleo/sqrt_bitwise(0u32)
+Prepared to evaluate:
+point_math.aleo/sqrt_bitwise(0u32)
+
+✔ Command? · #i
+Prepared to evaluate:
+point_math.aleo/sqrt_bitwise(0u32)
+
+✔ Command? · #s
+Result: 0u32
+
+Prepared to evaluate:
+point_math.aleo/sqrt_bitwise(0u32)
+
+✔ Command? · #s
+Prepared to evaluate:
+point_math.aleo/sqrt_bitwise(0u32)
+
+✔ Command? · #s
+Result: 0u32
+
+
+ + +## Challenge + +1. Use the above commands to step through evaluations of `sqrt_bitwise` for inputs `0u32`, `1u32`, `4u32`, `9u32`. Are they as you expect? + +2. Use the debugger and the above commands to: + a. Create and store two distinct `Point` records. + b. Calculate the distance between them. + c. Add the points together. + +## Solution + +Transcripts for each of the above challenges are given below. + +### Part 1 +
+
+✔ Command? · #i point_math.aleo/sqrt_bitwise(0u32)
+Prepared to evaluate:
+point_math.aleo/sqrt_bitwise(0u32)
+
+✔ Command? · #o
+Result: 0u32
+
+✔ Command? · #i point_math.aleo/sqrt_bitwise(1u32)
+Prepared to evaluate:
+point_math.aleo/sqrt_bitwise(1u32)
+
+✔ Command? · #o
+Result: 1u32
+
+✔ Command? · #i point_math.aleo/sqrt_bitwise(4u32)
+Prepared to evaluate:
+point_math.aleo/sqrt_bitwise(4u32)
+
+✔ Command? · #o
+Result: 2u32
+
+✔ Command? · #i point_math.aleo/sqrt_bitwise(9u32)
+Prepared to evaluate:
+point_math.aleo/sqrt_bitwise(9u32)
+
+✔ Command? · #o
+Result: 3u32
+
+
+ + +### Part 2 + +
+
+✔ Command? · let p1: Point = point_math.aleo/create_point(1u32, 2u32);
+✔ Command? · let p2: Point = point_math.aleo/create_point(3u32, 4u32);
+✔ Command? · p1
+Result: Point {owner: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px, x: 1u32, y: 2u32}
+
+✔ Command? · p2
+Result: Point {owner: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px, x: 3u32, y: 4u32}
+
+✔ Command? · let distance: u32 = point_math.aleo/distance(p1, p2);
+✔ Command? · distance
+Result: 2u32
+
+✔ Command? · let sum: Point = point_math.aleo/add_points(p1, p2);
+✔ Command? · sum
+Result: Point {owner: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px, x: 4u32, y: 6u32}
+
+
+ +# Pro Tips + +The Leo debugger also provides a number of features to help with more advanced debugging. These will be helpful as you go through the more complex examples below. + +## Recovering From Errors + +As you step through and evaluate code, you may run into a state where your debugger halts. This can happen for a number of reasons including, accessing values that don't exist, attempting to evaluate expressions that overflow, etc. If this happens, the `#restore` command can help you recover the debugger to the last code point. + +## Setting a Namespace + +The Leo debugger initializes in a "global" context, which contains the programs and dependencies in your project. When you invoke a transition or function, the debugger implicitly steps into the associated program's scope. + +You may find youself wanting to initialize structs and records defined in a specific program. To do so, you can explicitly set the program scope and directly instantiate data types. + +By setting a program scope, you can also directly invoke functions and interact with mappings defined in that scope. This is useful as specifying the full path (program name and resource) can be cumbersome. +
+
+✔ Command? · #set_program point_math
+
+✔ Command? · let p: Point = Point { owner: self.caller, x: 1u32, y: 2u32 };
+
+✔ Command? · p
+Result: Point {owner: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px, x: 1u32, y: 2u32}
+
+✔ Command? · let a: u32 = sqrt_bitwise(0u32);
+
+✔ Command? · a
+Result: 0u32
+
+
+ +## Cheatcodes + +The debugger also provides users with a number of "cheatcodes" to aid in debugging. The supported cheatcodes include: +- `CheatCode::print_mapping()` +- `CheatCode::set_block_height()` + +## GUI + +The Leo debugger also provides a user with a more sophisticated GUI, which can help step through code cleanly. The interface can be enabled with the `--tui` command and provides better code visualization, where the current line is highlighted. + +
+
+┌code──────────────────────────────────────────────────────────────────────────────────────────────────┐
+│    }                                                                                                 │
+│                                                                                                      │
+│    // An implementation of integer square root.                                                      │
+│    function sqrt_bitwise(n: u32) -> u32 {                                                            │
+│        let res: u32 = 0u32;                                                                          │
+│        // Iterate over all 32 bits from most significant to least significant                        │
+│        for inv_shift: u8 in 0u8..32u8 {                                                              │
+│            let shift: u8 = 31u8 - inv_shift;                                                         │
+│            let bit: u32 = 1u32 << shift;                                                             │
+│            let temp: u32  = res | bit;                                                               │
+│            // Check if temp is safe to square without overflow                                       │
+│            if temp <= 65535u32 { // √(2^32 - 1) = 65535                                              │
+│                let square: u32 = temp.mul_wrapped(temp);                                             │
+│                if square <= n {                                                                      │
+│                    res = temp; // Update res if temp^2 <= n                                          │
+│                }                                                                                     │
+│            }                                                                                         │
+│        }                                                                                             │
+│        return res;                                                                                   │
+│    }                                                                                                 │
+│                                                                                                      │
+└──────────────────────────────────────────────────────────────────────────────────────────────────────┘
+┌Result────────────────────────────────────────────┐┌Watchpoints───────────────────────────────────────┐
+│0u32                                              ││                                                  │
+│                                                  ││                                                  │
+│                                                  ││                                                  │
+│                                                  ││                                                  │
+└──────────────────────────────────────────────────┘└──────────────────────────────────────────────────┘
+┌Message───────────────────────────────────────────────────────────────────────────────────────────────┐
+│                                                                                                      │
+└──────────────────────────────────────────────────────────────────────────────────────────────────────┘
+┌Command:──────────────────────────────────────────────────────────────────────────────────────────────┐
+│                                                                                                      │
+└──────────────────────────────────────────────────────────────────────────────────────────────────────┘
+
+
+ +# A More Complicated Example +In the previous example, we use `leo debug` to evaluate simple transitions with strictly off-chain execution. The debugger can also be used to evaluate on-chain code. + +Let's dive in further by looking at some code. First let's navigate to the code and fire up the debugger. +```bash +cd workshop/learn_to_debug/access_control +leo debug +``` + +Using the debugger, a user can directly produce and evaluate futures. Users can also interact with mappings by directly executing Leo code. + +
+
+✔ Command? · #set_program access_control
+
+✔ Command? · let f: Future = set_timelock(self.caller, 1u32);
+
+✔ Command? · f.await()
+Result: ()
+
+✔ Command? · CheatCode::print_mapping(timelocks)
+Mapping: timelocks
+  Metadata {locker: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px, lockee: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px} -> 1u32
+Result: ()
+
+✔ Command? · let m: Metadata = Metadata { locker: self.caller, lockee: self.caller };
+
+✔ Command? · timelocks.get(m)
+Result: 1u32
+
+✔ Command? · timelocks.set(m, 2u32);
+
+✔ Command? · timelocks.get(m)
+Result: 2u32
+
+
+ +## Challenge + +Navigate to the `timelocked_credits` example and fire up the debugger. + +```bash +cd workshop/learn_to_debug/timelocked_credits +leo debug +``` + + +1. Deposit `10` credits. Note that you'll need to set the state of the `account` mapping in `credits.aleo`. +2. Increment the block height by 1 and attempt to withdraw. +3. Increment the block height by 3 and withdraw. + +While you are stepping through the code, be sure to the use the `#i` and `#s` commands to visualize the flow of the execution. + + + +# Debugging AVM Bytecode + +You may also use the Leo debugger to step through AVM bytecode. This can be useful for debugging programs that may be deployed on-chain, but whose Leo source code is not available. + +The debugger provides the `#print | #p ` command to display register values. + +## Challenge + +1. Go to the Provable Explorer and pick out a program. Note that this program needs to be deployed on the same network that you have configured in your `.env` file. You can always default to `credits.aleo`. + +2. Add the program as a dev dependency via `leo add`. + +3. Step through an execution of the program. + + +# Wrapping it Up + +In this tutorial, you learned how to use the Leo debugger. If you made it through all of the challenges you will have: +- Stepped through simple, local evaluations of a program. +- Simulated on-chain state to test more complex behaviors. +- Explicitly evaluated futures, giving you a better understanding of the async programming model. +- Debugged a deployed program that you may not have written directly. + +We hope that this tool makes your Leo development experience easier! If you have any feedback or run into any issues, please feel free to file an issue [here](https://github.com/ProvableHQ/leo/issues/new/choose) on the Leo repo. + + + + diff --git a/documentation/testing/00_overview.md b/documentation/testing/00_overview.md index 9a3720a18..590f53f3a 100644 --- a/documentation/testing/00_overview.md +++ b/documentation/testing/00_overview.md @@ -3,3 +3,26 @@ id: overview title: Overview sidebar_label: Overview --- + +Once deployed, an application lives on the ledger forever. Consequently, it's important to consider every edge case and rigorously test your code. There are number of tools and techniques you can use. +- [**Unit and Integration Testing**](01_test_framework.md) - Coming soon! + +- [**Debugging**](./02_debugger.md) - Tools and tips to trace errors. + +- [**Running Devnets**](./03_devnet.md) - Deploy and execute on a local devnet. + +- [**Amareleo**](./04_amareleo.md) - Coming soon! + +- [**doko.js**](./05_doko.md) - Coming soon! + + +## Faucets + +At some point you'll need testnet credits. There are a few community-supported faucets to choose from: +- [**Puzzle**](https://dev.puzzle.online/faucet) - 15 credits / 4 hours + +- [**Demox**](https://discord.com/channels/913160862670397510/1202322326230937640/1203135682873266207) - 10 credits / 12 hours + +- [**Sotertech**](https://faucetbeta.sotertech.io/) - 10 credits / 24 hours (*quickest to access as of 2/17/25*) + +The faucets are periodically refereshed. diff --git a/documentation/testing/01_test_framework.md b/documentation/testing/01_test_framework.md index 856b86461..60ffc343c 100644 --- a/documentation/testing/01_test_framework.md +++ b/documentation/testing/01_test_framework.md @@ -4,4 +4,6 @@ title: Leo's Native Testing Framework sidebar_label: Testing --- + + Coming soon! \ No newline at end of file diff --git a/documentation/testing/02_debugger.md b/documentation/testing/02_debugger.md index cfdab7f1d..5d745d2d5 100644 --- a/documentation/testing/02_debugger.md +++ b/documentation/testing/02_debugger.md @@ -3,3 +3,76 @@ id: debugging title: Debugging Your Code sidebar_label: Debugging --- + +Here are a few techniques to debug your programs. + +## Interactive Debugging + +Leo ships with an interactive debugger that you can use to step through your programs. + +### Getting Started + +Run through the [tutorial](./../concepts/02_debuggin.md) to get familiar with the debubugger. + +### Cheatsheet + + + +``` +You probably want to start by running a function or transition. +For instance +#into program.aleo/main() +Once a function is running, commands include +#into to evaluate into the next expression or statement; +#step to take one step towards evaluating the current expression or statement; +#over to complete evaluating the current expression or statement; +#run to finish evaluating +#quit to quit the interpreter. + +You can set a breakpoint with +#break program_name line_number + +When executing Aleo VM code, you can print the value of a register like this: +#print 2 + +Some of the commands may be run with one letter abbreviations, such as #i. + +Note that this interpreter is not line oriented as in many common debuggers; +rather it is oriented around expressions and statements. +As you step into code, individual expressions or statements will +be evaluated one by one, including arguments of function calls. + +You may simply enter Leo expressions or statements on the command line +to evaluate. For instance, if you want to see the value of a variable w: +w +If you want to set w to a new value: +w = z + 2u8; + +Note that statements (like the assignment above) must end with a semicolon. + +If there are futures available to be executed, they will be listed by +numerical index, and you may run them using `#future` (or `#f`); for instance +#future 0 + +The interpreter begins in a global context, not in any Leo program. You can set +the current program with + +#set_program program_name + +This allows you to refer to structs and other items in the indicated program. + +The interpreter may enter an invalid state, often due to Leo code entered at the +REPL. In this case, you may use the command + +#restore + +Which will restore to the last saved state of the interpreter. Any time you +enter Leo code at the prompt, interpreter state is saved. + +Input history is available - use the up and down arrow keys. +``` + + +### Inspect Compiler Output + + \ No newline at end of file diff --git a/documentation/testing/03_devnet.md b/documentation/testing/03_devnet.md new file mode 100644 index 000000000..adbd9c3da --- /dev/null +++ b/documentation/testing/03_devnet.md @@ -0,0 +1,69 @@ +--- +id: devnet +title: Running a Local Devnet +sidebar_label: Devnet +--- + +A local devnet can be a heavyweight but reliable way to test your application on Aleo. + +## Setup + +To run a local devnet, you'll need to install [snarkOS](https://developer.aleo.org/guides/introduction/getting_started#2-installing-snarkos). +You'll also need `tmux` (instructions below) and the [devnet.sh](https://github.com/ProvableHQ/snarkOS/blob/staging/devnet.sh) script in the `snarkOS` repository. + +
macOS + +To install `tmux` on macOS, you can use the `Homebrew` package manager. +If you haven't installed `Homebrew` yet, you can find instructions at [their website](https://brew.sh/). +```bash +# Once Homebrew is installed, run: +brew install tmux +``` + +
+ +
Ubuntu + +On Ubuntu and other Debian-based systems, you can use the `apt` package manager: +```bash +sudo apt update +sudo apt install tmux +``` + +
+ +
Windows + +There are a couple of ways to use `tmux` on Windows: + +## Using Windows Subsystem for Linux (WSL) + +1. First, install [Windows Subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/install). +2. Once WSL is set up and you have a Linux distribution installed (e.g., Ubuntu), open your WSL terminal and install `tmux` as you would on a native Linux system: +```bash +sudo apt update +sudo apt install tmux +``` + +
+ +### Runing the Devnet + +Run the `devnet.sh` script and follow the prompts. + +`tmux` allows you to toggle between nodes in your local devnet. Here are some useful (default) commands: + +```bash +# To toggle to the next node in a local devnet +Ctrl+b n +# To toggle to the previous node in a local devnet +Ctrl+b p +# To scroll easily, press q to quit +Ctrl+b [ +# To select a node in a local devnet +Ctrl+b w +# To select a node manually in a local devnet +Ctrl+b :select-window -t {NODE_ID} +# To stop a local devnet +Ctrl+b :kill-session +``` diff --git a/documentation/testing/03_amareleo.md b/documentation/testing/04_amareleo.md similarity index 84% rename from documentation/testing/03_amareleo.md rename to documentation/testing/04_amareleo.md index ba358ed3a..8811d2bdd 100644 --- a/documentation/testing/03_amareleo.md +++ b/documentation/testing/04_amareleo.md @@ -4,4 +4,6 @@ title: Amareleo sidebar_label: Amareleo --- + + Coming soon! \ No newline at end of file diff --git a/documentation/testing/04_doku.md b/documentation/testing/05_doko.md similarity index 82% rename from documentation/testing/04_doku.md rename to documentation/testing/05_doko.md index c7921488e..67ed2b58e 100644 --- a/documentation/testing/04_doku.md +++ b/documentation/testing/05_doko.md @@ -4,4 +4,6 @@ title: doko.js sidebar_label: doko.js --- + + Coming soon! \ No newline at end of file