-
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 whitelist implementation.
- Loading branch information
StefanIliev545
committed
Jul 11, 2024
1 parent
fd59ed7
commit c7517c1
Showing
14 changed files
with
683 additions
and
302 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,28 @@ | ||
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 | ||
|
||
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 | ||
} |
Oops, something went wrong.