Skip to content

Cyfrin/assembly-evm-opcodes-and-formal-verification-course

Repository files navigation

Assembly, EVM Opcodes, and Formal Verification

Welcome to the repository for the Assembly, EVM Opcodes, and Formal Verification Course by Cyfrin Updraft!

This repository houses the written content of our courses, organized to facilitate easy access and contribution from our community. Please refer to this for an in-depth explanation of the content:

  • Website - Join Cyfrin Updraft and enjoy 50+ hours of smart contract development courses
  • Twitter - Stay updated with the latest course releases
  • LinkedIn - Add Updraft to your learning experiences
  • Discord - Join a community of 3000+ developers and auditors
  • Newsletter - Weekly security research tips and resources to level up your career
  • Codehawks - Smart contracts auditing competitions to help securing web3

This was considered part 2 of the security and auditing course, but now, it's it's own living breathing course!

Table of Contents

Introduction, Resources, and Prerequisites

Link to video: Coming soon...

โš ๏ธ All code associated with this course is for demo purposes only. They have been audited, but we do not recommend them for production use and should be used at your own risk.

Resources For This Course

Join Cyfrin Updraft for the best learning experience!

  • AI Frens
  • Github Discussions
    • Ask questions and chat about the course here!
  • Stack Exchange Ethereum
    • Great place for asking technical questions about Ethereum
  • Peeranha
    • Decentralized Stack Exchange!

Challenge Contracts Registry

Prerequisites

An intermediate understanding of solidity. You don't need to be a pro, but you should be familiar with:

Tools

We assume you have a solid grasp of the following tools for this course.

  • Foundry
  • Solidity
  • VSCode/Text Editor
  • Basic Linux/Unix/Bash terminal commands
  • Git & GitHub
  • WSL (if you're on windows)

Note: You can get through this course with just having an advanced grasp of solidity & foundry. However, having at least a shallow understanding of security and low-level EVM will make this course much easier to grasp. And you doing the security coruse will make you a better EVM developer!

Outcomes

  • Be able to decompile a smart contract right from the raw bytecode
  • Be able to understand exactly how EVM opcodes work so you can write more gas-efficient code
  • Learn the Huff smart contract programming language
  • Be able to write formal verification in Halmos & Certora
  • Be able to understand the difference between Fuzzing & Formal Verification
  • Have an intermediate understanding of how to write Formal Verification tests for solidity

Curriculum

Section 0: Welcome

Why EVM, Opcodes, and Formal Verification?

Best Practices

  • TODO: Add link to "how to ask a question" and "how to answer a question" and "how to work with AI"
  • Register for Cyfrin Updraft
    • USE THIS SITE!!! It's specfically made to make learning easier
  • Follow the repository: While going through the course be 100% certain to follow along with the github repository. If you run into in an issue check the chronological-updates in the repo.
  • Be Active in the community: Ask questions and engage with other developers going through the course in the discussions tab, be sure to go and say hello or gm! This space is different from the other industries, you don't have to be secretive; communicate, network and learn with others :)
  • Learn at your own pace: It doesn't matter if it takes you a day, a week, a month or even a year. Progress >>> Perfection
  • Take Breaks: You will exhaust your mind and recall less if you go all out and watch the entire course in one sitting. Suggested Strategy every 25 minutes take a 5 min break, and every 2 hours take a longer 30 min break
  • Refer to Documentation: Things are constantly being updated, so whenever Patrick opens up some documentation, open it your end and maybe even have the code sample next to you.
  • Use ChatGPT and/or the course chat

๐ŸŽฏ๐ŸŽฏ๐ŸŽฏ๐ŸŽฏ๐ŸŽฏ๐ŸŽฏ๐ŸŽฏ๐ŸŽฏ๐ŸŽฏ๐ŸŽฏ๐ŸŽฏ๐ŸŽฏ๐ŸŽฏ๐ŸŽฏ๐ŸŽฏ๐ŸŽฏ๐ŸŽฏ๐ŸŽฏ๐ŸŽฏ๐ŸŽฏ๐ŸŽฏ๐ŸŽฏ๐ŸŽฏ

๐ŸŽฏ Exercise: Write yourself a message about why you want this

  • This will be important for when things get hard
  • Is it money? Save web3? Become someone? Write down as many reasons as possible.

Section 0 NFT

  • No section 0 challenge NFT for this one!

๐ŸŽฏ๐ŸŽฏ๐ŸŽฏ๐ŸŽฏ๐ŸŽฏ๐ŸŽฏ๐ŸŽฏ๐ŸŽฏ๐ŸŽฏ๐ŸŽฏ๐ŸŽฏ๐ŸŽฏ๐ŸŽฏ๐ŸŽฏ๐ŸŽฏ๐ŸŽฏ๐ŸŽฏ๐ŸŽฏ๐ŸŽฏ๐ŸŽฏ๐ŸŽฏ๐ŸŽฏ๐ŸŽฏ

(back to top) โฌ†๏ธ

Section 1: EVM Assembly, Opcodes, Yul, & Huff | Horse Store


Smart Contract Audit & Security Review, Horse Store


๐Ÿง‘๐Ÿพโ€๐Ÿ’ป Horse Store Code: https://github.com/Cyfrin/1-horse-store-s23

Horse StoreV1 (Solidity) Horse StoreV2 (Solidity)
View in Remix View in Remix

๐Ÿด๐Ÿด๐Ÿด๐Ÿด๐Ÿด๐Ÿด๐Ÿด๐Ÿด๐Ÿด๐Ÿด๐Ÿด๐Ÿด๐Ÿด๐Ÿด๐Ÿด๐Ÿด๐Ÿด๐Ÿด๐Ÿด๐Ÿด๐Ÿด๐Ÿด๐Ÿด๐Ÿด๐Ÿด๐Ÿด

๐Ÿด Exercises:

  1. Convert a minimal contract of your own into Huff or Yul

Section 1 NFT

๐Ÿด๐Ÿด๐Ÿด๐Ÿด๐Ÿด๐Ÿด๐Ÿด๐Ÿด๐Ÿด๐Ÿด๐Ÿด๐Ÿด๐Ÿด๐Ÿด๐Ÿด๐Ÿด๐Ÿด๐Ÿด๐Ÿด๐Ÿด๐Ÿด๐Ÿด๐Ÿด๐Ÿด๐Ÿด๐Ÿด

(back to top) โฌ†๏ธ

Section 2: Introduction to Formal Verification & Symbolic Execution | Math Master


Smart Contract Audit & Security Review, Math Master


๐Ÿง‘๐Ÿพโ€๐Ÿ’ป Code: https://github.com/Cyfrin/2-math-master-audit

Certora Signup

click me :)

Symbolic Execution / Formal Verification Tools in Web3

Certora

  • Rules
  • Harnessing
  • Methods Block
  • Config Files / Scene
  • Linking
  • Invariants
  • Prover Args

Issues

๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ

๐Ÿงฎ Exercises:

  1. Attempt to use another FV tool
  2. Look into the Solady LibClone.sol
    1. It's a really cool codebase
  3. Watch this awesome video ๐ŸŽฅ
  4. Audit this! ๐Ÿช™

Section 2 NFT

๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ

(back to top) โฌ†๏ธ

Section 3: Advanced Formal Verification | Gas Bad NFT Marketplace


Smart Contract Audit & Security, Gas Bad


๐Ÿง‘๐Ÿพโ€๐Ÿ’ป Code: https://github.com/Cyfrin/3-gas-bad-nft-marketplace-audit

Certora

  • Parametric rules
  • Ghosts
  • Hooks
  • Dispatching & Summaries
  • Sanity

๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ

๐Ÿงฎ Exercises:

  1. Compete in a formal verification contest!

Section 3 NFT

๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ๐Ÿงฎ

(back to top) โฌ†๏ธ

Congratulations

๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ Completed The Course! ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ

Where do I go now?

Coming soon: The EVM, Assembly, and Formal Verification Course!!

Learning More

Disclosures

The Cyfrin team runs CodeHawks, Cyfrin Updraft, and private security reviews. They are an advisor to the Peeranha project, and run various blockchain nodes like Chainlink & Ethereum. Additionally, they are responsible for the creation of the Aderyn and Solodit tools.

Thank you

Sponsors

Lead Lecturers / Code Builders

Guest Lecturers

Special thanks

Huge Extra Thank YOU

Thanks to everyone who is taking, participating in, and working on this course. These courses are passion project data dumps for everyone in the web3 ecosystem.

Let's level up so we can keep web3 safer, and thank you again for taking this course!

Cyfrin Twitter Cyfrin YouTube

(back to top) โฌ†๏ธ

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •