Advanced Solidity | Gas Golfing | Yul | EVM | Audit | Zero Knowledge Proofs | Puzzles
Ethereum Yellow Paper Illustrated #1
As against BITCOIN, Ethereum clients can be coded in any language and many already exist. This is so because of the Yellow Paper. It is a specification. Initially, like many developers, I skipped the yellow paper and read the beige paper only to skip the math and equations. This is an attempt to decode the mathematical equations in the Ethereum Yellow Paper and understand them deeper. Importantly keeping it simple. It only gets interesting as we see it one by one.Ethereum State MachineBlock L...
Ethereum Yellow Paper Illustrated #1
As against BITCOIN, Ethereum clients can be coded in any language and many already exist. This is so because of the Yellow Paper. It is a specification. Initially, like many developers, I skipped the yellow paper and read the beige paper only to skip the math and equations. This is an attempt to decode the mathematical equations in the Ethereum Yellow Paper and understand them deeper. Importantly keeping it simple. It only gets interesting as we see it one by one.Ethereum State MachineBlock L...
Gas Golfing #3: Zero vs NonZero Storage Values
This is a continuation of the previous two articles on gas optimization. While it does not matter and one can start from here. There are some references to previous articles. In Gas Golfing #1, We visited the ReentrancyGuard.sol from OpenZeppelin and discussed why a uint256 variable is used to mark the entry and exit of functions. They could have in fact used a bool or a uint8 . One of the reasons was covered in the article. We will deep dive into major reasoning in this section. Beginning wi...
Gas Golfing #3: Zero vs NonZero Storage Values
This is a continuation of the previous two articles on gas optimization. While it does not matter and one can start from here. There are some references to previous articles. In Gas Golfing #1, We visited the ReentrancyGuard.sol from OpenZeppelin and discussed why a uint256 variable is used to mark the entry and exit of functions. They could have in fact used a bool or a uint8 . One of the reasons was covered in the article. We will deep dive into major reasoning in this section. Beginning wi...

Solidity Audit Preparation - Footium@ Sherlock
Footium is a multiplayer football management game where players own and manage a digital football club. To get involved with the Footium universe one needs to own a Footium club. As a Footium club owner, one will receive: 🎮 GAME ACCESS: Gain access to the game 🏟️ STADIUM: A unique, 3D stadium associated with your club ⚜️ BADGE: A generative club badge that can be upgraded 📖 LORE: Unique, AI-generated lore for each club, including info on the fanbase, history, and more that can evolve throu...

Solidity Audit Preparation - Footium@ Sherlock
Footium is a multiplayer football management game where players own and manage a digital football club. To get involved with the Footium universe one needs to own a Footium club. As a Footium club owner, one will receive: 🎮 GAME ACCESS: Gain access to the game 🏟️ STADIUM: A unique, 3D stadium associated with your club ⚜️ BADGE: A generative club badge that can be upgraded 📖 LORE: Unique, AI-generated lore for each club, including info on the fanbase, history, and more that can evolve throu...
Solidity Gas Golfing #2
Gas Golfing #2: Packing VariablesThis article is a continuation of Gas Golfing #1. In the previous article, we discussed how uint8 consumes more gas than uint256. Then a very natural question arises.Variable PackingIf uint8 costs more than uint256 then what is the need to have all of those supported units from 8 256 and why not have uint256 alone? The simple answer to that question is variable packing in solidity. Let us understand more of that through an example. (Deployment optimized for 10...
Solidity Gas Golfing #2
Gas Golfing #2: Packing VariablesThis article is a continuation of Gas Golfing #1. In the previous article, we discussed how uint8 consumes more gas than uint256. Then a very natural question arises.Variable PackingIf uint8 costs more than uint256 then what is the need to have all of those supported units from 8 256 and why not have uint256 alone? The simple answer to that question is variable packing in solidity. Let us understand more of that through an example. (Deployment optimized for 10...
Solidity Gas Golfing #1
Gas Golfing #1: uint8 vs uint256Below is the ReentrancyGuard.sol from OpenZeppelin// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that beca...
Solidity Gas Golfing #1
Gas Golfing #1: uint8 vs uint256Below is the ReentrancyGuard.sol from OpenZeppelin// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that beca...