ecadlabs / taquito

A library for building dApps on the Tezos Blockchain - JavaScript / TypeScript
https://taquito.io
Apache License 2.0
298 stars 116 forks source link

Wallet not opening, "_proto" is read-only #1705

Closed Riyenz closed 1 year ago

Riyenz commented 2 years ago

Description A clear and concise description of what the bug is.

Steps To Reproduce Steps to reproduce the behavior:

  1. Connect Wallet on Ithacanet
  2. Run the code below.
    Tezos.wallet
    .batch([
    {
      kind: 'transaction',
      to: 'KT1CZMHskePxx8xgDwNfvfdAdDCUoE9jMzbA',
      amount: 0,
      mutez: false,
      parameter: {
        entrypoint: 'approve',
        value: {
          prim: 'Pair',
          args: [
            { string: 'KT193W4yQZXLwLfW6wzvgVdUYncnC5imvWUq' },
            { int: '0' },
          ],
        },
      },
    },
    {
      kind: 'transaction',
      to: 'KT1CZMHskePxx8xgDwNfvfdAdDCUoE9jMzbA',
      amount: 0,
      mutez: false,
      parameter: {
        entrypoint: 'approve',
        value: {
          prim: 'Pair',
          args: [
            { string: 'KT193W4yQZXLwLfW6wzvgVdUYncnC5imvWUq' },
            { int: '110' },
          ],
        },
      },
    },
    {
      kind: 'transaction',
      to: 'KT193W4yQZXLwLfW6wzvgVdUYncnC5imvWUq',
      amount: 0,
      mutez: false,
      parameter: {
        entrypoint: 'deploy_FA1_vesting',
        value: {
          prim: 'Pair',
          args: [
            {
              prim: 'Pair',
              args: [
                { string: 'tz1fxojJcp9viALhishZ34pkmnHgEwiies3p' },
                {
                  prim: 'Pair',
                  args: [
                    [
                      {
                        prim: 'Elt',
                        args: [
                          { string: 'tz1fxojJcp9viALhishZ34pkmnHgEwiies3p' },
                          { int: '100' },
                        ],
                      },
                    ],
                    { int: '3589' },
                  ],
                },
              ],
            },
            {
              prim: 'Pair',
              args: [
                { int: '31536000' },
                {
                  prim: 'Pair',
                  args: [
                    { prim: 'True' },
                    { string: 'KT1CZMHskePxx8xgDwNfvfdAdDCUoE9jMzbA' },
                  ],
                },
              ],
            },
          ],
        },
      },
    },
    ])
    .send();

Expected behavior Expected Behavior is to open a wallet to confirm the transaction.

Screenshots

image

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context N/A

claudebarde commented 2 years ago

The error in the first screenshot seems to suggest that you are trying to forge the transaction with an account that hasn't been revealed yet. If you give me the address, I can check it for you and reveal it if necessary so you can use it :)

Riyenz commented 2 years ago

HI @claudebarde,

here's the contract address KT193W4yQZXLwLfW6wzvgVdUYncnC5imvWUq then I'm using this address KT1CZMHskePxx8xgDwNfvfdAdDCUoE9jMzbA as fake token when calling deploy_FA1_vesting in vested_token_address.

Thank you for your assistance, I appreciate it a lot.

claudebarde commented 2 years ago

I am sorry, I meant the address of the implicit account you are using to sign the transaction. I got it from your screenshot (tzlfV0angAfb9J1hRRMP2bSB6LvASD6KpY8A) and it says it wasn't revealed in the explorer, so it cannot work. https://ithacanet.tzkt.io/tzlfV0angAfb9J1hRRMP2bSB6LvASD6KpY8A/operations/

claudebarde commented 2 years ago

You will have to reveal the address first before you can use it, for example, by sending a small amount of XTZ. Let me know if you need assistance with that.

Riyenz commented 2 years ago

I tried again with a revealed address (https://ithacanet.tzkt.io/tz1gncPPFVkzaWVAoe57RRVZ3np3db1qdXoQ/info), but still getting the same error. So we can discard this hypothesis. Any idea on what that error might be due to ? It’s really blocking. I’m using next.js btw

claudebarde commented 2 years ago

I hardly believe you still get an empty_implicit_account with a revealed and funded account. You must be signing the transaction with another account that is not revealed, for example, the one I mentioned in my previous comment and that is included in the error message itself (and still not revealed).

tbinetruy commented 2 years ago

Hi!

I'm confirming the empty_implicit_account error is now indeed gone! However, that _proto is readonly error remains. It's really weird as it only happens when running against the testnet. Any idea what's going on ? What in your code could make this attribute readonly ? That sounds very weird as it's cleary being mutated here: https://github.com/ecadlabs/taquito/blob/080483a8189ba0c2c8a7cebf018e2b68e7edb56a/packages/taquito/src/forger/taquito-local-forger.ts#L17.

Do you think it could somehow be due to next.js?

What's even weirder, is that when running a next.js production build against the testnet, it does work with the same code, using the same implicit address and querying the same smart contract addresses as when running against the dev server. Except the dev server throws that _proto error and not the production server. It's honestly some of the darkest voodoo I've ever seen.

Thanks for your help.

claudebarde commented 2 years ago

I don't think it is mutated but instantiated instead. As you can see in this file, the _proto property is private, which means that TypeScript will prevent you from overwriting it. Are you trying to modify it?

tbinetruy commented 2 years ago

Hi, sorry for the late reply.

I'm not at all trying to modify it. Somewhere in your library code is the variable trying to get mutated. But not by us. Again, it works fine against the mainnet somehow. We're just switching networks. And again, the same code works when build in prod mode using next.js, but not in dev mode.

So I assume you've never encountered or heard of anything similar behavior ?

dsawali commented 1 year ago

Hey team! Please add your planning poker estimate with Zenhub @hui-an-yang @roxaneletourneau @zainen

hui-an-yang commented 1 year ago

Hi @Riyenz & @tbinetruy

Thanks for reaching out. We are looking into the issue you encountered, tried recreating the bug doesn't seem possible from my end at the moment. Would be helpful to know what's next.js & taquito version you use. Also the ticket is opened in June would like to know if it's still the case now? Hope to help to sort this out soon :)

Innkst commented 1 year ago

Can't reproduce