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

chore: moving ordering to category jsons and frontmatters #3777

Merged
merged 2 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 5 additions & 0 deletions docs/docs/explanations/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"position": 3,
"collapsible": true,
"collapsed": true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"label": "Modules, Packages and Crates",
"position": 2,
"collapsible": true,
"collapsed": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Crates and Packages
description: Learn how to use Crates and Packages in your Noir project
keywords: [Nargo, dependencies, package management, crates, package]
sidebar_position: 0
---

## Crates
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Learn how to specify and manage dependencies in Nargo, allowing you to upload packages to GitHub
and use them easily in your project.
keywords: [Nargo, dependencies, GitHub, package management, versioning]
sidebar_position: 1
---

Nargo allows you to upload packages to GitHub and use them as dependencies.
Expand Down Expand Up @@ -48,7 +49,7 @@
│   ├── Nargo.toml
│   └── src
│   └── main.nr
└── liba

Check warning on line 52 in docs/docs/explanations/modules_packages_crates/dependencies.md

View workflow job for this annotation

GitHub Actions / Spellcheck / Spellcheck

Unknown word (liba)
├── Nargo.toml
└── src
└── lib.nr
Expand All @@ -60,13 +61,13 @@
# Nargo.toml

[dependencies]
libA = { path = "../liba" }

Check warning on line 64 in docs/docs/explanations/modules_packages_crates/dependencies.md

View workflow job for this annotation

GitHub Actions / Spellcheck / Spellcheck

Unknown word (liba)
```

## Importing dependencies

You can import a dependency to a Noir file using the following syntax. For example, to import the
ecrecover-noir library and local liba referenced above:

Check warning on line 70 in docs/docs/explanations/modules_packages_crates/dependencies.md

View workflow job for this annotation

GitHub Actions / Spellcheck / Spellcheck

Unknown word (liba)

```rust
use dep::ecrecover;
Expand All @@ -85,7 +86,7 @@
can import multiple items in the same line by enclosing them in curly braces:

```rust
use dep::std::ec::tecurve::affine::{Curve, Point};

Check warning on line 89 in docs/docs/explanations/modules_packages_crates/dependencies.md

View workflow job for this annotation

GitHub Actions / Spellcheck / Spellcheck

Unknown word (tecurve)
```

We don't have a way to consume libraries from inside a [workspace](./workspaces) as external dependencies right now.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
Learn how to organize your files using modules in Noir, following the same convention as Rust's
module system. Examples included.
keywords: [Noir, Rust, modules, organizing files, sub-modules]
sidebar_position: 2
---

Noir's module system follows the same convention as the _newer_ version of Rust's module system.

## Purpose of Modules

Modules are used to organise files. Without modules all of your code would need to live in a single

Check warning on line 14 in docs/docs/explanations/modules_packages_crates/modules.md

View workflow job for this annotation

GitHub Actions / Spellcheck / Spellcheck

Unknown word (organise)
file. In Noir, the compiler does not automatically scan all of your files to detect modules. This
must be done explicitly by the developer.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Workspaces
sidebar_position: 3
---

Workspaces are a feature of nargo that allow you to manage multiple related Noir packages in a single repository. A workspace is essentially a group of related projects that share common build output directories and configurations.
Expand Down Expand Up @@ -36,4 +37,4 @@ default-member = "crates/a"

Libraries can be defined in a workspace. Inside a workspace, these are consumed as `{ path = "../to_lib" }` dependencies in Nargo.toml.

Inside a workspace, these are consumed as `{ path = "../to_lib" }` dependencies in Nargo.toml.
Inside a workspace, these are consumed as `{ path = "../to_lib" }` dependencies in Nargo.toml.
6 changes: 6 additions & 0 deletions docs/docs/explanations/noir/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"label": "Noir",
"position": 0,
"collapsible": true,
"collapsed": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ description:
comparison expression that follows to be true, and what happens if the expression is false at
runtime.
keywords: [Noir programming language, assert statement, predicate expression, comparison expression]
sidebar_position: 4
---

Noir includes a special `assert` function which will explicitly constrain the predicate/comparison
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ description:
ignored by the compiler, but it can be read by programmers. Single-line and multi-line comments
are supported in Noir.
keywords: [Noir programming language, comments, single-line comments, multi-line comments]
sidebar_position: 9
---

A comment is a line in your codebase which the compiler ignores, however it can be read by
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ description:
Learn how to use loops and if expressions in the Noir programming language. Discover the syntax
and examples for for loops and if-else statements.
keywords: [Noir programming language, loops, for loop, if-else statements, Rust syntax]
sidebar_position: 2
---

## Loops
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Data Bus
sidebar_position: 12
---
**Disclaimer** this feature is experimental, do not use it!

Expand All @@ -8,10 +9,8 @@ In order to use it, you must define some inputs of the program entry points (usu
function) with the `call_data` modifier, and the return values with the `return_data` modifier.
These modifiers are incompatible with `pub` and `mut` modifiers.


## Example


```rust
fn main(mut x: u32, y: call_data u32, z: call_data [u32;4] ) -> return_data u32 {
let a = z[x];
Expand All @@ -20,4 +19,3 @@ fn main(mut x: u32, y: call_data u32, z: call_data [u32;4] ) -> return_data u32
```

As a result, both call_data and return_data will be treated as private inputs and encapsulated into a read-only array each, for the backend to process.

5 changes: 5 additions & 0 deletions docs/docs/explanations/noir/data_types/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"position": 0,
"collapsible": true,
"collapsed": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
examples,
indexing,
]
sidebar_position: 4
---

An array is one way of grouping together values into one compound type. Array types can be inferred
Expand Down Expand Up @@ -72,8 +73,8 @@

## Types

You can create arrays of primitive types or structs. There is not yet support for nested arrays

Check warning on line 76 in docs/docs/explanations/noir/data_types/arrays.md

View workflow job for this annotation

GitHub Actions / Spellcheck / Spellcheck

Unknown word (structs)
(arrays of arrays) or arrays of structs that contain arrays.

Check warning on line 77 in docs/docs/explanations/noir/data_types/arrays.md

View workflow job for this annotation

GitHub Actions / Spellcheck / Spellcheck

Unknown word (structs)

## Methods

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ keywords:
examples,
logical operations,
]
sidebar_position: 2
---


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ keywords:
examples,
best practices,
]
sidebar_position: 0
---

The field type corresponds to the native field type of the proving backend.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Function types
sidebar_position: 10
---

Noir supports higher-order functions. The syntax for a function type is as follows:
Expand All @@ -22,4 +23,4 @@ fn main() {
```

A function type also has an optional capture environment - this is necessary to support closures.
See [Lambdas](../08_lambdas.md) for more details.
See [Lambdas](../lambdas.md) for more details.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
developing experience, abstractions are added on top to introduce different data types in Noir.

Noir has two category of data types: primitive types (e.g. `Field`, integers, `bool`) and compound
types that group primitive types (e.g. arrays, tuples, structs). Each value can either be private or

Check warning on line 24 in docs/docs/explanations/noir/data_types/index.md

View workflow job for this annotation

GitHub Actions / Spellcheck / Spellcheck

Unknown word (structs)
public.

## Private & Public Types
Expand Down Expand Up @@ -79,7 +79,7 @@
}
```

Type aliases can also be used with [generics](@site/docs/explanations/00_noir/06_generics.md):
Type aliases can also be used with [generics](@site/docs/explanations/noir/generics.md):

```rust
type Id<Size> = Size;
Expand All @@ -93,4 +93,4 @@

### BigInt

You can acheive BigInt functionality using the [Noir BigInt](https://github.com/shuklaayush/noir-bigint) library.

Check warning on line 96 in docs/docs/explanations/noir/data_types/index.md

View workflow job for this annotation

GitHub Actions / Spellcheck / Spellcheck

Unknown word (acheive)
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Integers
description: Explore the Integer data type in Noir. Learn about its methods, see real-world examples, and grasp how to efficiently use Integers in your Noir code.
keywords: [noir, integer types, methods, examples, arithmetic]
sidebar_position: 1
---

An integer type is a range constrained field type. The Noir frontend supports arbitrarily-sized, both unsigned and signed integer types.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: References
sidebar_position: 9
---

Noir supports first-class references. References are a bit like pointers: they point to a specific address that can be followed to access the data stored at that address. You can use Rust-like syntax to use pointers in Noir: the `&` operator references the variable, the `*` operator dereferences it.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Slices
description: Explore the Slice data type in Noir. Understand its methods, see real-world examples, and learn how to effectively use Slices in your Noir programs.
keywords: [noir, slice type, methods, examples, subarrays]
sidebar_position: 5
---

import Experimental from '@site/src/components/Notes/_experimental.mdx';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@
examples,
concatenation,
]
sidebar_position: 3
---


The string type is a fixed length value defined with `str<N>`.

You can use strings in `assert()` functions or print them with
`std::println()`. See more about [Logging](../../standard_library/logging).

Check warning on line 20 in docs/docs/explanations/noir/data_types/strings.md

View workflow job for this annotation

GitHub Actions / Spellcheck / Spellcheck

Unknown word (println)

```rust
use dep::std;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ keywords:
examples,
data structures,
]
sidebar_position: 8
---

A struct also allows for grouping multiple values of different types. Unlike tuples, we can also
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ keywords:
examples,
multi-value containers,
]
sidebar_position: 7
---

A tuple collects multiple values like an array, but with the added ability to collect values of
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Vectors
description: Delve into the Vector data type in Noir. Learn about its methods, practical examples, and best practices for using Vectors in your Noir code.
keywords: [noir, vector type, methods, examples, dynamic arrays]
sidebar_position: 6
---

import Experimental from '@site/src/components/Notes/_experimental.mdx';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Distinct Witnesses
sidebar_position: 10
---

The `distinct` keyword prevents repetitions of witness indices in the program's ABI. This ensures
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ description:
Learn how to declare functions and methods in Noir, a programming language with Rust semantics.
This guide covers parameter declaration, return types, call expressions, and more.
keywords: [Noir, Rust, functions, methods, parameter declaration, return types, call expressions]
sidebar_position: 1
---

Functions in Noir follow the same semantics of Rust, though Noir does not support early returns.
Expand All @@ -14,7 +15,7 @@ To declare a function the `fn` keyword is used.
fn foo() {}
```

By default, functions are visible only within the package they are defined. To make them visible outside of that package (for example, as part of a [library](@site/docs/explanations/02_modules_packages_crates/crates_and_packages.md#libraries)), you should mark them as `pub`:
By default, functions are visible only within the package they are defined. To make them visible outside of that package (for example, as part of a [library](@site/docs/explanations/modules_packages_crates/crates_and_packages.md#libraries)), you should mark them as `pub`:

```rust
pub fn foo() {}
Expand Down Expand Up @@ -61,7 +62,7 @@ fn main(x : [Field]) // can't compile, has variable size
fn main(....// i think you got it by now
```

Keep in mind [tests](@site/docs/getting_started/03_tooling/01_testing.md) don't differentiate between `main` and any other function. The following snippet passes tests, but won't compile or prove:
Keep in mind [tests](@site/docs/getting_started/tooling/testing.md) don't differentiate between `main` and any other function. The following snippet passes tests, but won't compile or prove:

```rust
fn main(x : [Field]) {
Expand Down Expand Up @@ -138,7 +139,7 @@ follows:
assert(MyStruct::sum(s) == 42);
```

It is also possible to specialize which method is chosen depending on the [generic](./06_generics.md) type that is used. In this example, the `foo` function returns different values depending on its type:
It is also possible to specialize which method is chosen depending on the [generic](./generics.md) type that is used. In this example, the `foo` function returns different values depending on its type:

```rust
struct Foo<T> {}
Expand Down Expand Up @@ -177,7 +178,7 @@ let add_50 = |val| val + 50;
assert(add_50(100) == 150);
```

See [Lambdas](./08_lambdas.md) for more details.
See [Lambdas](./lambdas.md) for more details.

## Attributes

Expand All @@ -188,8 +189,8 @@ Supported attributes include:
- **builtin**: the function is implemented by the compiler, for efficiency purposes.
- **deprecated**: mark the function as _deprecated_. Calling the function will generate a warning: `warning: use of deprecated function`
- **field**: Used to enable conditional compilation of code depending on the field size. See below for more details
- **oracle**: mark the function as _oracle_; meaning it is an external unconstrained function, implemented in noir_js. See [Unconstrained](./05_unconstrained.md) and [NoirJS](@site/docs/reference/NoirJS/noir_js/index.md) for more details.
- **test**: mark the function as unit tests. See [Tests](@site/docs/getting_started/03_tooling/01_testing.md) for more details
- **oracle**: mark the function as _oracle_; meaning it is an external unconstrained function, implemented in noir_js. See [Unconstrained](./unconstrained.md) and [NoirJS](@site/docs/reference/NoirJS/noir_js/index.md) for more details.
- **test**: mark the function as unit tests. See [Tests](@site/docs/getting_started/tooling/testing.md) for more details

### Field Attribute

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Generics
description: Learn how to use Generics in Noir
keywords: [Noir, Rust, generics, functions, structs]
sidebar_position: 6
---

Generics allow you to use the same functions with multiple different concrete data types. You can
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Lambdas
description: Learn how to use anonymous functions in Noir programming language.
keywords: [Noir programming language, lambda, closure, function, anonymous function]
sidebar_position: 8
---

## Introduction
Expand Down Expand Up @@ -43,7 +44,7 @@ It may catch you by surprise that the following code fails to compile:

```rust
fn foo(f: fn () -> Field) -> Field {
f()
f()
}

fn main() {
Expand All @@ -69,7 +70,7 @@ with closures with any environment, as well as with regular functions:

```rust
fn foo<Env>(f: fn[Env]() -> Field) -> Field {
f()
f()
}

fn main() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ description:
Learn about mutable variables, constants, and globals in Noir programming language. Discover how
to declare, modify, and use them in your programs.
keywords: [noir programming language, mutability in noir, mutable variables, constants, globals]
sidebar_position: 7
---

Variables in noir can be declared mutable via the `mut` keyword. Mutable variables can be reassigned
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ keywords:
short-circuiting,
backend,
]
sidebar_position: 3
---

# Operations
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Shadowing
sidebar_position: 11
---

Noir allows for inheriting variables' values and re-declaring them with the same name similar to Rust, known as shadowing.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ title: Unconstrained Functions
description: "Learn about what unconstrained functions in Noir are, how to use them and when you'd want to."

keywords: [Noir programming language, unconstrained, open]
sidebar_position: 5
---

<!-- Source material for much of this page comes from here: https://github.com/noir-lang/acvm-docs/blob/main/docs/brillig/00_intro.md -->

Unconstrained functions are functions which do not constrain any of the included computation and allow for non-determinisitic computation.

## Why?
Expand Down
6 changes: 6 additions & 0 deletions docs/docs/explanations/standard_library/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"label": "Standard Library",
"position": 1,
"collapsible": true,
"collapsed": true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"position": 0,
"collapsible": true,
"collapsed": true
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: Elliptic Curve Primitives
keywords: [cryptographic primitives, Noir project]
sidebar_position: 4
---

Data structures and methods on them that allow you to carry out computations involving elliptic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: ECDSA Signature Verification
description: Learn about the cryptographic primitives regarding ECDSA over the secp256k1 and secp256r1 curves
keywords: [cryptographic primitives, Noir project, ecdsa, secp256k1, secp256r1, signatures]
sidebar_position: 3
---

import BlackBoxInfo from '@site/src/components/Notes/_blackbox.mdx';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: EdDSA Verification
description: Learn about the cryptographic primitives regarding EdDSA
keywords: [cryptographic primitives, Noir project, eddsa, signatures]
sidebar_position: 5
---

import BlackBoxInfo from '@site/src/components/Notes/_blackbox.mdx';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ description:
blake2s, pedersen, mimc_bn254 and mimc
keywords:
[cryptographic primitives, Noir project, sha256, blake2s, pedersen, mimc_bn254, mimc, hash]
sidebar_position: 0
---

import BlackBoxInfo from '@site/src/components/Notes/_blackbox.mdx';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Scalar multiplication
description: See how you can perform scalar multiplications over a fixed base in Noir
keywords: [cryptographic primitives, Noir project, scalar multiplication]
sidebar_position: 1
---

import BlackBoxInfo from '@site/src/components/Notes/_blackbox.mdx';
Expand Down
Loading
Loading