Skip to content

Commit

Permalink
Revert get_domain calculation order change after clarification. (Cons…
Browse files Browse the repository at this point in the history
  • Loading branch information
schroedingerscode authored and cemozerr committed May 6, 2019
1 parent fa3ebf5 commit eeb3d5d
Showing 1 changed file with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1061,12 +1061,8 @@ public static UnsignedLong max(UnsignedLong value1, UnsignedLong value2) {
* - Spec v0.4</a>
*/
public static UnsignedLong get_domain(Fork fork, UnsignedLong epoch, int domain_type) {
// TODO Investigate this further:
// We deviate from the spec, adding domain_type first then concatting fork version on to it.
// The spec does this in the opposite order. It smells a lot like an endianness problem.
// The question is, it is Java/us, or is it a spec bug.
return UnsignedLong.valueOf(
bytes_to_int(Bytes.wrap(int_to_bytes(domain_type, 4), get_fork_version(fork, epoch))));
bytes_to_int(Bytes.wrap(get_fork_version(fork, epoch), int_to_bytes(domain_type, 4))));
}

/**
Expand Down

0 comments on commit eeb3d5d

Please sign in to comment.