Skip to content
This repository has been archived by the owner on Mar 24, 2023. It is now read-only.

[BUG] eth_getTransactionByHash returns incorrect v parameter #566

Closed
maciej-kozuszek opened this issue Oct 28, 2022 · 1 comment · Fixed by #567, godwokenrises/godwoken-info#80 or godwokenrises/godwoken-info#81
Assignees
Labels
bug Something isn't working

Comments

@maciej-kozuszek
Copy link

maciej-kozuszek commented Oct 28, 2022

Response of Godwoken RPC call eth_getTransactionByHash returns incorrect v value - it should be along the formula:
vRpcShouldReturn = (realV + chainId * 2 + 35) according to EIP-155

Right now Godwoken mainnet for RPC call eth_getTransactionByHash for transaction 0x38ec95202ddd22a3a5ff63c16734cfe723b5f1ec09a39306133ec829d357754c returns this:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "hash": "0x38ec95202ddd22a3a5ff63c16734cfe723b5f1ec09a39306133ec829d357754c",
    "blockHash": "0x56b320ae34824be6c798d6a7e288396309179ff772977915193d5b8a47fff11d",
    "blockNumber": "0x30bb7",
    "transactionIndex": "0x0",
    "from": "0x2661a4786ea12b7edfd3f5c08ff617702360a993",
    "to": "0x2661a4786ea12b7edfd3f5c08ff617702360a993",
    "gas": "0xb71b00",
    "gasPrice": "0x246139ca8000",
    "input": "0x",
    "nonce": "0x145",
    "value": "0xde0b6b3a7640000",
    "v": "0x0",
    "r": "0x7fbfc954dd1caf12bf136b62d894a6bd1527101fe7d84ecdf629593c8ecb225e",
    "s": "0x1b44a4dd4859eaa461de8ef62e19034fb6b61d266a6db81a7e17b3a9818ec3e1"
  }
}

V should be equal to 142839 as it's would be according to EIP-155 equation 71402 * 2 + 35 (71402 is Godwoken mainnet chainID).

Performing same call on Goerli chain for transaction 0x08314eb96ffef2a8a20d6d99105199fbb0fd624118c846225c8fc1208eec5a84 returns this:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "blockHash": "0xb995212de41e26196044dfcae4b96ab800a18e29848a4208be0ebd84e4022b08",
    "blockNumber": "0x77c807",
    "hash": "0x08314eb96ffef2a8a20d6d99105199fbb0fd624118c846225c8fc1208eec5a84",
    "chainId": "0x5",
    "from": "0xdec1bc71bf91431d60ef2742f412dcd1c5a204b8",
    "gas": "0x7a120",
    "gasPrice": "0xffd8aa7e0",
    "input": "0x67a5cd060000000000000000000000004f356412d6264eb2d55b48ac711e02cd0a4eda31",
    "nonce": "0x3f8ce",
    "r": "0x937ac9dd24fb2e2ae97df3ecdea076f184f06d14549a2cf1299ccdf670d6635f",
    "s": "0x2fe773a7011ef99c3ae22d15bf14c9d808faefbfa768fb544ba9b1be44ff72cd",
    "to": "0xf5de760f2e916647fd766b4ad9e85ff943ce3a2b",
    "transactionIndex": "0x23",
    "type": "0x0",
    "v": "0x2d",
    "value": "0x0"
  }
}

So 0 + 2*5 + 35 equals 45 (2d in hex)

I have also prepared test calculates transaction hash using hardhat tools and compares it with one we get from RPC call.
This incorrect value is issue for hardhat fork feature which allows to make a snapshot of chain for debugging purpose.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.