platform icon indicating copy to clipboard operation
platform copied to clipboard

Error: Assertion failed after funding a new wallet

Open HunterSides opened this issue 3 years ago • 21 comments

Issue Description

Receiving Error: Assertion when attempting to initialize Platform connection after funding a new wallet.

Mnemonic (non production)

{"mnemonic":"need grab endorse wine around fuel lawn flame tide section original boss"}

Expected Behavior

After funding a new wallet with tDash a user should be able to initialize and connect to platform.

Current Behavior

Throws Error: Assertion failed image

Steps to Reproduce (for bugs)

using this repo https://github.com/HunterSides/DDR-React

clone & npm install & npm start open localhost:3000 open console & fund wallet address given reload page after funding wallet

Process Point Failure

Platform connection initialization after funding given wallet address with tDash.

Your Environment

@dash-incubator/dapp-sdk": "*" Chrome & Firefox latest Windows 10 64 bit Link to your project:

HunterSides avatar Apr 05 '22 00:04 HunterSides

What is the version of dash SDK is used? Can you also provide a link to the repo with @dash-incubator/dapp-sdk

markin-io avatar Apr 22 '22 07:04 markin-io

@markin-io

Version 0.14.2 - https://github.com/dash-incubator/dapp-sdk Required as a dependency in package.json - https://github.com/HunterSides/DDR-React/blob/main/package.json Used here - https://github.com/HunterSides/DDR-React/blob/main/src/views/UploadPage.js

However I just rechecked and I'm now getting this error instead. It happens before I'm given an address to be funded. (I believe this specific issue has already been reported by @ICJR)
image

HunterSides avatar Apr 28 '22 23:04 HunterSides

@HunterSides thank you. dash-incubator/dapp-sdk needs to update Dash SDK to v3.22.3. From what I see, currently, the project is on 3.21.7

Perhaps the issue itself is better transferred to https://github.com/dash-incubator/dapp-sdk as well?
This is a side project from Dash Incubator, and we don't have an access to it.

markin-io avatar Apr 29 '22 07:04 markin-io

@HunterSides - am I right in saying "it looks like ICJR needs to update the dapp sdk - Dash SDK package to v3.22.3 from v3.21.7"?

SamKirby22 avatar May 06 '22 07:05 SamKirby22

ICJR - any update here?

SamKirby22 avatar May 06 '22 07:05 SamKirby22

@SamKirby22 Updated dash dependency to use the latest version. I am now seeing RuntimeError: abort(both async and sync fetching of the wasm failed). Build with -s ASSERTIONS=1 for more info. after I fund a new testnet wallet with tDash.

ICJR avatar May 06 '22 07:05 ICJR

@ICJR @HunterSides thank you for the provided details and updates, we added this to our backlog

markin-io avatar May 13 '22 08:05 markin-io

@ICJR @HunterSides I launched the DDR-React project. Thank you for driving the Dash React App initiative - frontend Dash efforts are crucial for project development.

I reproduced the issue and I think that the underlying problem is that currently, dash SDK requires an extra webpack configuration that provides Node.JS polyfills for browsers. We are currently working out a solution for proper bundling for the web without the additional configuration to improve the developer experience.

Having in mind that you are working with the CRA, you can not alter your webpack config without the eject (which is not desirable).

Here's what I suggest to do as a workaround for now:

  • In @dash-incubator/dapp-sdk project:
    • Configure webpack.typescript.config.js to provide all required polyfills. This comment will help.
    • Add "browser": "./dist/dapp.js" to the package.json (This would make web-apps using dapp-sdk look for dapp.js bundle instead of the typescript build)
    • Build and publish to NPM
  • Update @dash-incubator/dapp-sdk in DDR-React to a newer version and try running app again.

markin-io avatar May 20 '22 09:05 markin-io

@markin-io dapp-sdk is already providing the node polyfills during bundling https://github.com/dash-incubator/dapp-sdk/blob/main/webpack.typescript.config.js#L45 using node-polyfill-webpack-plugin

ICJR avatar May 20 '22 21:05 ICJR

@ICJR thank you. We're currently in progress with a proper SDK bundle for the web.

markin-io avatar May 27 '22 07:05 markin-io

@ICJR please update dash to v0.22.12 and retest, you could also try getting rid of Node node polyfills if they were only used for dash

markin-io avatar Jun 10 '22 07:06 markin-io

This one is for Hunter to check but would be good for ICJR to take a look too - as impacting both bounties.

SamKirby22 avatar Jun 10 '22 08:06 SamKirby22

Aha, all right. @HunterSides @ICJR please also check out a new section in the documentation about using primitives https://github.com/dashevo/platform/tree/master/packages/js-dash-sdk#primitives-and-essentials

If you need more PlatformProtocol essentials exposed, please let us know. For the first iteration we only did ones that used by our internal platform test suite.

markin-io avatar Jun 10 '22 10:06 markin-io

@markin-io error

Still receiving the errors above. I removed the node polyfill plugin provider, and updated dash npm to the latest version. Have you guys tested on another web app using just the dash npm package and a normal testnet platform connection?

Asking so I can just tear everything apart on my end to find the issue.

ICJR avatar Jun 10 '22 17:06 ICJR

@ICJR yes, there it is dash-react-starter-app.zip

markin-io avatar Jun 10 '22 17:06 markin-io

@markin-io

Tried a few things still no luck

Received More than one instance of dashcore-lib found. Please make sure that you are not mixing instances of classes of the different versions of dashcore. used npm dedupe warning won't go away.

Also noticed the following endpoints /org.dash.platform.dapi.v0.Core/getStatus /org.dash.platform.dapi.v0.Core/subscribeToTransactionsWithProofs

Constantly take 60186ms to respond throwing a 503/504 error.

ICJR avatar Jun 10 '22 20:06 ICJR

@ICJR dashcore-lib duplicate shouldn't cause this kind of an error. As of getStatus - yes it is quite slow, it's sitting in our optimizations list. subscribeToTransactionsWithProofs is a stream, and it is expected to disconnect after a minute due to a nginx configuration of the masternode. (It reconnects afterwards)

From what I see this is some wasm issue (SDK internally uses wasm code), and probably related to a second layer of bundling in dapp-sdk. So far we tested only dash -> Frontend app use case, but dash -> second-tier-wrapper -> Frondend app isn't covered yet.

We would appreciate any additional information and debugging of the case with the second tier wrappers for dash library. Will add it to our backlog.

markin-io avatar Jun 17 '22 07:06 markin-io

For now to unblock your endeavor I might suggest using dash directly in DDR React.

If using dapp-sdk is a must-have for you, there are two options that could possibly solve the problem:

  • Use dapp-sdk as a git submodule and directly refer to its src from the DDR-React project (instead of installing dapp-sdk via npm).
  • Instead of a webpack bundle, do just TypeScript (tsc) build for dapp-sdk

Both cases will avoid producing a wrapping bundle around the dash

markin-io avatar Jun 17 '22 09:06 markin-io

@markin-io error

Still receiving the errors above. I removed the node polyfill plugin provider, and updated dash npm to the latest version. Have you guys tested on another web app using just the dash npm package and a normal testnet platform connection?

Just reiterating ICJR here, I also still receive the errors after updating.

HunterSides avatar Jun 22 '22 14:06 HunterSides

@HunterSides thanks. Please try out one of the steps https://github.com/dashevo/platform/issues/328#issuecomment-1158683430

markin-io avatar Jun 24 '22 07:06 markin-io

@markin-io @ICJR Attempting to use dapp-sdk as a git submodule gives me image

HunterSides avatar Jun 27 '22 17:06 HunterSides