Giter Club home page Giter Club logo

1-horse-store-s23's Introduction

horse-store

Horse Store

This is not an audit. This is the codebase of the course for you to learn how compilers and opcodes work. We will be dissecting contracts that you build and tinker with.

We will be using huff, solidity, and yul to do so.

We are also (later) going to use this repo to understand the basics of formal verification.

Getting Started

Requirements

  • Git
    • You'll know you've done it right if you can run git --version
  • Foundry / Foundryup
    • This will install forge, cast, and anvil
    • You can test you've installed them right by running forge --version and get an output like: forge 0.2.0 (f016135 2022-07-04T00:15:02.930499Z)
    • To get the latest of each, just run foundryup
  • Huff Compiler
    • You'll know you've done it right if you can run huffc --version and get an output like: huffc 0.2.0
  • Solidity Compiler
    • You'll know you've done it right if you can run solc --verison and get an output like:
    • solc, the solidity compiler commandline interface Version: 0.8.15+commit.e14f2714.Darwin.appleclan
  • Halmos (which means you need python)
    • You'll know you've done it right if you can run halmos --version and get an output like: Halmos 0.1.9

Quickstart

  1. Clone the repo & install dependencies
git clone https://github.com/Cyfrin/10-horse-store-s23
cd 10-horse-store-s23
make
  1. Run tests
forge test

Use

Compile contracts

To get the raw bytecode of each contract manually:

To get the exact same as what I get, you'll need to use solc version Version: 0.8.20+commit.a1b79de6.Darwin.appleclang.

huffc src/huff/HorseStore.huff -b
solc --strict-assembly --optimize --optimize-runs 20000 yul/HorseStoreYul.yul --bin | grep 60 
solc --optimize --optimize-runs 20000 src/HorseStore.sol --bin | grep 60 
solc --optimize --optimize-runs 20000 src/HorseStoreYul.sol --bin | grep 60 

1-horse-store-s23's People

Contributors

patrickalphac avatar

Stargazers

 avatar  avatar JP avatar Mikhail Antonov avatar George Mathew avatar leo avatar  avatar Shawn avatar Steven Santos avatar  avatar IK avatar  avatar Dr Prabu P avatar masami avatar John Lawniczak avatar  avatar Talha Javed avatar

Watchers

 avatar

1-horse-store-s23's Issues

Not able to perform test using Huff in Foundry

I am trying to resolve this error since morning :

forge test --match-path *Huff* --debug testReadValue 
[โ ‘] Compiling...
No files changed, compilation skipped

Ran 1 test for test/V1/HorseStoreHuff.t.sol:HorseStoreHuff
[FAIL. Reason: setup failed: revert: Invalid huffc binary. Run `curl -L get.huff.sh | bash` and `huffup` to fix.] setUp() (gas: 0)
Suite result: FAILED. 0 passed; 1 failed; 0 skipped; finished in 2.50s (0.00ns CPU time)

Ran 1 test suite in 3.38s (2.50s CPU time): 0 tests passed, 1 failed, 0 skipped (1 total tests)
Error: 
debug arena is empty

Steps I have taken to correct this :
==> reinstall huff compiler
==> update my WSL (apt-get update)
==> match my code using patrick collins sir video thrice and code exactly same like Patrick sir again
==> my test working well without Huff
Can somebody help me to resolve this .

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.