Skip to content

QN returns some JOY amount as json number #4503

@thesan

Description

@thesan

So this comes from the QN returning the update amount as a number. The problem is that the amount is 50000000000000000 which is (one digit) greater than Number.MAX_SAFE_INTEGER as a result the bn.js throws an error.

Try this on https://atlas-next.joystream.org/query-node/server/graphql:

query {
  proposals (where: { details_json: { isTypeOf_eq: "UpdateWorkingGroupBudgetProposalDetails" } }) {
    details {
      ...on UpdateWorkingGroupBudgetProposalDetails { amount }
    }
  }
}

It's potentially a wide spread issue because although Pioneer expects strings since this change all the Float values from @/common/api/schemas/schema.graphql are returned from the QN as number. For stuff like block numbers it's fine (although Int would be more appropriate) but for JOY amount this often might trigger exceptions in bn.js. This is actually the bug that @traumschule reported here: Joystream/pioneer#2327 (comment).

A quick fix here would be to just cast the amount to a string and then to a BN. However it also means a small precision loss.

I don't think this can be fixed long term on the client. @zeeshanakram3, @Lezek123 can you think of an easy fix on the QN for this ?

Originally posted by @thesan in Joystream/pioneer#3994 (comment)

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions