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

Recover sender from signedTxHash #22

Closed
wants to merge 4 commits into from
Closed

Recover sender from signedTxHash #22

wants to merge 4 commits into from

Conversation

bh2smith
Copy link
Collaborator

@bh2smith bh2smith commented Apr 22, 2024

When working with the gas relayer, we receive a signed transaction hash that was signed by the "unknown" paymaster. In my case, this paymaster was not funded. I needed to extract the sender to fund the account. This utility method might be useful in the future.

Problems

Although this unit test demonstrates the viem implementation agrees with ethers. It doesn't agree with what someone else got (in CA Telegram). In fact, trying to relay this transaction with eth_sendRawTransaction resulted in an "INSUFFICIENT_FUNDS" error -- even after the public key of this was extracted.

Note that, from the

signedTxHash:
0x02f872611c847735940085174876e800825208940c0a71335cc50b821570f6f8b302b248d0e56ed4870eebe0b40e800080c080a0d490e3ce4e974cae1f89c4b328bf4dc7ecba7b1cef9838be6282ca92fd5a8127a01c032f8bfa93bd48fb5215813e4f3a21f8e5da015ebd52b4daa945bcc2d4749e

we recover

Incorrect Sender: 0x909BaB1A50EBd17c0E771b8B0BF2A95fEB34B205

While someone else got

Correct Sender: 0x993944ce7ed881a353b7e34f63a37242041629fb.

The "correctness" is concluded by the following observation: Funding the 0x909... account still resulted in INSUFFICIENT_FUNDS, while funding 0x993 resulted in a successful tx with:

txHash: 0x2da68d8765521fdbb331d2696cf51e4bab0ca37e21161350f7f03ec35eb8a540.

Unfortunately

  1. This transaction is still not visible in the block explorer (after more than an hour).
  2. Neither accounts funds have changed.
  3. The very same node that the tx was sent to returns null when requesting eth_getTransactionReceipt, but says Already Exists when trying to resubmit the transaction.

Relevant RPC Requests

Send Signed Transaction

curl https://bsc-testnet.public.blastapi.io \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"jsonrpc":"2.0","method":"eth_sendRawTransaction","params":["0x02f872611c847735940085174876e800825208940c0a71335cc50b821570f6f8b302b248d0e56ed4870eebe0b40e800080c080a0d490e3ce4e974cae1f89c4b328bf4dc7ecba7b1cef9838be6282ca92fd5a8127a01c032f8bfa93bd48fb5215813e4f3a21f8e5da015ebd52b4daa945bcc2d4749e"],"id":1}'

Get Transaction Receipt

curl https://bsc-testnet.public.blastapi.io \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"jsonrpc":"2.0","method":"eth_getTransactionReceipt","params":["0x2da68d8765521fdbb331d2696cf51e4bab0ca37e21161350f7f03ec35eb8a540"],"id":1}'

According to this online tool:
https://rawtxdecode.in/ the sender is different.

and this rust implementation: https://github.com/near/multichain-gas-station-contract/blob/master/gas_station/tests/tests.rs#L515

@bh2smith bh2smith requested a review from tifrel April 23, 2024 07:37
@bh2smith
Copy link
Collaborator Author

No longer necessary since #23

@bh2smith bh2smith closed this Apr 29, 2024
@bh2smith bh2smith deleted the recoverSender branch April 29, 2024 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant