Giter Club home page Giter Club logo

Comments (8)

keithchew avatar keithchew commented on June 8, 2024 2

Yup, to confirm the findings above, I modified my local copy to remove deep clone:

    // const transactionMetaWithRsv = _lodash.cloneDeep.call(void 0, transactionMeta);
    const transactionMetaWithRsv = transactionMeta;

With the above RSV is persisted. Let me know if you would like me to prepare a PR, but it should be pretty straightforward.

from metamask-extension.

keithchew avatar keithchew commented on June 8, 2024 1

@dbrans Great work! I have included v29.0.1 into my local metamask-extension (v11.15.5), tested it and I can confirm that the rsv is now back.

from metamask-extension.

keithchew avatar keithchew commented on June 8, 2024

I can confirm the regression was introduced in v11.14.0, last working version was v11.13.3.

from metamask-extension.

keithchew avatar keithchew commented on June 8, 2024

Just digging into this a bit more, it looks like there was a major refactor from v11.13.3 to v11.14.0. At a glance, it doesn't look like the regression was introduced in metamask-extension, but perhaps further upstream.

I can see @metamask/transaction-controller was updated from v23.1.0 to v27.0.1, and there were also quite big changes between these versions. One thing which stood out was:

 private async updateTransactionMetaRSV(
    transactionMeta: TransactionMeta,
    signedTx: TypedTransaction,
  ): Promise<TransactionMeta> {
    const transactionMetaWithRsv = cloneDeep(transactionMeta);
...

The old version did not do a deep clone before setting the RSV, but new version above does. Maybe the TransactionMeta without the RSV is being returned from the API instead of the updated one?

Any guidance on this would be appreciated.

from metamask-extension.

keithchew avatar keithchew commented on June 8, 2024

Ok, I have tracked it down.

In transaction-controller.ts signTransaction(), it does update state transaction with rsv:

    this.updateTransaction(
      transactionMetaWithRsv,
      'TransactionController#approveTransaction - Transaction signed',
    );

However, upon returning to the caller approveTransaction(), it replaces the transaction with an older one without the rsv:

      this.updateTransaction(
        updatedTransactionMeta,
        'TransactionController#approveTransaction - Transaction submitted',
      );

There is a discontinuity between updatedTransactionMeta and transactionMetaWithRsv. In the previous version deep clone was not used, so the properties got shallow copied and persisted.

A few options, we can either not do a deep copy, or make signTransaction() return an updated meta that the caller will merge with updatedTransactionMeta.

from metamask-extension.

keithchew avatar keithchew commented on June 8, 2024

Just following up to see if there is progress on this bug? I am happy to submit the one-liner PR above to revert the regression if this will help speed things up. This change is causing some dapps to break as they are currently using RSV to verify that the txn has been signed after sending.

from metamask-extension.

keithchew avatar keithchew commented on June 8, 2024

Just looking at the metamask-core issues, and it looks like this is fixed here:

MetaMask/core#4255

I will test it once metamask-extension upgrades transaction-controller to the version >= 29.0.1

from metamask-extension.

dbrans avatar dbrans commented on June 8, 2024

@keithchew great catch and good job tracking this down. I'm adding this bug as fixed by #24701. If you have a moment, could you take a look at the builds on that PR to ensure the bug is fixed?

from metamask-extension.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.