Eth2.0-specs: Is justification_bitfield an integer or a `bytes` type?

Created on 28 Dec 2018  路  3Comments  路  Source: ethereum/eth2.0-specs

justification_bitfield is specified uint64 in the spec.

Would it make more sense to specify it as bytes type? Since the bitfield keyword indicates a byte type and it involves many bitwise operations as well.

enhancement

Most helpful comment

In python it's easier to do bit operations on integers than bytes :smile:

If we go bytes, then to keep the spec being correctly executable python, we would need to make helpers for bitwise_or, bitwise_and and shift.

All 3 comments

In python it's easier to do bit operations on integers than bytes :smile:

If we go bytes, then to keep the spec being correctly executable python, we would need to make helpers for bitwise_or, bitwise_and and shift.

Would it make sense to define justification_bitfield in bytes but specify the Python calculation by converting to an integer first? This has two benefits:

  • The bitfield is literally bytes
  • The calculation in Python is more explicitly specified in integer.

A discussion shows the feel to keep it as is (integer) is stronger.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hwwhww picture hwwhww  路  3Comments

ralexstokes picture ralexstokes  路  3Comments

michaelsproul picture michaelsproul  路  3Comments

dangerousfood picture dangerousfood  路  5Comments

decanus picture decanus  路  5Comments