{"id":13766686,"url":"https://github.com/huff-language/huff-rs","last_synced_at":"2025-05-10T22:31:16.008Z","repository":{"id":38534340,"uuid":"498320188","full_name":"huff-language/huff-rs","owner":"huff-language","description":"A low-level assembly language for the Ethereum Virtual Machine built in blazing-fast pure rust.","archived":true,"fork":false,"pushed_at":"2024-10-20T22:37:52.000Z","size":4071,"stargazers_count":601,"open_issues_count":31,"forks_count":82,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-05-05T14:10:50.469Z","etag":null,"topics":["bytecode","compiler","ethereum","evm","huff","language","rust","solidity"],"latest_commit_sha":null,"homepage":"https://huff.sh","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/huff-language.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-31T12:09:16.000Z","updated_at":"2025-05-01T06:29:17.000Z","dependencies_parsed_at":"2023-10-01T17:13:48.677Z","dependency_job_id":"d158de1e-01ec-4c90-aa4d-3b47a430b4f3","html_url":"https://github.com/huff-language/huff-rs","commit_stats":{"total_commits":680,"total_committers":37,"mean_commits":18.37837837837838,"dds":0.5529411764705883,"last_synced_commit":"4c4ae27378224b6a3a1afd35116f0da710ff1418"},"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huff-language%2Fhuff-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huff-language%2Fhuff-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huff-language%2Fhuff-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huff-language%2Fhuff-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/huff-language","download_url":"https://codeload.github.com/huff-language/huff-rs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253492529,"owners_count":21916959,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bytecode","compiler","ethereum","evm","huff","language","rust","solidity"],"created_at":"2024-08-03T16:00:59.508Z","updated_at":"2025-05-10T22:31:14.980Z","avatar_url":"https://github.com/huff-language.png","language":"Rust","readme":"\u003cimg align=\"right\" width=\"150\" height=\"150\" top=\"100\" src=\"./assets/huff.png\"\u003e\n\n\u003e [!WARNING]\n\u003e `huff-rs` (aka **legacy** huff) is deprecated and no longer maintained, go see [huff2](https://github.com/huff-language/huff2) for the renewed compiler.\n\n# huff-rs • [![ci](https://github.com/huff-language/huff-rs/actions/workflows/ci.yaml/badge.svg)](https://github.com/huff-language/huff-rs/actions/workflows/ci.yaml) [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) ![Crates.io](https://img.shields.io/crates/v/huff-rs) ![Discord](https://img.shields.io/discord/980519274600882306)\n\n\u003e `huff-rs` is a [Huff](https://github.com/huff-language) compiler built in rust.\n\n\n## What is a Huff?\n\nHuff 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. Instead, Huff exposes its programming stack to the developer for manual manipulation.\n\nRather than having functions, Huff has macros - individual blocks of bytecode that can be rigorously tested and evaluated using the Huff runtime testing suite.\n\n[Huff](https://github.com/AztecProtocol/huff) was originally developed by the Aztec Protocol team to write [Weierstrudel](https://github.com/aztecprotocol/weierstrudel). Weierstrudel is an on-chain elliptical curve arithmetic library that requires incredibly optimized code that neither [Solidity](https://docs.soliditylang.org/en/v0.8.14/) nor [Yul](https://docs.soliditylang.org/en/v0.8.9/yul.html) could provide.\n\nWhile 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.\n\nTo dive deeper into [Huff](https://github.com/huff-language), visit the [Official Huff Docs](https://huff.sh)(also available on [github](https://github.com/huff-language/huff-docs)).\n\n## Installation\n\n_Something not working? Send a message in [discord](https://discord.huff.sh)._\n\nFirst run the command below to get `huffup`, the Huff installer:\n\n```bash\ncurl -L get.huff.sh | bash\n```\n\nTo avoid redirecting the script directly into bash, download and run the [huffup installation script](https://raw.githubusercontent.com/huff-language/huff-rs/main/huffup/install).\n\nTo install the Huff compiler, simply run `huffup`.\n\nIf you have the old [huffc (TypeScript version)](https://github.com/huff-language/huffc) npm package installed globally, you can remove it with:\n\n```bash\nsudo yarn global remove huffc\n```\n\nTo make sure you are running the rust version, you can run `huffc --version` and it should respond with `huff_cli \u003cversion\u003e`. If it responds with `2.0.0` that means you are running the Typescript version.\n\n```bash\n$ huffc --version\nhuff_cli 0.3.2\n```\n\n**Alternatively**\n\nInstall from source by running:\n\n```bash\ngit clone https://raw.githubusercontent.com/huff-language/huff-rs\ncd huff-rs\ncargo install --path ./huff_cli --bins --locked --force\n```\n\nOR\n\n```bash\ncargo install --git https://raw.githubusercontent.com/huff-language/huff-rs --locked huff_cli\n```\n\n## How Fast?\n\n**Compilation Benchmarks**\n\n| Compiler                         | Cold (No Cache) | Light Cache | Deep Cache | Full Cache |\n| -------------------------------- | --------------- | ----------- | ---------- | ---------- |\n| [huff-language/huff-rs][huff-rs] | XXXms           | XXXms       | XXXms      | XXXms      |\n| [huff-language/huffc][huffc]     | XXXms           | XXXms       | XXXms      | XXXms      |\n\n_Note: Compilation benchmarks were performed on [huff-examples erc20](https://github.com/huff-language/huff-examples/tree/main/erc20/contracts/ERC20.huff)._\n\n## Architecture\n\n![Huff Compiler Architecture](./assets/huffc.png)\n\n## Modules\n\n- [huff_core](./huff_core): The core module to huff-rs. Resolves source file paths, executes compilation, and exports artifacts.\n- [huff_cli](./huff_cli): The command line interface for the Huff compiler.\n- [huff_js](./huff_js): A wasm compatible interface to the Huff compiler for JavaScript bindings.\n- [huff_lexer](./huff_lexer): Takes in the source of a `.huff` file and generates a vector of `Token`s.\n- [huff_parser](./huff_parser): Crafts a `Contract` AST from the vector of `Token`s generated by [huff_lexer](./huff_lexer).\n- [huff_codegen](./huff_codegen): EVM Bytecode generation module that accepts an AST generated by [huff_parser](./huff_parser).\n- [huff_utils](./huff_utils): Various utilities and types used by all modules.\n- [huffup](./huffup): Update or revert to a specific huff-rs branch with ease. (Forked from [foundry](https://github.com/foundry-rs/foundry))\n\n## Contributing\n\nAll contributions are welcome! We want to make contributing to this project as easy and transparent as possible, whether it's:\n\n- Reporting a bug\n- Discussing the current state of the code\n- Submitting a fix\n- Proposing new features\n- Becoming a maintainer\n\nWe use GitHub issues to track public bugs. Report a bug by [opening a new issue](https://github.com/huff-language/huff-rs/issues/new); it's that easy!\n\nTo run examples, make sure you update git submodules to pull down the [huff-examples](./huff-examples/) submodule by running `git submodule update`.\n\nThe branching convention used by [huff-rs](https://github.com/huff-language/huff-rs) is a `stage` branch that is meant to be merged off of and is periodically merged into `main`. So, when creating a feature, branch off of the `stage` branch and create a pr from your branch into the `stage` branch!\n\ni.e:\n![Branching Conventions](./assets/branching.png)\n\nTo pass github actions, please run:\n\n```bash\ncargo check --all\ncargo test --all --all-features\ncargo +nightly fmt -- --check\ncargo +nightly clippy --all --all-features -- -D warnings\n```\n\nIn order to fix any formatting issues, run:\n\n```bash\ncargo +nightly fmt --all\n```\n\n**Recommended PR Template**\n\nHere is an example PR template - not strictly required, but will greatly improve the speed at which your PR is reviewed \u0026 merged!\n\n```md\n## Overview\n\n\u003cProvide a general overview of what your pr accomplishes, why, and how (including links)\u003e\n\n## Checklist\n\n- [x] \u003cEx: Added a `new` method to the Huff Lexer [here](./huff_lexer/src/lib.rs#50)\u003e\n- [x] \u003cEx: Fully tested the `new` method [here](./huff_lexer/tests/new.rs)\u003e\n- [ ] \u003cEx: Wrote documentation for the `new` method [here](./huff_lexer/README.md#20)\u003e\n```\n\nWhen the PR checklist isn't complete, it is **highly** recommended to make it a draft PR. NOTE: if your PR is not complete, it will likely be changed to a draft by one of the repository admins.\n\nFor breaking changes: make sure to edit the [excalidraw asset](https://excalidraw.com/#json=9YvTZp-rY9NOQnX9TC8Dz,sVM8vpgvQqGiXNXrBNshTg) and export the file to [./assets/huffc.excalidraw](./assets/huffc.excalidraw) along with an image to [./assets/huffc.png](./assets/huffc.png).\n\n## Safety\n\n\u003e **Warning**\n\u003e\n\u003e This is **experimental software** and is provided on an \"as is\" and \"as available\" basis.\n\u003e Expect rapid iteration and **use at your own risk**.\n\u003e\n\u003e This code is **not designed for safety**.\n\u003e\n\u003e - There are untested invariants in the code that may break.\n\u003e - **You can easily shoot yourself in the foot if you're not careful.**\n\u003e - You should thoroughly read the documentation and examples.\n\u003e\n\u003e We **do not give any warranties** and **will not be liable for any loss** incurred through any use of this codebase.\n\n## Acknowledgements\n\nThe original [Huff Language](https://github.com/huff-language) compiler: [`huffc`](https://github.com/huff-language/huffc).\n\nAn exemplary, minimal rust compiler: [ripc](https://github.com/ibraheemdev/ripc).\n\n[Foundry](https://github.com/foundry-rs/foundry), for the many scripts, documentation, devops, and code on which [huff-rs](https://github.com/huff-language/huff-rs) is based on.\n\nAll [huff-rs](https://github.com/huff-language/huff-rs) contributors, users, advocates, and enthusiasts!\n","funding_links":[],"categories":["Official huff-language Github repo","Smart Contracts"],"sub_categories":["Other"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuff-language%2Fhuff-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhuff-language%2Fhuff-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuff-language%2Fhuff-rs/lists"}