-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GetStorageAt with whitelist for proxies deployment (#1987)
* TEN RPC: replace custom query with personal transactions * update rpc method, add todo to do before PR ready * getStorageAt whitelist implementation. * Added more exceptions. Fixed null response. Hopefully * Working proxy deployment. * Fix for linter and build gate. Some comments. * dumping progress. * Fix for test. * PR review comments. * Addressed remaining PR comments. * Removed old comment. --------- Co-authored-by: Matt Curtis <[email protected]> Co-authored-by: StefanIliev545 <[email protected]>
- Loading branch information
1 parent
e9b2977
commit 97792e4
Showing
15 changed files
with
719 additions
and
301 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package privacy | ||
|
||
import ( | ||
"math/big" | ||
|
||
"github.com/ethereum/go-ethereum/crypto" | ||
) | ||
|
||
type Whitelist struct { | ||
AllowedStorageSlots map[string]bool | ||
} | ||
|
||
func NewWhitelist() *Whitelist { | ||
whitelistMap := make(map[string]bool) | ||
whitelistMap[toEip1967HashHex("eip1967.proxy.beacon")] = true | ||
whitelistMap[toEip1967HashHex("eip1967.proxy.implementation")] = true | ||
whitelistMap[toEip1967FallbackHashHex("org.zeppelinos.proxy.implementation")] = true | ||
whitelistMap[toEip1967HashHex("eip1967.proxy.admin")] = true | ||
whitelistMap[toEip1967FallbackHashHex("org.zeppelinos.proxy.admin")] = true | ||
|
||
return &Whitelist{ | ||
AllowedStorageSlots: whitelistMap, | ||
} | ||
} | ||
|
||
func toEip1967HashHex(key string) string { | ||
hash := crypto.Keccak256Hash([]byte(key)) | ||
hashAsBig := hash.Big() | ||
eipHashHex := "0x" + hashAsBig.Sub(hashAsBig, big.NewInt(1)).Text(16) | ||
|
||
return eipHashHex | ||
} | ||
|
||
func toEip1967FallbackHashHex(key string) string { | ||
hash := crypto.Keccak256Hash([]byte(key)) | ||
hashAsBig := hash.Big() | ||
eipHashHex := "0x" + hashAsBig.Text(16) | ||
|
||
return eipHashHex | ||
} |
Oops, something went wrong.