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

JS Dash SDK cannot send documents transitions (number type overflow) #2436

Open
pshenmic opened this issue Jan 22, 2025 · 0 comments
Open

JS Dash SDK cannot send documents transitions (number type overflow) #2436

pshenmic opened this issue Jan 22, 2025 · 0 comments
Assignees
Labels
bug Something isn't working js-sdk JS Dash SDK related

Comments

@pshenmic
Copy link
Collaborator

Issue

While working on Web Dash DApp, we were able to create an initial implementation, however, during further debugging we came across previously unknown issue that is making unable to create any more documents batch transactions.

It looks like that first 24 (or sometimes even less) documents transactions executes correctly, but then all transactions suddenly starts fails with error:

Error submitting document: Error: Identity Y6WwZ3LYETZjsekjWjoZWnSBu9o5P5MD4Z3HmVGJiYt is trying to set an invalid identity nonce. The current identity nonce is 36028797018963994, we are setting 25, error is nonce already present in past

The issue is that identityNonce and identityContractNonce is not just a number that being incremented, but rather a u64 value. However, js is not able to always correctly handle it:

Image

Which leads to incorrect nonce being included in the further documents batch transactions, making it not possible to interact with that data contract with your identity anymore.

Javascript does have BigInt feature to properly store it without any loss, however it is not widely supported still yet, and protobufjs library did not implement it, and incorrectly casts it to number. There is one other option like protocolbuffers/protobuf#3666 (comment) to represent it as string, but unfortunately it didn't work in our setup. From what I've read the recommendation is to read as string.

Possible Solution

Patch client code, fork gRPC library or change all u64 to string in the schema

Steps to Reproduce (for bugs)

  1. Create documents from one identity to specific data contract until you hit the nonce issue

Context

Your Environment

  • Version used:
  • Environment name and version (e.g. Chrome 39, node.js 5.4):
  • Operating System and version (desktop, server, or mobile):
  • Link to your project:
@pshenmic pshenmic added the bug Something isn't working label Jan 22, 2025
@pshenmic pshenmic self-assigned this Jan 22, 2025
@QuantumExplorer QuantumExplorer added the js-sdk JS Dash SDK related label Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working js-sdk JS Dash SDK related
Projects
None yet
Development

No branches or pull requests

2 participants