Skip to content

These exercises were created for our Advanced Solidity Bootcamp and open sourced. Learn EVM bytecode with the Huff Language.

License

Notifications You must be signed in to change notification settings

brozorec/huff-bitwise-puzzles

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

These exercises were created for our Advanced Solidity Bootcamp and open sourced. Learn EVM bytecode with the Huff Language.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages

  • Solidity 100.0%