frangio / cacheable-beacon-proxy Goto Github PK
View Code? Open in Web Editor NEWUpgradeable proxy with the least possible gas overhead.
Upgradeable proxy with the least possible gas overhead.
cacheable-beacon-proxy/contracts/CacheableBeaconProxy.sol
Lines 34 to 36 in 78ccbbc
The check if (cache.code.length > 0)
is redundant as it is done by the compiler in CacheableBeaconImpl(cache).selfDestructIfCache();
The current implementation requires calling upgradeTo
after deploying the beacon to set the implementation and make the beacon usable. However, it adds more complexity when the beacon is owned by multisig/governance which needs to be set on every deployment.
One way to ease the flow is to set the implementation in constructor like OZ's UpgradeableBeacon, but it will revert since there is selfdestruct check. Therefore, I suggest to move the check into deployCache()
since the impact of having no self-destruct is only applied when the implementation has already been cloned to the cache.
I think this could be a better solution and probably could skip the check for empty implementation check since calling the function to an unknown contract will revert. Need everyone's opinion on this, feel free to assess the impact.
ps: there is a trade-off and more work for this. First, using an implementation that isn't exposing self-destruct is still allowed, but I think it has no great impact before deployCache
is called. Second, we need to pre-compute the beacon address for implementation deployment.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.