From d8920f0e0a205dfac35fe1e7f1e0948fe12e2e8e Mon Sep 17 00:00:00 2001 From: anvacaru <16517508+anvacaru@users.noreply.github.com> Date: Mon, 2 Dec 2019 17:45:55 +0200 Subject: [PATCH] Web3: `blockhash` field incorrect in RPC response partial tests (#587) * web3.md: compute blockhash in tx receipt * web3: formatting --- web3.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/web3.md b/web3.md index 02512ffcd6..20e91c2c90 100644 --- a/web3.md +++ b/web3.md @@ -927,17 +927,17 @@ Transaction Receipts ... ... - | _ }) + | _ } #as BLOCKITEM ) => #rpcResponseSuccess( { "transactionHash": TXHASH , "transactionIndex": #unparseQuantity(getIndexOf(TXID, TXLIST)) - , "blockHash": #unparseQuantity(1) + , "blockHash": "0x" +String Keccak256(#rlpEncodeBlock(BLOCKITEM)) , "blockNumber": #unparseQuantity(BN) , "from": #unparseQuantity(TXFROM) , "to": #unparseAccount(TT) , "gasUsed": #unparseQuantity(CGAS) , "cumulativeGasUsed": #unparseQuantity(CGAS) , "contractAddress": #if TT ==K .Account #then #unparseQuantity(#newAddr(TXFROM, NONCE -Int 1)) #else null #fi - , "logs": [#serializeLogs(LOGS, 0, TXID, TXHASH, BN, 1)] + , "logs": [#serializeLogs(LOGS, 0, TXID, TXHASH, "0x" +String Keccak256(#rlpEncodeBlock(BLOCKITEM)), BN)] , "status": #unparseQuantity(TXSTATUS) , "logsBloom": #unparseDataByteArray(BLOOM) , "v": #unparseQuantity(TW) @@ -985,14 +985,14 @@ Transaction Receipts rule #unparseIntListAux(.List, RESULT) => RESULT rule #unparseIntListAux(L ListItem(I), RESULT) => #unparseIntListAux(L, (#unparseDataByteArray(#padToWidth(32,#asByteStack(I))), RESULT)) - syntax JSONs ::= #serializeLogs ( List, Int, Int, String, Int, Int ) [function] - // ------------------------------------------------------------------------------- + syntax JSONs ::= #serializeLogs ( List, Int, Int, String, String, Int ) [function] + // ---------------------------------------------------------------------------------- rule #serializeLogs (.List, _, _, _, _, _) => .JSONs rule #serializeLogs (ListItem({ ACCT | TOPICS:List | DATA }) L, LI, TI, TH, BH, BN) => { "logIndex": #unparseQuantity(LI), "transactionIndex": #unparseQuantity(TI), "transactionHash": TH, - "blockHash": #unparseQuantity(BH), + "blockHash": BH, "blockNumber": #unparseQuantity(BN), "address": #unparseQuantity(ACCT), "data": #unparseDataByteArray(DATA),