B003: Maximal Gas Optimizations

Transaction Fees

Compilation Optimizer

Costly Notions

Looks simple, right?
  • Contains three mapping lookups
  • Reads a full storage slot three times
  • Upcasts a bytes8 three times

Mapping Lookups

Redundant Lookups Eliminated

Storage Access

Variable Tight Packing
Struct Stored in Memory

Type Upcasting

Optimized Data Types

Comparison

  • Contains three mapping lookups — Contains a single mapping lookup
  • Reads a full storage slot three times — Reads a full storage slot once
  • Upcasts a bytes8 three times — Contains no upcasting

Conclusion

--

--

--

A Solidity security auditor keen to share his knowledge.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Mask Network has Received the Strategic Investment from Binance, Building a Web 3.0

This is your opportunity to earn passively as you change lives globally.

JMY (JasmyCoin) is a native cryptocurrency used in IoT and blockchain technology services.

Hot Wheels Parking on the Blockchain

NGK Global Launch Conference Ended Successfully

Advancing Heimdallr, the Last Wealth-Creating Blockchain Game of 2021 Is Rapidly Coming

Sports Industry Transforming To New Age By Adapting NFTs

How to Make millions on NFT tokens. What is this anyway?

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alex Papageorgiou

Alex Papageorgiou

A Solidity security auditor keen to share his knowledge.

More from Medium

What is DeFi and How to Make Passive Income Using DeFi

What’s BBGO and why you should use it to trade cryptos?

Blockchain Ep03: Unhashing the Hash Functions— Part 1

Difference Between Blockchain & Distributed Ledger