Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throws "missing r" after successfull transaction #3926

Closed
zapaz opened this issue Mar 23, 2023 · 30 comments · Fixed by RabbyHub/Rabby#1339
Closed

Throws "missing r" after successfull transaction #3926

zapaz opened this issue Mar 23, 2023 · 30 comments · Fixed by RabbyHub/Rabby#1339
Assignees
Labels
investigate Under investigation and may be a bug. v6 Issues regarding v6

Comments

@zapaz
Copy link

zapaz commented Mar 23, 2023

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 zapaz added investigate Under investigation and may be a bug. v6 Issues regarding v6 labels Mar 23, 2023
@zapaz zapaz changed the title Add Bug Title Here Throws "missing r" after successful transaction Mar 23, 2023
@zapaz zapaz changed the title Throws "missing r" after successful transaction Throws "missing r" after successfull transaction Mar 23, 2023
@ricmoo
Copy link
Member

ricmoo commented Mar 23, 2023

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)?

@zapaz
Copy link
Author

zapaz commented Mar 24, 2023

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
Copy link
Author

zapaz commented Mar 24, 2023

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
Copy link
Author

zapaz commented Mar 24, 2023

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
Copy link
Author

zapaz commented Mar 24, 2023

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

@feloot
Copy link

feloot commented Apr 22, 2023

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

image

@vvvvvv1vvvvvv
Copy link

should be fixed in RabbyHub/Rabby#1339
Rabby didn't return r s v for pending transactions cause this issue

@vvvvvv1vvvvvv
Copy link

fixed in the latest version(v0.81.0)

@zapaz zapaz closed this as completed Apr 28, 2023
@llopez
Copy link

llopez commented Dec 16, 2023

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?

@ricmoo
Copy link
Member

ricmoo commented Dec 16, 2023

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! :)

@llopez
Copy link

llopez commented Dec 16, 2023

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

@ricmoo
Copy link
Member

ricmoo commented Dec 16, 2023

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…

@llopez
Copy link

llopez commented Dec 16, 2023

@ricmoo

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

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

@ricmoo
Copy link
Member

ricmoo commented Dec 16, 2023

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. :)

@llopez
Copy link

llopez commented Dec 16, 2023

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

@ricmoo
Copy link
Member

ricmoo commented Dec 16, 2023

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.

@llopez
Copy link

llopez commented Dec 16, 2023

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

@toTheMoon0322
Copy link

toTheMoon0322 commented Dec 16, 2023

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

@ricmoo
Copy link
Member

ricmoo commented Dec 16, 2023

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?

@toTheMoon0322
Copy link

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.

@ricmoo
Copy link
Member

ricmoo commented Dec 16, 2023

There are 2 issues:

  1. Ethers is losing the async error in some cases (so it isn't possible to catch)
  2. WalletConnect is returning corrupt data

I can only address 1 myself, which I'm working on. I'm also trying to get ahold of WalletConnect to have them fix 2.

@glitch-txs
Copy link

Hi @llopez @toptrust3 could you specify which wallet you are facing this issue with? And is it an extension wallet or a mobile?

@glitch-txs
Copy link

Also could you provide steps to reproduce it?

@temporaryna
Copy link

same problem with Metamask

Uncaught (in promise) TypeError: missing v

waiting for fix, thanks!

@ricmoo
Copy link
Member

ricmoo commented Dec 16, 2023

Since the current bug is unrelated to this OP (which was a problem with Rabby wallet), I’ve opened a new issue. Can anyone experiencing the “missing v” issue please comment on new #4513 issue I’ve opened?

@ricmoo
Copy link
Member

ricmoo commented Dec 16, 2023

@temporaryna @toptrust3 @llopez (@glitch-txs); see #4513

Thanks. :)

@yarikMyroniuk
Copy link

@ricmoo
Hi, Did you fix this issue?
I have the same bug but about missing r

I'm using "ethers": "^6.7.1",

TypeError: missing r (argument="signature", value={ "blockHash": "0xea2f9049921549a11590a77ae13305f83640783b90da382b2446be23db85aaa6", "blockNumber": "0x1af3974", "chainId": "0x144", "from": "0xef1e151d145c49a2c776cade6443b47d71abe441", "gas": "0x60f97", "gasPrice": "0x75ec5cb6", "hash": "0x53e4a8dbd46b3d3604a19d4b007fe9410e94c75b3c17c0d6f0f50f1ef0bf5855", "input": "0x", "l1BatchNumber": "0x6f853", "l1BatchTxIndex": "0x517", "maxFeePerGas": "0x75ec5cb6", "maxPriorityFeePerGas": "0x0", "nonce": "0x0", "to": "0xef1e151d145c49a2c776cade6443b47d71abe441", "transactionIndex": "0x3", "type": "0xff", "value": "0x55db9421dba88956" }, code=INVALID_ARGUMENT, version=6.11.1)

How can I fix this?

@toTheMoon0322
Copy link

toTheMoon0322 commented Mar 6, 2024 via email

@roflganker
Copy link

Hi guys, I have the same issue.
I'm getting "TypeError: missing r" on retrieving a transaction from zkSync Era (Sepolia testnet).

Steps to reproduce:

  1. Find a bad transaction, example: https://sepolia.explorer.zksync.io/tx/0xb0f83de03d4c206ae09bc2bb96510abada073a5ec059c3a8eca107368194125e
  2. request it by provider.getTransaction(hash), or request a whole block provider.getBlock(hash, / *prefetchTxs= */true)
  3. get an error :)

A real example with ethers v6.10.0

const provider = new JsonRpcProvider('https://sepolia.era.zksync.dev/');
const badHash = '0xb0f83de03d4c206ae09bc2bb96510abada073a5ec059c3a8eca107368194125e';
const transaction = await provider.getTransaction(badHash);  // throws here

// Another example with block fetch
const badBlockNo = 1309556;
const block = await provider.getBlock(badBlockNo, /* prefetchTxs= */ true);  // throws, too

This is really anooying, because I maintain a blockchain indexer, my system fails to process whole block because of a tiny error. I'll post a workaround as soon as I find it..

@roflganker
Copy link

roflganker commented Mar 23, 2024

Transaction response of a bad transaction
{
  "jsonrpc": "2.0",
  "result": {
    "hash": "0xb0f83de03d4c206ae09bc2bb96510abada073a5ec059c3a8eca107368194125e",
    "nonce": "0x0",
    "blockHash": "0x5aa67687ce397454c5c43e2d9ed7b35f7a4bed6e53325b76242693b995c17b3a",
    "blockNumber": "0x13fb74",
    "transactionIndex": "0x0",
    "from": "0x9d93d9808ff21564f1bd6177cceff16ad27c3da0",
    "to": "0x9d93d9808ff21564f1bd6177cceff16ad27c3da0",
    "value": "0x79b54c88d82d0000",
    "gasPrice": "0x1004ccb4",
    "gas": "0x93e08",
    "input": "0x",
    "type": "0xff",
    "maxFeePerGas": "0x1004ccb4",
    "maxPriorityFeePerGas": "0x0",
    "chainId": "0x12c",
    "l1BatchNumber": "0x1fa4",
    "l1BatchTxIndex": "0x1b5"
  },
  "id": 0
}

Transaction response for a normal transaction
{
  "jsonrpc": "2.0",
  "result": {
    "hash": "0x75ca68cdb2709a0069f15eed27b0bbad1d8e17851fa0ed44181ce930afc2d88f",
    "nonce": "0x205ef",
    "blockHash": "0xfc490728d41fc15887d643252dc67c746ad6d345c512c5396bf185e2029e8b86",
    "blockNumber": "0x14028f",
    "transactionIndex": "0x0",
    "from": "0x56ddd604011c5f8629bd7c2472e3504bd32c269b",
    "to": "0x213e2cbf26bb8822c1057c6721d99807f8bc7531",
    "value": "0x0",
    "gasPrice": "0x5f5e100",
    "gas": "0x3d0900",
    "input": "0xc9807539000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000002000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000004608ede8840adfd6c429517bbc7876340000ad1c0200010203000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000400000000000000000028b1433b340029ad3e0b44002a6a8de66a002669757c2e00000000000000000028b1433b340029ad3e0b44002a6a8de66a002669757c2e00000000000000000028b1433b340029ad3e0b44002a6a8de66a002669757c2e00000000000000000028b1433b340029ad3e0b44002a6a8de66a002669757c2e00000000000000000000000000000000000000000000000000000000000000027a6ef747f6fbdaa3be38e8f68609fa0fb8891d2e99c40827028274fb865e3e7bbebe5272be89d9056af05fbe5e2fbf40b131f9de55520cf562d6c4ab2ce07e3b000000000000000000000000000000000000000000000000000000000000000267e80eeeef69eb8d4c16f49594b04cd9e7e8e0d564fbaa1e2663f74f156a8a827839fdffb712cc4e1717d68e29b79eecd5388df0ab7629a0afe9da4548cef6d2",
    "v": "0x27c",
    "r": "0xb4adcc9fdbe7c54d15bbce529eac09e6830a36722d1bb5dc970bf256ea65596f",
    "s": "0x2970dde29f249c013ac3249e00770c54e3aefb4f8ce2099d8105eb48af018431",
    "type": "0x0",
    "maxFeePerGas": "0x3b9aca00",
    "maxPriorityFeePerGas": "0x3b9aca00",
    "chainId": "0x12c"
  },
  "id": 0
}

I am even not sure if ethers really should work with the first variant.. At least, it's a layer-2 magic. Still looking for a workaround..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
investigate Under investigation and may be a bug. v6 Issues regarding v6
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants