/out.log Secret
Created
September 7, 2023 23:07
Analyzing different potential slot times and their effects on storage use of EIP-4788 contract
This file contains hidden or 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
$ cat main.py | |
def union(x, y): [0/264] | |
return set(x) | set(y) | |
def slots(slottime, buflen): | |
base = 1694126615 | |
slots = [] | |
for n in range(buflen // slottime): | |
slots.append(base + n * slottime % buflen) | |
return slots | |
def analyze(buflen): | |
print("buflen = ", buflen // 12) | |
a = slots(4, buflen) | |
b = slots(8, buflen) | |
x = slots(12, buflen) | |
c = slots(16, buflen) | |
d = slots(24, buflen) | |
e = slots(32, buflen) | |
print("total slots used if slot time is 4: ", len(union(a, x))) | |
print("total slots used if slot time is 8: ", len(union(b, x))) | |
print("total slots used if slot time is 12: ", len(union(x, x))) | |
print("total slots used if slot time is 16: ", len(union(c, x))) | |
print("total slots used if slot time is 24: ", len(union(d, x))) | |
print("total slots used if slot time is 32: ", len(union(e, x))) | |
analyze(98304) | |
analyze(93600) | |
$ python main.py | |
buflen = 8192 | |
total slots used if slot time is 4: 24576 | |
total slots used if slot time is 8: 16384 | |
total slots used if slot time is 12: 8192 | |
total slots used if slot time is 16: 12288 | |
total slots used if slot time is 24: 8192 | |
total slots used if slot time is 32: 10240 | |
buflen = 7800 | |
total slots used if slot time is 4: 23400 | |
total slots used if slot time is 8: 15600 | |
total slots used if slot time is 12: 7800 | |
total slots used if slot time is 16: 11700 | |
total slots used if slot time is 24: 7800 | |
total slots used if slot time is 32: 9750 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment