Eridian
eridian.xyzx.comGitHub
  • πŸ“–Eridian Docs
  • Ethereum Dev
    • ✏️Ethereum Notes
      • πŸŽ›οΈTechnical Basics
      • πŸͺ§Ethereum Addresses
      • πŸ“šEthereum State Explained
      • β›½Gas Fees Explained
    • πŸ”§Useful Tools
      • ☁️Ethers
      • *️⃣Ethernal
    • πŸ“Solidity Notes
      • ❔Interview Questions
        • 🟒1. Easy - Interview Questions
        • 🟠2. Medium - Interview Questions
        • 🟑3. Hard - Interview Questions
        • πŸ”΄4. Advanced - Interview Questions
      • πŸ’‘Note Ideas
      • ABI
      • abi.encodePacked
      • Abstract Contracts
      • Arrays
      • Casting
      • CEI - Checks, Effects, Interactions
      • Comments (NATSPEC)
      • Constructor
      • Contract Structure & Versions
      • Data - Storage vs Memory
      • Data - Storage Layout
      • Enum
      • Errors (require & revert)
      • Events
      • EVM Opcodes
      • External Contract Interaction
      • πŸ—οΈExternal Dependencies
      • Functions
      • Function Modifiers
      • If / Else / For / While Loops
      • Inheritance
      • Interfaces
      • Keccak256
      • Library
      • Mappings
      • msg.sender
      • Objects & Types
      • OpenZeppelin
      • Payable
      • Public State Variable vs Function
      • Receive & Fallback
      • Security
      • Self Destruct
      • Send ETH (transfer, send, call)
      • Stack Too Deep
      • Structs
      • Style Guide
      • Time Units
      • Try / Catch
      • Typecasting
      • Using Directive
      • Variables, Consts & Immutable
      • Withdraws
    • βš’οΈFoundry Notes
      • πŸ“–Docs & GitHub Pages
      • 🀝Useful Commands
        • πŸ”¨Anvil
        • πŸͺ„Cast
        • πŸ”₯Forge
      • πŸ§ͺTests
        • Cheatcodes
      • πŸ“Useful Scripts
        • Deploy Contract Using Hex
    • πŸ‘ΎDeFi Challenges
      • πŸ‘¨β€πŸš€Ethernaut
        • Ethernaut - Template
        • Level 1 - Fallback ⏺
        • Level 2 - Fallout ⏺
        • Level 3 - Coin Flip ⏺⏺
        • Level 4 - Telephone ⏺
        • Level 5 - Token ⏺⏺
        • Level 6 - Delegation ⏺⏺
        • Level 7 - Force ⏺⏺⏺
        • Level 8 - Vault ⏺⏺
        • Level 9 - King ⏺⏺⏺
        • Level 10 - Re-entrancy ⏺⏺⏺
        • Level 11 - Elevator ⏺⏺
        • Level 12 - Privacy ⏺⏺⏺
        • Level 13 - Gatekeeper 1 ⏺⏺⏺⏺
        • Level 14 - Gatekeeper 2 ⏺⏺⏺
        • Level 15 - Naught Coin ⏺⏺⏺
        • Level 16 - Preservation ⏺⏺⏺⏺
        • Level 17 - Recovery ⏺⏺⏺
        • Level 18 - Magic Number ⏺⏺⏺
        • Level 19 - Alien Codex ⏺⏺⏺⏺
        • Level 20 - Denial ⏺⏺⏺
        • Level 21 - Shop ⏺⏺
        • Level 22 - Dex ⏺⏺
        • Level 23 - Dex Two ⏺⏺
        • Level 24 - Puzzle Wallet ⏺⏺⏺⏺
        • Level 25 - Motorbike ⏺⏺⏺
        • Level 26 - DoubleEntryPoint ⏺⏺
        • Level 27 - Good Samaritan ⏺⏺⏺
        • Level 28 - Gatekeeper 3 ⏺⏺⏺
        • Level 29 - Switch ⏺⏺⏺⏺
        • Level 30 - Higher Order ⏺⏺⏺⏺
        • Level 31 - Stake ⏺⏺⏺
      • πŸ’ΈDamn Vulnerable DeFi
    • πŸ”Auditing
      • πŸ—žοΈExploit Resources
      • πŸ”§Audit Tools
    • πŸ€–MEV
  • Infrastructure Docs
    • πŸ’»Hardware
    • 🐧Linux
      • πŸ“–Linux Glossary
      • ⌨️Linux Commands
      • πŸ’ΎInstallation
      • πŸ—οΈMaintenance
      • πŸ–₯️Ubuntu Desktop
      • πŸ›œZeroTier
      • 🎞️TMUX
      • πŸ”΅Bluetooth
    • ⛓️Ethereum Clients
      • βš™οΈExecution Clients
        • ⛏️Geth
          • πŸ’ΎInstallation
          • ⌨️Useful Commands
          • πŸ—οΈMaintenance
        • 🐻Erigon
          • πŸ’ΎInstallation
          • ⌨️Useful Commands
          • πŸ—οΈMaintenance
        • 🧢Besu
          • πŸ’ΎInstallation
          • ⌨️Useful Commands
          • πŸ—οΈMaintenance
      • 🀝Beacon Clients
        • πŸ’‘Lighthouse
          • πŸ’ΎInstallation
          • ⌨️Useful Commands
          • πŸ—οΈMaintenance
        • πŸͺ…Teku
          • πŸ’ΎInstallation
          • ⌨️Useful Commands
          • πŸ—οΈMaintenance
      • πŸ’ŽValidator Clients
        • πŸ’‘Lighthouse
          • πŸ’ΎInstallation
          • ⌨️Useful Commands
          • πŸ—οΈMaintenance
      • βž•L2 Clients
        • πŸ”΅Base
          • πŸ’ΎInstallation
          • ⌨️Useful Commands
          • πŸ—οΈMaintenance
      • πŸ’°MEV Boost
        • πŸ’ΎInstallation
        • πŸ—οΈMaintenance
    • 🚨Alerting and Monitoring
      • πŸ”₯Prometheus
      • 🌑️HealthChecks.io
      • πŸ“ŸPagerDuty
  • General Dev
    • πŸ’ΎGit Notes
      • Repos
      • Committing changes
      • Branches
      • Merging & Rebasing
      • PRs
