Comments (2)
It can be any address with the lowest 8 bits (last byte) equal to 0
, such as 0x35C8C87AF6e00FB1BdC075A199f195128f49a700
. UnsafeProxy
and Impl
are defined as two independent (uninherited) contracts so the solidity compiler will assign the state variables declared within them to overlapping storage slots. UnsafeProxy.owner
will span byte offset 0-20 of slot 0 and Impl.isInitialized
will span byte offset 0-1 of (also) slot 0. Therefore, writing to one state variable will overwrite the contents of the other when in the context of a delegatecall()
, as is the norm with proxy pattern contracts. In this test, setting the value of owner
to that address will unintentionally reset isInitialized
to false
because of the 0
byte in offset 0-1 of slot 0.
This is very different from a short address attack, which involves how solidity used to decode function arguments. AFAIK short address attacks haven't really been a thing since solidity 0.5.
from useful-solidity-patterns.
Thank you very much, the logic is clear now.
from useful-solidity-patterns.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from useful-solidity-patterns.