ethers.js icon indicating copy to clipboard operation
ethers.js copied to clipboard

Throws "missing r" after successfull transaction

Open zapaz opened this issue 3 years ago • 30 comments

Ethers Version

6.2

Search Terms

rabby transactionResponse

Describe the Problem

Browser throws after a successfull transaction: error "missing r" (in transaction response ?) happens with Rabby, not on Metamask (neither node)

Potentially Rabby bug, but ethers should not throw ?! (transaction did not failed)

matic tx

Capture d’écran 2023-03-23 à 22 07 34

Code Snippet

No response

Contract ABI

No response

Errors

No response

Environment

No response

Environment (Other)

No response

zapaz avatar Mar 23 '23 21:03 zapaz

I'm not sure what Rabby is? A Wallet plugin? Can you see what the response included to its getTransaction (which is where I'm assuming the issue is)?

ricmoo avatar Mar 23 '23 21:03 ricmoo

Yes Rabby https://rabby.io/ is a (very good) wallet extension

I will add transaction trace (if not throws before) and put here back

zapaz avatar Mar 24 '23 09:03 zapaz

no way to get transaction response at the end of the call, as it throws before and is not catched (even inside try/catch)

when retrieving transaction later, of course 'r' is there, as transaction succeeded

zapaz avatar Mar 24 '23 11:03 zapaz

seems a real time problem

when debugging and putting a breakpoint here in provider-jsonrpc.ts => const tx = await this.provider.getTransaction(hash); it works, and tx is as expected

without breakpoint it throws, tx miss r

zapaz avatar Mar 24 '23 13:03 zapaz

with console.log(value) trace inside formatTransactionResponse got :

with breakpoint =>

{
  "blockHash": "0xe2d603153f7bf5cbe9fd8e6cbb14f0a3745e786d4a543553bf44fab734de359d",
  "blockNumber": "0x26d51ae",
  "from": "0xXXXXXXXXXXXXXXXXXXXXX",
  "gas": "0x25948",
  "gasPrice": "0x320effa600",
  "hash": "0xed8e884b8e103d93d784f4264db69b1c287379d01c2a3f1964d02dad4d388b17",
  "input": "0xeb685c470000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000008e1bc9bf040008",
  "nonce": "0x4b0",
  "to": "0x4f1ac217a0d3515e0fd174b2a65ea431af30d212",
  "transactionIndex": "0xd",
  "value": "0x0",
  "type": "0x0",
  "v": "0x135",
  "r": "0x78fe01c0517c97e3e1e9fc2e2ddb5f12203e5e83777a1a16d92085e5b0c154bb",
  "s": "0x72f91006c8f78c0ca4ceaef62bcaa1a42d62e0642f21f1d67324636df372b74"
}

without breakpoint =>

{
  "to": "0x4f1ac217a0d3515e0fd174b2a65ea431af30d212",
  "gas": "0x25948",
  "from": "0xXXXXXXXXXXXXXXXXXXXXX",
  "hash": "0x4503e00fb3ad20fe05fc283f7e0142cfb1990edc8b0e1a46998442e02aa3ffe2",
  "nonce": "0x4ae",
  "input": "0xeb685c470000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000008e1bc9bf040006",
  "value": "0x0",
  "blockHash": null,
  "blockNumber": null,
  "transactionIndex": null,
  "gasPrice": "0x367b7ca400",
  "type": "0x0"
}

seems Wallet creates the response in 2 phases, second one with signature

zapaz avatar Mar 24 '23 16:03 zapaz

I confirm having the exact same issue with Rabby and Ethers v6.3.0.

image

feloot avatar Apr 22 '23 15:04 feloot

should be fixed in https://github.com/RabbyHub/Rabby/pull/1339 Rabby didn't return r s v for pending transactions cause this issue

vvvvvv1vvvvvv avatar Apr 27 '23 07:04 vvvvvv1vvvvvv

fixed in the latest version(v0.81.0)

vvvvvv1vvvvvv avatar Apr 28 '23 04:04 vvvvvv1vvvvvv

Hi.

I have the same issue. With ethers v6.9.0 and web3modal v3.4.0

Screenshot from 2023-12-16 01-05-42

any workaround?

llopez avatar Dec 16 '23 04:12 llopez

I’m fixing #4512 right now which will make this at least catchable. It’s weird that neither v or ChainId is present. I’ll reach out to Web3Modal to figure it out.

Thanks! :)

ricmoo avatar Dec 16 '23 04:12 ricmoo

Thanks @ricmoo. I am confused. I dont know what is going on.

If is is happening everywhere I suppose the issue is in ethers. I just started using v6.

I never had this problem in v5

llopez avatar Dec 16 '23 04:12 llopez

It should affect v5 the same way. Both are pretty aggressive about not accepting bad data from a backend. I’d rather fail and throw than let corrupt data get passed along…

ricmoo avatar Dec 16 '23 04:12 ricmoo

@ricmoo

I am using your branch and I am getting the same error :)

Screenshot from 2023-12-16 01-48-05

llopez avatar Dec 16 '23 04:12 llopez

I’m still working on it locally. It isn’t pushed yet.

But it won’t fix the issue, just make it catchable.

Still waiting on Web3Modal. They may be sleeping, I don’t know their time zone. :)

ricmoo avatar Dec 16 '23 04:12 ricmoo

I mean. it is still happening and it is not catchable

try {
    const tx = await contract.deploy(tokenBptAddr, name, symbol, maxLockTime, rewardDistributorStartTime, admin, admin)
    console.log('tx submitted', tx)
    const receipt = await tx.wait();
    console.log('tx success', receipt);
  } catch (error) {
    console.log('error', error);
  }

the above code is not catching the error @ricmoo

llopez avatar Dec 16 '23 04:12 llopez

I’m still working on the fix! It’s local. On my computer. You can’t check out my branch, it only exists on my computer. :p

I’m adding test cases now before I push it.

ricmoo avatar Dec 16 '23 05:12 ricmoo

I am sorry. I thought this -> https://github.com/acdibble/ethers.js/tree/fix/catch-rejection was the code to make the error catchable :)

llopez avatar Dec 16 '23 05:12 llopez

I have same errors. When do you finish to fix it? error

ghost avatar Dec 16 '23 09:12 ghost

I'm still working on it. I will have a fix as soon as possible. I've been working on it for the last few hours and will likely have to sleep soon.

The root cause is that the upstream provider is not returning all the necessary fields. Are you also using WalletConnet? Did you recently upgrade to a new version?

ricmoo avatar Dec 16 '23 09:12 ricmoo

Yeah, i have upgraded. But i cant get blocknumber and block hash etc. So in front end, users get errors but tx is still run.

ghost avatar Dec 16 '23 09:12 ghost