Powered by GitBook
On this page
  • 3.1 How does fixed point arithmetic represent numbers?
  • 3.2 What is an ERC20 approval frontrunning attack?
  • 3.3 What opcode accomplishes address(this).balance?
  • 3.4 How many arguments can a solidity event have?
  • 3.5 What is an anonymous Solidity event?
  • 3.6 Under what circumstances can a function receive a mapping as an argument?
  • 3.7 What is an inflation attack in ERC4626?
  • 3.8 How many storage slots does this use? uint64[] x = [1,2,3,4,5]? Does it differ from memory?
  • 3.9 Prior to the Shanghai upgrade, under what circumstances is returndatasize() more efficient than PUSH 0?
  • 3.10 Why does the compiler insert the INVALID op code into Solidity contracts?
  • 3.11 What is the difference between how a custom error and a require with error string is encoded at the EVM level?
  • 3.12 1hat is the kink parameter in the Compound DeFi formula? 1ow can the name of a function affect its gas cost, if at all?
  • 3.13 What is a common vulnerability with ecrecover?
  • 3.14 What is the difference between an optimistic rollup and a zk-rollup?
  • 3.15 How does EIP1967 pick the storage slots, how many are there, and what do they represent?
  • 3.16 How much is one Sazbo of ether?
  • 3.17 What can delegatecall be used for besides use in a proxy?
  • 3.18 Under what circumstances would a smart contract that works on Etheruem not work on Polygon or Optimism? (Assume no dependencies on external contracts)
  • 3.19 How can a smart contract change its bytecode without changing its address?
  • 3.20 What is the danger of putting msg.value inside of a loop?
  • 3.21 escribe the calldata of a function that takes a dynamic length array of uint128 when uint128[1,2,3,4] is passed as an argument.
  • 3.22 Why is strict inequality comparisons more gas efficient than ≀ or β‰₯? What extra opcode(s) are added?
  • 3.23 If a proxy calls an implementation, and the implementation self-destructs in the function that gets called, what happens?
  • 3.24What is the relationship between variable scope and stack depth?
  • 3.25What is an access list transaction?
  • 3.26 How can you halt an execution with the mload opcode?
  • 3.27 What is a beacon in the context of proxies?
  • 3.28 Why is it necessary to take a snapshot of balances before conducting a governance vote?
  • 3.29 How can a transaction be executed without a user paying for gas?
  • 3.30 In solidity, without assembly, how do you get the function selector of the calldata?
  • 3.31 How is an Ethereum address derived?
  • 3.32 What is the metaproxy standard?
  • 3.33 If a try catch makes a call to a contract that does not revert, but a revert happens inside the try block, what happens?
  • 3.34 If a user calls a proxy makes a delegatecall to A, and A makes a regular call to B, from A’s perspective, who is msg.sender? from B’s perspective, who is msg.sender? From the proxy’s perspective, who is msg.sender?
  • 3.35 Under what circumstances do vanity addresses (leading zero addresses) save gas?
  • 3.36 Why do a significant number of contract bytecodes begin with 6080604052?
  • 3.37 What does that bytecode sequence do?
  • 3.38 How does Uniswap V3 determine the boundaries of liquidity intervals?
  • 3.39 What is the risk-free rate?
  • 3.40 When a contract calls another call via call, delegatecall, or staticcall, how is information passed between them?
  • 3.41 What is the difference between bytes and bytes1[]?
  • 3.42 What is the most amount of leverage that can be achieved in a borrow-swap-supply-collateral loop if the LTV is 75%? What about other LTV limits?
  • 3.43 How does Curve StableSwap achieve concentrated liquidity?
  • 3.44 What quirks does the Tether stablecoin contract have?
  • 3.45 What is the smallest uint that will store 1 million? 1 billion? 1 trillion? 1 quadrillion?
  • 3.46 What danger to uninitialized UUPS logic contracts pose?
  • 3.47 What is the difference (if any) between what a contract returns if a divide-by-zero happens in Soliidty or if a divide-by-zero happens in Yul?
  • 3.48 Why can’t .push() be used to append to an array in memory?
