Skip to content
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

Fix tree hash padding #35

Merged
merged 1 commit into from
Feb 5, 2019
Merged

Conversation

jannikluhn
Copy link
Contributor

What was wrong?

ethereum/consensus-specs#538

How was it fixed?

ethereum/consensus-specs#538

Cute Animal Picture

put a cute animal picture link inside the parentheses

Copy link
Contributor

@hwwhww hwwhww left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

chunks = tuple(
chunk.ljust(SSZ_CHUNK_SIZE, b"\x00")
for chunk in chunks_unpadded
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My instinct tells me it's faster in one for loop:

@to_tuple
def get_chunkz_new(input_items, items_per_chunk):
    for i in range(0, len(input_items), items_per_chunk):
        yield b''.join(input_items[i:i + items_per_chunk]).ljust(SSZ_CHUNK_SIZE, b"\x00")

(Although maybe not much performance improvement difference.)

@jannikluhn jannikluhn merged commit 2b0fe5c into ethereum:master Feb 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants