Emurgo / cardano-serialization-lib

This is a library, written in Rust, for serialization & deserialization of data structures used in Cardano's Haskell implementation of Alonzo along with useful utility functions.
Other
231 stars 125 forks source link

RangeError: Maximum call stack size exceeded #585

Closed bakon11 closed 1 year ago

bakon11 commented 1 year ago

Whenever I use the ASMJS version of the CSL, since version 11.2.x. After I create a single transaction successfully. The second time around I get the error "RangeError: Maximum call stack size exceeded". However once I refresh the browser it works again for a single transaction creation?

I am using this with Newest version of React18, Create React App 5 and Webpack5 if this matters.

Again prior to version 11.2.x I did not have this problem, I could create TX's to my heart's content without having to refresh the website.

Please let me know if you need anymore information.

Thanks, Mike

lisicky commented 1 year ago

Hi @bakon11 ! Could you provide code example to reproduce the error ? It would be better if the example will be with package.json file

bakon11 commented 1 year ago

Yes of course.

I included my package.json and my TX building JS file.

The TX just creates a simple pool delegation transaction.

Thank you, Mike

code.zip

bakon11 commented 1 year ago

Hmm ok so I was able to get past that error now I am getting:

Failed to execute 'decode' on 'TextDecoder': The encoded data was not valid.

Here is console output:

delegate tx error TypeError: Failed to execute 'decode' on 'TextDecoder': The encoded data was not valid.
    at getStringFromWasm0 (cardano_serialization_lib_bg.js:39:1)
    at __wbindgen_string_new (cardano_serialization_lib_bg.js:26881:1)
    at $1282 (cardano_serialization_lib.asm.js:367485:1)
    at Module.$3019 (cardano_serialization_lib.asm.js:480271:1)
    at Address.from_hex (cardano_serialization_lib_bg.js:995:1)
    at createDelegateTxWebWallet (txbuilderCSL.jsx:25:1)
    at async delegateTX (DeleagtePopup.jsx:33:1)
    at async startDelegation (DeleagtePopup.jsx:53:1)

THANKS!!!

lisicky commented 1 year ago

@bakon11 How did you manage the first error ? For TextDecoder error look this issue https://github.com/Emurgo/cardano-serialization-lib/issues/150

bakon11 commented 1 year ago

My running npm install -force instead of npm install --legacy-peer-deps

As for the second one For TextDecoder error look this issue https://github.com/Emurgo/cardano-serialization-lib/issues/150

I would agree with this, except I still have the same symptoms as described in the original post except this time it's this error and not the call stack size. Where first time calling the genTX function works fine but anything after that I need to refresh browser.

Honestly though, I'm starting to think that maybe I should probably just get WASM loaded properly in my react project like some of the other threads suggest??

Thanks, Mike

lisicky commented 1 year ago

@bakon11 Error with TextDecoder usually related to a webpack config if webpack version is >= 5, it doesn't matter which version of CSL you use browser or asmjs. And I recommend to read the link that I gave above. Also if you don't have limitation to use only asmjs version, you can use browser version. This messages https://github.com/Emurgo/cardano-serialization-lib/issues/575#issuecomment-1396202135 and https://github.com/Emurgo/cardano-serialization-lib/issues/586#issuecomment-1411990040 can help you to troubleshoot problems during cardano-serialization-lib-browser integration.

bakon11 commented 1 year ago

No constraints yet, I will start by getting webpack configured properly first and then see about loading up the browser one.

Don't want to drag down two issues at once hehe.

Thank you.

bakon11 commented 1 year ago

Found answer in #586