Edit on GitHub
  1. Ethereum Dev
  2. Solidity Notes
  3. Interview Questions

3. Hard - Interview Questions

Last updated 1 month ago

All of these questions can be answered in three sentences or less.

3.1 How does fixed point arithmetic represent numbers?

Fixed-point arithmetic represents numbers using a fixed number of bits for the integer and fractional parts. Unlike floating-point arithmetic, which dynamically adjusts precision, fixed-point numbers maintain a constant scaling factor.

3.2 What is an ERC20 approval frontrunning attack?

3.3 What opcode accomplishes address(this).balance?

BALANCE

3.4 How many arguments can a solidity event have?

17 total arguments of which 3 can be indexed parameters.

  • Indexed parameters are stored in the event’s topics

  • The remaining parameters are stored in the event’s data field in the transaction logs.

3.5 What is an anonymous Solidity event?

An event declared with the anonymous keyword. This means that it does not have a topic for the event signature, making it more gas-efficient but harder to filter in logs.

  • No topic for the event signature, making it cheaper to emit.

  • All parameters can be indexed, unlike regular events.

event MyEvent(address indexed user, uint256 amount) anonymous; 

function emitEvent() external {
    emit MyEvent(msg.sender, 100);
}

Why Use Anonymous Events?

βœ… Lower Gas Cost – Saves gas by omitting the event signature topic.

βœ… Index More Parameters – Can index all parameters instead of just 3.

When NOT to Use Anonymous Events?

❌ Harder to Filter in Logs – Since there’s no event signature topic, you must filter logs by indexed parameters only.

❌ Less Readable for External Indexers – Standard logs rely on event signatures for indexing, so anonymous events make it harder to track events externally.

3.6 Under what circumstances can a function receive a mapping as an argument?

A function can receive a mapping as an argument only if it’s an internal or private function. This is because mappings are not iterable or passable as values due to their storage-bound nature.

3.7 What is an inflation attack in ERC4626?

3.8 How many storage slots does this use? uint64[] x = [1,2,3,4,5]? Does it differ from memory?

3.9 Prior to the Shanghai upgrade, under what circumstances is returndatasize() more efficient than PUSH 0?

3.10 Why does the compiler insert the INVALID op code into Solidity contracts?

The INVALID opcode (also known as 0xFE) is an explicit way for the EVM to halt execution immediately and consume all remaining gas. Solidity compilers insert INVALID in contracts for various reasons, primarily to prevent unintended execution paths and ensure correctness in smart contracts.

  1. Unreachable Code Protection

  2. Function Selectors for Nonexistent Functions

  3. Error Handling in Jump Tables

  4. Preventing Uninitialized Storage Corruption

3.11 What is the difference between how a custom error and a require with error string is encoded at the EVM level?

3.12 1hat is the kink parameter in the Compound DeFi formula? 1ow can the name of a function affect its gas cost, if at all?

3.13 What is a common vulnerability with ecrecover?

3.14 What is the difference between an optimistic rollup and a zk-rollup?

3.15 How does EIP1967 pick the storage slots, how many are there, and what do they represent?

3.16 How much is one Sazbo of ether?

3.17 What can delegatecall be used for besides use in a proxy?

3.18 Under what circumstances would a smart contract that works on Etheruem not work on Polygon or Optimism? (Assume no dependencies on external contracts)

3.19 How can a smart contract change its bytecode without changing its address?

3.20 What is the danger of putting msg.value inside of a loop?

3.21 escribe the calldata of a function that takes a dynamic length array of uint128 when uint128[1,2,3,4] is passed as an argument.

3.22 Why is strict inequality comparisons more gas efficient than ≀ or β‰₯? What extra opcode(s) are added?

3.23 If a proxy calls an implementation, and the implementation self-destructs in the function that gets called, what happens?

3.24What is the relationship between variable scope and stack depth?

3.25What is an access list transaction?

3.26 How can you halt an execution with the mload opcode?

3.27 What is a beacon in the context of proxies?

3.28 Why is it necessary to take a snapshot of balances before conducting a governance vote?

3.29 How can a transaction be executed without a user paying for gas?

3.30 In solidity, without assembly, how do you get the function selector of the calldata?

3.31 How is an Ethereum address derived?

3.32 What is the metaproxy standard?

3.33 If a try catch makes a call to a contract that does not revert, but a revert happens inside the try block, what happens?

3.34 If a user calls a proxy makes a delegatecall to A, and A makes a regular call to B, from A’s perspective, who is msg.sender? from B’s perspective, who is msg.sender? From the proxy’s perspective, who is msg.sender?

3.35 Under what circumstances do vanity addresses (leading zero addresses) save gas?

3.36 Why do a significant number of contract bytecodes begin with 6080604052?

3.37 What does that bytecode sequence do?

3.38 How does Uniswap V3 determine the boundaries of liquidity intervals?

3.39 What is the risk-free rate?

3.40 When a contract calls another call via call, delegatecall, or staticcall, how is information passed between them?

3.41 What is the difference between bytes and bytes1[]?

3.42 What is the most amount of leverage that can be achieved in a borrow-swap-supply-collateral loop if the LTV is 75%? What about other LTV limits?

3.43 How does Curve StableSwap achieve concentrated liquidity?

3.44 What quirks does the Tether stablecoin contract have?

3.45 What is the smallest uint that will store 1 million? 1 billion? 1 trillion? 1 quadrillion?

3.46 What danger to uninitialized UUPS logic contracts pose?

3.47 What is the difference (if any) between what a contract returns if a divide-by-zero happens in Soliidty or if a divide-by-zero happens in Yul?

3.48 Why can’t .push() be used to append to an array in memory?

πŸ“
❔
🟑
Over 150 interview questions for Ethereum Developers - RareSkillsRareSkills
Logo