Skip to content

UInt64.fromUInt does not throw in case of negative values #36

@evias

Description

@evias
  1. Expected behavior and actual behavior.

When using the UInt64.fromUInt method, there is no error handling done when negative values are used to create the instance. As a result, because it does not produce an error, requests to the API are sent with 4294867296 amounts when you initialize them with UInt64.fromUint(-1).

The expected behaviour would be to throw an Error in case of malformed Unsigned Integer amounts as this would avoid such collaterals.

  1. Steps to reproduce the problem.

This example is not from me, but will reproduce the problem at hand:

MosaicSupplyChangeTransaction.create(
    Deadline.create(),
    mosaicID,
    MosaicSupplyType.Decrease,
    UInt64.fromUint(-1),
    NetworkType.MIJIN_TEST);
  1. Specifications like the version of the project, operating system, or hardware.

nem2-sdk@0.10.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions