Test wanted: ecRecover failure for py-evm
See original GitHub issueReported 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
).
Issue Analytics
- State:
- Created 2 years ago
- Comments:25 (10 by maintainers)
Top Results From Across the Web
ecrecover return wrong values · Issue #5109 · ethereum/solidity
In this project test working in ganache , but I started my investigation, when transactions to contract with similar logic on mainnet failed....
Read more >Why ecrecover call in my Solidity code failed to resolve the ...
The resulting signature can then be successfully validated by Solidity with ecrecover() . The recovered value should be the account address of the...
Read more >What is ecrecover in Solidity? - Solidity developer
A transaction just consists of bytes after all and people are likely to not check what this string of characters they are signing...
Read more >Populus Documentation - Web3.py
The full details can be found in the Providers documentation. This Quickstart guide will highlight a couple of the most common use cases....
Read more >`ecrecover` throwing out of gas error on Ropsten
The transaction execution will likely fail. Do you want to force sending? Error: gas required exceeds allowance or always failing ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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 ?
Fix has been merged and released in py-evm (v0.5.0a2) via https://github.com/ethereum/eth-keys/pull/76. I am working on getting the changes into eth-account now! This issue can probably be closed though. Thanks!