You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: book/get-started/about-huff.md
+1-6Lines changed: 1 addition & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,11 @@
1
-
# Getting started
1
+
# About Huff
2
2
3
3
Huff is a low-level programming language designed for developing highly optimized smart contracts that run on the Ethereum Virtual Machine (EVM). Huff does not hide the inner workings of the EVM and instead exposes its programming stack to the developer for manual manipulation.
4
4
5
5
While EVM experts can use Huff to write highly-efficient smart contracts for use in production, it can also serve as a way for beginners to learn more about the EVM.
6
6
7
7
If you're looking for an in-depth guide on how to write and understand Huff, check out the [tutorials](../tutorial/overview.md).
8
8
9
-
## There is `huff-rs` and `huff-neo`?
10
-
11
-
Yes, there are two versions of the Huff compiler. The original compiler, `huff-rs` is no longer maintained. There is a plan to revive it as [huff2](https://github.com/huff-language/huff2), but since it is a new development from scratch, it is unknown when it will have feature parity with the original compiler. `huff-neo` tries to step-in and continues the development and also tries to evolve the Huff language where necessary.
12
-
13
-
14
9
## History of the Huff Language
15
10
The [Aztec Protocol](https://aztec.network/) team originally created Huff to write [Weierstrudel](https://github.com/aztecprotocol/weierstrudel/tree/master/huff_modules), an on-chain elliptical curve arithmetic library that requires incredibly optimized code that neither [Solidity](https://docs.soliditylang.org/) nor [Yul](https://docs.soliditylang.org/en/latest/yul.html) could provide.
The goal of `huff-neo` is to keep the same syntax as `huffc` but to be more efficient and to have a better error handling. There are some additions to the language but the syntax should be backwards compatible.
3
+
4
+
## There is `huff-rs` and `huff-neo`?
5
+
6
+
Yes, there are two versions of the Huff compiler. The original compiler, `huff-rs` is no longer maintained. There is a plan to revive it as [huff2](https://github.com/huff-language/huff2), but since it is a new development from scratch, it is unknown when it will have feature parity with the original compiler. `huff-neo` tries to step-in and continues the development and also tries to evolve the Huff language where necessary.
7
+
8
+
## New in `huff-neo`
9
+
There are some new features in `huff-neo` that are not available in `huffc`.
10
+
11
+
### Allowed use of built-in functions for constants and code tables
12
+
The usage of built-in functions for constants and code tables is now possible.
__LEFTPAD(__FUNC_SIG("test(uint256)")) // New built-in function __LEFTPAD
23
+
[FUNC_TEST]
24
+
[BYTES_HELLO]
25
+
}
26
+
```
27
+
28
+
### New built-in functions
29
+
There are new built-in functions available in `huff-neo`.
30
+
31
+
-`__LEFTPAD` - Left pads a hex input or the result of a passed built-in in a code table.
32
+
-`__BYTES` - Converts a string to the UTF-8 representation bytes and pushes it to the stack.
33
+
34
+
```javascript
35
+
#define macro MAIN() =takes (0) returns (0) {
36
+
__BYTES("hello") // Will push UTF-8 encoded string (PUSH5 0x68656c6c6f)
37
+
}
38
+
```
39
+
40
+
### New test capabilities
41
+
The test module has been refactored to use `anvil` and `forge` features from `foundry` to fork the mainnet. This allows for more advanced testing capabilities.
Copy file name to clipboardExpand all lines: book/get-started/getting-started.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,8 +16,9 @@ Now, with `hnc-up` installed and in your path, you can simply run `hnc-up` to in
16
16
17
17
### On Windows, build from the source
18
18
19
-
If you use Windows, you need to build from the source to get huff.
19
+
If you use Windows, you can build from the source or download the binary form the [releases](https://github.com/cakevm/huff-neo/releases) to get huff.
20
20
21
+
#### Building from the source
21
22
Download and run `rustup-init` from [rustup.rs](https://win.rustup.rs/x86_64). It will start the installation in a console.
22
23
23
24
If you encounter an error, it is most likely the case that you do not have the VS Code Installer which you can [download here](https://visualstudio.microsoft.com/downloads/) and install.
Copy file name to clipboardExpand all lines: book/huff-language/builtin-functions.md
+24Lines changed: 24 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,9 +12,26 @@ At compile time, the invocation of `__EVENT_HASH` is substituted with `PUSH32 ev
12
12
### `__ERROR(<error definition>)`
13
13
At compile time, the invocation of `__ERROR` is substituted with `PUSH32 error_selector`, where `error_selector` is the left-padded 4 byte error selector of the passed error definition.
At compile time, the invocation of `__LEFTPAD` is substituted with `padded_literal`, where `padded_literal` is the left padded version of the passed input. This function is only available as constant assignment or in a code table.
At compile time, the invocation of `__RIGHTPAD` is substituted with `PUSH32 padded_literal`, where `padded_literal` is the right padded version of the passed input.
Copy file name to clipboardExpand all lines: book/tutorial/the-basics.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
## Installation
4
4
5
-
Before you get started writing Huff you will have to install the compiler. Head over to [Getting Started](../get-started/overview.md) and follow the steps to get it installed.
5
+
Before you get started writing Huff you will have to install the compiler. Head over to [Getting Started](../get-started/getting-started.md) and follow the steps to get it installed.
0 commit comments