movementlabsxyz / M1

An L1 for Move VM built on Avalanche.
https://docs.movementlabs.xyz
BSD 3-Clause "New" or "Revised" License
72 stars 53 forks source link

ECDSA recover seems to be bugged in MEVM #131

Open lazycoder1 opened 2 months ago

lazycoder1 commented 2 months ago

Describe the bug We have deployed EIP 4337 contracts from https://github.com/eth-infinitism/account-abstraction along with the Entry Point - contracts/core/EntryPoint.sol , we have also deployed SimpleAccount from the same repo - contracts/samples/SimpleAccount.sol

The signature validation https://github.com/eth-infinitism/account-abstraction/blob/f1c5c11b273b7ddae26bb20809419b33ccb8f043/contracts/samples/SimpleAccount.sol#L105 EDCSA.recover fails when executing transactions.

To Reproduce Steps to reproduce the behavior: To reproduce the error and test if it's breaking at that particular point, We deployed a slightly modified SimpleWallet that allows any external party to verify the wallet function individually.

We have written a test script ( in bun ).

  1. The script calls the validateSignature function independently - https://github.com/lazycoder1/entry-point-testing/blob/main/index.ts#L64
  2. The script also calls the entrypoint with the same input params where it breaks at the validateSignature call. - https://github.com/lazycoder1/entry-point-testing/blob/main/index.ts#L67

Steps to reproduce

  1. git clone repo - https://github.com/lazycoder1/entry-point-testing/tree/main git clone https://github.com/lazycoder1/entry-point-testing.git
  2. install dependencies bun i or pnpm i
  3. Add your PVT_KEY key in .env PVT_KEY=0xabdc... . private key which has some move test tokens in it.
  4. Run the script bun run index.ts

Expected behaviour Ideally, both cases need to pass the signature test, but one fails ECDSA.recover and the other passes ECDSA.recover call.

Additional context Do reach out to me in telegram @lazyc0der1 or lazycoder#9108 in discord. We can get a call to additional details too !

lazycoder1 commented 2 months ago

Moved the ticket from https://github.com/movementlabsxyz/movement/issues/305 to this repo