Skip to content

Latest commit

 

History

History
51 lines (30 loc) · 1.74 KB

README.md

File metadata and controls

51 lines (30 loc) · 1.74 KB

Huff puzzles with bitwise operations

Managing EVM (Ethereum Virtual Machine) bytecode frequently demands a solid grasp of bitwise operations, including &, |, <<, >>, ^ and ~. This collection of challenges draws significant inspiration from the RareSkills Huff Puzzles. In addition to providing a practical introduction to the Huff language, the tasks within this repository serve to enhance comprehension of bitwise operations in the context of Ethereum development.

Pre-requisites

Make sure you've installed the Huff Compiler as outlined in the Huff Docs.

TLDR:

curl -L get.huff.sh | bash

then:

 huffup

To verify your installation, run huffc --help. This should print a list of available commands for the huff compiler cli.

Installation

To install dependencies, run:

forge install

How to play

Go to GetBitAt.huff in the src folder and edit it as follows

#define macro MAIN() = takes(0) returns(0) {
    // your Huff code goes here
}

Then run the test with

forge test -vvv --mc GetBitAt

You should see something like this

Running 1 test for test/GetBitAt.t.sol:GetBitAt
[PASS] testGetBitAt() (gas: 5358)
Test result: ok. 1 passed; 0 failed; finished in 4.56s

More resources