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

Fix unmarshal bugs #409

Merged
merged 6 commits into from
Jul 5, 2024
Merged

Fix unmarshal bugs #409

merged 6 commits into from
Jul 5, 2024

Commits on Jun 28, 2024

  1. [evm precompiles] do *not* ignore unmarshal return value

    Because `unmarshal` is marked as `discardable` we silently ignored the
    return value of `unmarshal`, which in some test cases indicated that
    the source value does not fit into target bigint
    Vindaar committed Jun 28, 2024
    Configuration menu
    Copy the full SHA
    09755bd View commit details
    Browse the repository at this point in the history
  2. [io_limbs] handle unmarshal for sources longer, but smaller

    If a given source `src` is given to `unmarshal` where the most
    significant bytes are all zero beyond the size that fits into the
    destination BigInt, we still return a successful parse. Previously we
    would just return false whenever we found more bytes than can possibly
    fit (this leads to issues with e.g. EVM precompiles tests, which come
    as strings that are longer).
    
    Note: We can probably do the all zero check in a better
    way (i.e. using the fact that endianness does not matter and just
    compare all relevant bytes, but not sure about the most elegant way to
    do that, taking the dynamic sizes into account)
    Vindaar committed Jun 28, 2024
    Configuration menu
    Copy the full SHA
    abddc2b View commit details
    Browse the repository at this point in the history

Commits on Jul 3, 2024

  1. Configuration menu
    Copy the full SHA
    a1ae4fe View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    91b2fbb View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    5d085d2 View commit details
    Browse the repository at this point in the history
  4. [evm precompiles] split parsing of field coords by curve

    For BLS12-381 we now parse according to the spec
    https://eips.ethereum.org/EIPS/eip-2537#fine-points-and-encoding-of-base-elements
    making sure to check the 'upper' 16 bytes to be empty. If they are not
    we return IntLargerThanModulus.
    Vindaar committed Jul 3, 2024
    Configuration menu
    Copy the full SHA
    51d64b5 View commit details
    Browse the repository at this point in the history