Skip to content
This repository has been archived by the owner on Jul 1, 2021. It is now read-only.

Hashablification #1394

Merged
merged 3 commits into from
Dec 18, 2019
Merged

Hashablification #1394

merged 3 commits into from
Dec 18, 2019

Conversation

jannikluhn
Copy link
Contributor

@jannikluhn jannikluhn commented Dec 13, 2019

This is the same as #1283. CI got confused with dependency versions, so the tests were failing. I hope that a new PR makes them forget everything and install everything from scratch.

Edit: Didn't work :(

pip._vendor.pkg_resources.ContextualVersionConflict: (pyrsistent 0.15.6 (/home/circleci/repo/.tox/py36-eth2-core/lib/python3.6/site-packages), Requirement.parse('pyrsistent==0.15.4'), {'ssz'})

So it for some reason has pyrsistent==0.15.6 installed even though py-ssz requires pyrsistent==0.15.4.

Cute Animal Picture

put a cute animal picture link inside the parentheses

@jannikluhn jannikluhn force-pushed the hashable-ssz-tests branch 2 times, most recently from 21dc89a to 4c9231b Compare December 16, 2019 08:32
@jannikluhn jannikluhn force-pushed the hashable-ssz-tests branch 10 times, most recently from 4d78c8e to 84fb90d Compare December 17, 2019 10:43
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.

Great work! 👍
Let's merge this monster asap.

state.balances, index, lambda balance, *_: Gwei(balance + delta)
)
)
return state.transform(("balances", index), lambda balance: Gwei(balance + delta))
Copy link
Contributor

Choose a reason for hiding this comment

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

transfrom looks good!

@@ -473,7 +483,7 @@ def _determine_next_eth1_votes(
state: BeaconState, config: Eth2Config
) -> Tuple[Eth1Data, ...]:
if (state.slot + 1) % config.SLOTS_PER_ETH1_VOTING_PERIOD == 0:
return tuple()
return HashableList.from_iterable((), state.eth1_data_votes.sedes)
Copy link
Contributor

@hwwhww hwwhww Dec 17, 2019

Choose a reason for hiding this comment

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

Just to confirm, is HashableList(TElement) compatible with Tuple[Eth1Data, ...] in typing? I thought HashableList is Sequence[TElement]...?

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, no, that's a mistake. I'm quite surprised that mypy didn't catch this. I'll fix the type hint.

@@ -34,7 +34,7 @@ def test_activate_validator(
assert some_validator.activation_epoch == config.GENESIS_EPOCH
else:
some_validator = create_mock_validator(
pubkeys[: validator_count + 1], config, is_active=is_already_activated
Copy link
Contributor

Choose a reason for hiding this comment

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

nice catch

index: ValidatorIndex = default_validator_index,
selection_proof: BLSSignature = EMPTY_SIGNATURE,
aggregate: Attestation = default_attestation,
) -> None:
super().__init__(
) -> TAggregateAndProof:
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm curious, for mypy, is TypeVar required or we can simply use "AggregateAndProof" instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would make a difference if we subclass AggregateAndProof and don't override the classmethod. Then mypy would think AggregateAndProofSubclass.create would return a AggregateAndProof which wouldn't be correct.

@jannikluhn jannikluhn merged commit 4637079 into ethereum:master Dec 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants