kaspanet/rusty-kaspa

error: recursive use of an object detected which would lead to unsafe aliasing in rust

Closed this issue · 4 comments

When a transaction is submitted I got this error from WASM (happened in testnet-11 and testnet-10)

8-Aug-2024 12:00:10 DEBUG TrxManager: Payment with ransaction ID: 65d49fe897930ab5e071ee55cfa9ff9e670caa95e541876303b8533643bc7b40 to be submitted
13532 |     getInt32Memory0()[arg0 / 4 + 1] = len1;
13533 |     getInt32Memory0()[arg0 / 4 + 0] = ptr1;
13534 | };
13535 | 
13536 | module.exports.__wbindgen_throw = function(arg0, arg1) {
13537 |     throw new Error(getStringFromWasm0(arg0, arg1));
                  ^
error: recursive use of an object detected which would lead to unsafe aliasing in rust
      at /app/wasm/kaspa/kaspa.js:13537:11
      at <?>.wasm-function[6944]
      at <?>.wasm-function[6946]
      at <?>.wasm-function[4837]
      at /app/wasm/kaspa/kaspa.js:7104:44

To Reproduce
Steps to reproduce the behavior:

  1. Go to kaspool-payment app for details
  2. Check the code at [src/trxs/index.ts](https://github.com/coinchimp/kaspool-payment/blob/main/src/trxs/index.ts)

Expected behavior
finish transaction submission. output and context used at follow

[
  {
    address: "kaspatest:qp3dz6536qjkd7zclj90ujwq9mpdgk3qhgcjtve5ds7yz7cv4fmrq9ejfr3e6",
    amount: 21159155599284n,
  }, {
    address: "kaspatest:qpp0q076vx39xdmm4k2hjfa7d93gvwygjamum74ux90a5zcv9p5rksx8da9zc",
    amount: 2634320625109n,
  }
]
8-Aug-2024 12:00:00 LOG TrxManager: Processing balance 26,343.20625109 TKAS for address kaspatest:qpp0q076vx39xdmm4k2hjfa7d93gvwygjamum74ux90a5zcv9p5rksx8da9zc
8-Aug-2024 12:00:00 DEBUG TrxManager: Context to be used: {"isActive":true,"matureLength":3250,"balance":{"__wbg_ptr":3909584},"balanceStrings":{"__wbg_ptr":3950288}}

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context
This is a small app for mining pool rewards using bun canary Bun v1.1.22-canary
KaffinPX is well aware of this issue

I am aware of this issue. last week it has exhibited itself in a different way which lead me to a theory of the potential cause, so i will be trying to address it this weekend.

Unfortunately multiple repeat requests to KaffinPX to provide any type of a project that can replicate this have resulted in no feedback, so unfortunately I will be doing an update blindly and will let you know when it has been done so that you can test it.

Thanks, It won't be hard to reproduce it, just let me know when you have the WASM nodejs available to download please. Thanks again.

This has been fixed in aspectron#90

I will do more research and attempt to come up with a solution to prevent this from happening in the future.

Thanks for the fix, it's working very well so far.