Skip to content

huff-neo marks a new dawn for the once-abandoned huff-rs, breathing fresh life into its legacy.

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

cakevm/huff-neo

Repository files navigation

Huff Neo Compiler

The Huff Neo Compiler hnc can be used as drop-in replacement for huffc. This repository is a hard-fork from huff-rs, hopefully until huff2 is available. The compiler comes with update dependencies, improved codebase, and several fixes (see CHANGELOG). This compiler is for all those that require a production-ready compiler right now, as the original repository is archived and not supported anymore. As before, be warned that you are responsible for the contracts you deploy. Find the documentation here.

Highlights:

  • Fixed line number and lexing/parsing error reporting
  • Additional error handling and more details for debugging
  • Migration from ethers to alloy and using latest revm version
  • Improved stability and updated all dependencies

Feel free to report any issues. Since there is more than just the compiler, the foundry-huff-neo has you covered for testing and deployment, and huff-neo-toolchain for your CI/CD needs.

Why name it hnc?

Since the original huff-rs repository is archived, it makes it more clear that this is something new. You can overwrite the original huffc or use it as intended as hnc with all the other related tools for Foundry and CI/CD.

What is Huff?

Huff is a low-level programming language designed for developing highly optimized smart contracts. For a more detailed explanation, see the original repository huff-rs.

The PR to add the Huff Language support on GitHub is still pending.

Huff Neo Ecosystem

These are the projects that are maintained for Huff Neo:

Project Scope Support
huff-neo Compiler (This repo)
foundry-huff-neo Foundry Plugin
huff-neo-toolchain GitHub Action (Compiler)
huff-neo-tests-action GitHub Action (Tests)
huff-neo-project-template Project Template
huffmate-neo Example Contracts

Supported IDEs:

Project Editor Status
intellij-huff-plugin IntelliJ

How about huff2?

We are very happy that someone picked up the work. In the meantime we still need some compiler to work with. We are trying to keep the original compiler up-to-date with the latest dependencies. Many, many thanks in advance to the huff2 team!

Installation

Choose one of the following methods to install the Huff Neo Compiler:

Option 1: You can use the installer hnc-up to install the latest version of hnc from a release or nightly build:

curl -L https://raw.githubusercontent.com/cakevm/huff-neo/main/hnc-up/install | bash

Option 2: Build it by cloning the repository and running the following command:

make release

Option 3: Install the latest version with cargo:

cargo install --git https://github.com/cakevm/huff-neo.git hnc --bins --locked

Modules

  • core: The core module to huff-neo-rs. Resolves source file paths, executes compilation, and exports artifacts.
  • cli: The command line interface for the Huff compiler.
  • js: A wasm compatible interface to the Huff compiler for JavaScript bindings.
  • lexer: Takes in the source of a .huff file and generates a vector of Tokens.
  • parser: Crafts a Contract AST from the vector of Tokens generated by huff-lexer.
  • codegen: EVM Bytecode generation module that accepts an AST generated by huff-parser.
  • utils: Various utilities and types used by all modules.
  • hnc-up: Update or revert to a specific huff-neo-rs branch with ease. (Forked from foundry)

Contributing

Feel free to create any issue or PR. We are always looking for contributors to help us improve the project.

Before submitting a PR, please make sure to run the following commands:

make pre-release

Safety

Caution

Please be aware that the resulting bytecode can be unsafe. It is your responsibility to ensure that the contracts are safe and secure. The authors of this project are not responsible for any misuse or loss of funds.

Acknowledgements

Many thanks to all huff-rs contributors and to the authors who maintained it for such a long period! Many thanks as well to the huff-docs contributors. The book directory is a hard-fork from this repository. Again thanks to the original Huff Language compiler: huffc. Thanks to ripc, and big shoutout to Paradigm. Without Foundry the original implementation would not be possible.

License

The all code and content except the book directory is, as the original huff-rs, dual licensed under Apache 2.0 or MIT licence. The book directory is a hard-fork from huff-docs and licensed as the source under the MIT license.

About

huff-neo marks a new dawn for the once-abandoned huff-rs, breathing fresh life into its legacy.

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Languages