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

Update ethereum-types to 0.5 #278

Merged
merged 1 commit into from Mar 6, 2019
Merged

Conversation

michaelsproul
Copy link
Member

Issue Addressed

Update to ethereum-types 0.5.0 #216

Proposed Changes

  • Update ethereum-types to 0.5(.2)
  • Use from_slice to convert byte slices to Hash256, as Hash256::from for slices has been removed
  • Add explicit as_bytes conversions for Hash256 to &[u8]. Previously not required due to a now-removed Deref impl
  • Use int_to_bytes32 in generate_seed to avoid confusion (spec)
  • Replace the arbitrary strings used for the epoch seeds in teleport_to_end_of_epoch with arbitrary byte arrays
  • Add a Hash256::from_short_slice mixin to ease compatibility with existing tests that use slices of length less than 32

Additional Info

I'd like feedback on the last two points in particular, which feel a little bit suspect – particularly from_short_slice. We could do away with that extra complexity by using arbitrary byte arrays in the tests instead of strings like "some hash".

@michaelsproul michaelsproul force-pushed the eth-types-0.5 branch 2 times, most recently from d1d7cac to 4a8eb58 Compare March 5, 2019 06:47
@paulhauner
Copy link
Member

Looks great, thanks!

WRT the last two points:

  • Replacing the teleport_to_end_of_epoch with other arbitrary bytes is fine. They're truly arbitrary at this stage.
  • I don't have a string opinion about from_short_slice. My intuition is to replace the "some_hash" with vec![42; 32] or something similar. Hash256::random(..) could also work -- although potentially harder to troubleshoot in an assertion-failed error message.

Happy to go with whatever you prefer for from_short_slice(..).

@michaelsproul
Copy link
Member Author

from_short_slice is a hack to remedy a hack, I'll remove it and replace the strings by byte arrays :)

@paulhauner
Copy link
Member

LGTM!

@paulhauner paulhauner merged commit 8cb9594 into sigp:master Mar 6, 2019
@michaelsproul michaelsproul deleted the eth-types-0.5 branch March 6, 2019 23:04
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.

None yet

2 participants