-
Notifications
You must be signed in to change notification settings - Fork 997
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pyspec-SSZ: lists-rework (enable static generalized indices) + fully python class based now. #1180
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👏 , but it's not quite complete yet. CC @hwwhww, this PR also does the step of typing of all integers. May want to merge together, or rebase one PR on the other PR.
print(Vector[uint8, 7]())
print(Vector[uint8, 7](uint8(i) for i in range(7)))
print(List[uint8, 128](uint8(1), uint8(2), uint8(3)))
BigVector = Vector[uint8, 64]
foo = BigVector()
foo[3] = uint8(123)
print(foo)
class Foobar(Container):
a: uint8
b: uint32
x = Foobar()
print(x)
y = Bytes[123](b"foobar")
print(y)
print(BytesN[3](b"yay"))
print(BytesN[8](i ^ 0xa0 for i in range(8))) out:
Also:
|
test output for new merkleization: def hash(v):
return f"h({v})"
zerohashes = [f"Z({i})" for i in range(0, 32)]
... merkleization
for i in range(20):
print(merkleize_chunks([f"{v}" for v in range(i)], 32))
|
@vbuterin Can I get a final review before updating the usages of these ssz types everywhere? (and fixing whatever small bugs I can find along the way) |
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a beast!
Here's some review. need to dig into partials a bit more
Co-Authored-By: Diederik Loerakker <[email protected]>
…th padding support
Co-Authored-By: vbuterin <[email protected]>
Co-Authored-By: vbuterin <[email protected]>
Ok, PR mostly ready, summary of last TODOs:
|
Verified that:
And we've tests for the new merkleization now, see |
Also, this PR introduces 230+59+119=408 lines of ssz/merkleization test-code, and includes a bunch of fixes + updated tests for finalization (thanks @djrtwo). I'm happy we are actually reducing lines in the spec util code, while improving in style and tests 🎉 |
test_libs/pyspec/eth2spec/test/phase_0/block_processing/test_process_deposit.py
Show resolved
Hide resolved
Co-Authored-By: Hsiao-Wei Wang <[email protected]>
SSZ
List
type must specify a max length. This greatly simplifies generalized indices.