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

Add unit tests for compute_fork_digest and compute_subnet_for_attestation #1896

Merged
merged 2 commits into from
Jun 17, 2020
Merged

Add unit tests for compute_fork_digest and compute_subnet_for_attestation #1896

merged 2 commits into from
Jun 17, 2020

Conversation

lsankar4033
Copy link
Contributor

Fixes #1865

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 👍

Comment on lines +322 to +324
expected_fork_data_root = spec.hash_tree_root(
spec.ForkData(current_version=state.fork.current_version,
genesis_validators_root=state.genesis_validators_root))
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpicking tip: can just use

Suggested change
expected_fork_data_root = spec.hash_tree_root(
spec.ForkData(current_version=state.fork.current_version,
genesis_validators_root=state.genesis_validators_root))
expected_fork_data_root = spec.compute_fork_data_root(
current_version=state.fork.current_version,
genesis_validators_root=state.genesis_validators_root,
)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah true! I wanted to cover testing compute_fork_data_root here too b/c I didn't see a test for that, but I suppose it's a better practice to just test 1-level down.

@hwwhww
Copy link
Contributor

hwwhww commented Jun 17, 2020

Thank you for your contribution! 🎉

@hwwhww hwwhww merged commit 7117d2e into ethereum:dev Jun 17, 2020
@lsankar4033 lsankar4033 deleted the helper_tests branch June 18, 2020 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add tests for compute_fork_digest and compute_subnet_for_attestation
2 participants