tests: Test wanted: ecRecover failure for py-evm

Reported by @guidovranken. cc @carver @pipermerriam

Here’s a repro of a testcase that apparently fails on py-evm, but succeeds on geth and nethermind. The test calls ecRecover, and the signature recovery fails on geth and nethermind, but succeeds on py-evm

{
 "ecRecoverTest": {
  "env": {
   "currentCoinbase": "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
   "currentDifficulty": "0x20000",
   "currentGasLimit": "0x26e1f476fe1e22",
   "currentNumber": "0x1",
   "currentTimestamp": "0x3e8",
   "previousHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
   "currentBaseFee": "0x10"
  },
  "pre": {
   "0x000000000000000000000000000000000000ff0a": {
    "code": "0x7f6b8d2c81b11b2d699528dde488dbdf2f94293d0d33c32e347f255fa4a6c1f0a9600052601b6020527f79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f817986040527f6b8d2c81b11b2d699528dde488dbdf2f94293d0d33c32e347f255fa4a6c1f0a9606052602060006080600060006001620f4240f150600051600055",
    "storage": {},
    "balance": "0xffffffff",
    "nonce": "0x0"
   },
   "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b": {
    "code": "0x",
    "storage": {},
    "balance": "0xde0b6b3a7640000",
    "nonce": "0x0"
   }
  },
  "transaction": {
   "gasPrice": "0x10",
   "nonce": "0x0",
   "to": "0x000000000000000000000000000000000000ff0a",
   "data": [
    ""
   ],
   "gasLimit": [
    "0x989680"
   ],
   "value": [
    "0x0"
   ],
   "secretKey": "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8"
  },
  "out": "0x",
  "post": {
   "London": [
    {
     "hash": "b520c02c1dedacb96574e47fe27a3053e9d0f2b9d52dadd3702a00466532ac31",
     "logs": "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
     "indexes": {
      "data": 0,
      "gas": 0,
      "value": 0
     }
    }
   ]
  }
 }
}

The code is

	copy(v, hexutil.MustDecode("0x000000000000000000000000000000000000000000000000000000000000001b"))
	copy(r, hexutil.MustDecode("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"))
	copy(s, hexutil.MustDecode("0x6b8d2c81b11b2d699528dde488dbdf2f94293d0d33c32e347f255fa4a6c1f0a9"))
	copy(hash, hexutil.MustDecode("0x6b8d2c81b11b2d699528dde488dbdf2f94293d0d33c32e347f255fa4a6c1f0a9"))

	a.Mstore(hash, 0)
	a.Mstore(v, 32)
	a.Mstore(r, 64)
	a.Mstore(s, 96)

	a.Call(big.NewInt(1_000_000),
		1,
		big.NewInt(0),   // value
		big.NewInt(0),   // inoffset
		big.NewInt(128), // insize
		big.NewInt(128),
		big.NewInt(128), // outsize
	)
	a.Op(ops.RETURNDATASIZE)
	a.Op(ops.SSTORE)

so it just creates the input 6b8d2c81b11b2d699528dde488dbdf2f94293d0d33c32e347f255fa4a6c1f0a9000000000000000000000000000000000000000000000000000000000000001b79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f817986b8d2c81b11b2d699528dde488dbdf2f94293d0d33c32e347f255fa4a6c1f0a9 and invokes ecrecover, then sets a slot depending on the returndatasize (should be 0) and the return value from the call (should be 1).

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 25 (10 by maintainers)

Most upvoted comments

cc @kclowes does the test https://github.com/ethereum/tests/pull/973 ‘work’ on pyevm?

Also, is there a statetest which implements the one I posted in the issue description @winsvega ?