Book of Proxy Patterns and Delegatecall

Book of Proxy Patterns and Delegatecall

Proxy patterns are probably one of the most confusing aspects of learning Solidity development because they have very few analogs in other fields of software development. Further complicating the issue is that — although delegatecall is easy to understand conceptually — fully grasping its nuances requires some background knowledge about how the EVM (Ethereum Virtual Machine) and Solidity compiler work. These nuances are not simple “did you know” trivia but have consequential impact on how a smart contract will operate. Furthermore, standards around proxy patterns are still evolving — ERC-7201 is less than a year old at this time of writing.

Any competent Solidity developer or auditor should be expected to have a comprehensive understanding Of delegatecall and the proxy patterns that depend on it. Proxy patterns are not trivial and it only takes one mistake to break upgradeability, or worse, introduce a catastrophic bug.

This book aims to help such an audience get up to speed on this topic as efficiently and as comprehensively as possible, while also deeply exploring details that are omitted or glossed over in other treatments. At the same time, we try to be aggressively scoped; this book is not a complete course on the EVM — we only discuss the parts that are relevant to properly understanding delegatecall and why the existing patterns are designed the way they are.

We suggest reading the tutorials in the order provided below. Multiple readers have commented “l thought I knew the subject until I read the RareSkills’ tutorial.” Therefore, we suggest giving the tutorials a read even if you are already familiar with the subject.

Aknowledgements

We would like to thank the team at OpenZeppelin for providing inputs and suggestions as we created this resource.