Skip to content

Comments

rpc-compat: show diff when receieved response conflicts with expected#585

Merged
fjl merged 1 commit intoethereum:masterfrom
lightclient:rpc-compat-diff
Jul 1, 2022
Merged

rpc-compat: show diff when receieved response conflicts with expected#585
fjl merged 1 commit intoethereum:masterfrom
lightclient:rpc-compat-diff

Conversation

@lightclient
Copy link
Member

As suggested by @fjl, I have added a diff view to the error output of the rpc-compat simulator which a conflict arises. It substantially improves the readability -- the mismatch is immediately clear.

Before:

invalid response
want: {"id":3,"jsonrpc":"2.0","result":{"baseFeePerGas":"0x2db08786","difficulty":"0x20000","extraData":"0x","gasLimit":"0x4c4b40","gasUsed":"0x5208","hash":"0xadff3fcd8b8fcfb1fa9e4fd94a4fa9b10794c62d70e3db9d59e686aea8ccc4c5","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","miner":"0x0000000000000000000000000000000000000000","mixHash":"0xf398615221db789347ea256bcc9d4fe431d520c638b826b55632a2d1fe759f2e","nonce":"0x4b6c6336198f3aff","number":"0x2","parentHash":"0x1bf5e60055636418c90891e234161b63c70b85644a68dcd1570ae1052a64c57c","receiptsRoot":"0x056b23fbba480696b65fe5a59b8f2148a1299103c4f57df839233af2cf4ca2d2","sha3Uncles":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","size":"0x26a","stateRoot":"0x730a6f5dbff0b86dd73ff3f2ba05e0e117129514002c742c716e88ee64426019","timestamp":"0x14","totalDifficulty":"0x40001","transactions":[{"blockHash":"0xadff3fcd8b8fcfb1fa9e4fd94a4fa9b10794c62d70e3db9d59e686aea8ccc4c5","blockNumber":"0x2","from":"0x658bdf435d810c91414ec09147daa6db62406379","gas":"0x5208","gasPrice":"0x2db08786","hash":"0x01d4a8006d417b25f8339501b42cfde957f85a2c18c604e69939d610933a8fde","input":"0x","nonce":"0x1","r":"0x5d50bd58d78c6bb56bba9f4b28b251c616231e9e35ab9733100c5245b7b469c5","s":"0x5241e473259c43bb38387211fa93ce8d5edf98775a20f971d31192290ca3970","to":"0x658bdf435d810c91414ec09147daa6db62406379","transactionIndex":"0x0","type":"0x0","v":"0x26","value":"0x3e8"}],"transactionsRoot":"0x7ca7896b5edf21a06d64da4ed0e0a8137fc95fa3c0ad4a89d79c194d895e1a40","uncles":[]}}
got:  {"id":3,"jsonrpc":"2.0","result":{"baseFeePerGas":"0x2db08786","difficulty":"0x20000","extraData":"0x","gasLimit":"0x4c4b40","gasUsed":"0x5208","hash":"0xadff3fcd8b8fcfb1fa9e4fd94a4fa9b10794c62d70e3db9d59e686aea8ccc4c5","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","miner":"0x0000000000000000000000000000000000000000","mixHash":"0xf398615221db789347ea256bcc9d4fe431d520c638b826b55632a2d1fe759f2e","nonce":"0x4b6c6336198f3aff","number":"0x2","parentHash":"0x1bf5e60055636418c90891e234161b63c70b85644a68dcd1570ae1052a64c57c","receiptsRoot":"0x056b23fbba480696b65fe5a59b8f2148a1299103c4f57df839233af2cf4ca2d2","sha3Uncles":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","size":"0x26a","stateRoot":"0x730a6f5dbff0b86dd73ff3f2ba05e0e117129514002c742c716e88ee64426019","timestamp":"0x14","totalDifficulty":"0x40001","transactions":[{"blockHash":"0xadff3fcd8b8fcfb1fa9e4fd94a4fa9b10794c62d70e3db9d59e686aea8ccc4c5","blockNumber":"0x2","chainId":"0x1","from":"0x658bdf435d810c91414ec09147daa6db62406379","gas":"0x5208","gasPrice":"0x2db08786","hash":"0x01d4a8006d417b25f8339501b42cfde957f85a2c18c604e69939d610933a8fde","input":"0x","nonce":"0x1","publicKey":"0xd9a872707aaec451b19445dd00c5ad619f36a0dcad5b035b03baf16849f719e806455742d05bf26ab4d0e715198709e0e7794c214ccde55731a9fbbd51edf2d8","r":"0x5d50bd58d78c6bb56bba9f4b28b251c616231e9e35ab9733100c5245b7b469c5","raw":"0xf86501842db0878682520894658bdf435d810c91414ec09147daa6db624063798203e88026a05d50bd58d78c6bb56bba9f4b28b251c616231e9e35ab9733100c5245b7b469c5a005241e473259c43bb38387211fa93ce8d5edf98775a20f971d31192290ca3970","s":"0x5241e473259c43bb38387211fa93ce8d5edf98775a20f971d31192290ca3970","to":"0x658bdf435d810c91414ec09147daa6db62406379","transactionIndex":"0x0","type":"0x0","v":"0x26","value":"0x3e8"}],"transactionsRoot":"0x7ca7896b5edf21a06d64da4ed0e0a8137fc95fa3c0ad4a89d79c194d895e1a40","uncles":[]}}

After:

response differs from expected:
 {
   "id": 3,
   "jsonrpc": "2.0",
   "result": {
     "baseFeePerGas": "0x2db08786",
     "difficulty": "0x20000",
     "extraData": "0x",
     "gasLimit": "0x4c4b40",
     "gasUsed": "0x5208",
     "hash": "0xadff3fcd8b8fcfb1fa9e4fd94a4fa9b10794c62d70e3db9d59e686aea8ccc4c5",
     "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
     "miner": "0x0000000000000000000000000000000000000000",
     "mixHash": "0xf398615221db789347ea256bcc9d4fe431d520c638b826b55632a2d1fe759f2e",
     "nonce": "0x4b6c6336198f3aff",
     "number": "0x2",
     "parentHash": "0x1bf5e60055636418c90891e234161b63c70b85644a68dcd1570ae1052a64c57c",
     "receiptsRoot": "0x056b23fbba480696b65fe5a59b8f2148a1299103c4f57df839233af2cf4ca2d2",
     "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
     "size": "0x26a",
     "stateRoot": "0x730a6f5dbff0b86dd73ff3f2ba05e0e117129514002c742c716e88ee64426019",
     "timestamp": "0x14",
     "totalDifficulty": "0x40001",
     "transactions": [
       0: {
         "blockHash": "0xadff3fcd8b8fcfb1fa9e4fd94a4fa9b10794c62d70e3db9d59e686aea8ccc4c5",
         "blockNumber": "0x2",
-        "chainId": "0x1",
         "from": "0x658bdf435d810c91414ec09147daa6db62406379",
         "gas": "0x5208",
         "gasPrice": "0x2db08786",
         "hash": "0x01d4a8006d417b25f8339501b42cfde957f85a2c18c604e69939d610933a8fde",
         "input": "0x",
         "nonce": "0x1",
-        "publicKey": "0xd9a872707aaec451b19445dd00c5ad619f36a0dcad5b035b03baf16849f719e806455742d05bf26ab4d0e715198709e0e7794c214ccde55731a9fbbd51edf2d8",
         "r": "0x5d50bd58d78c6bb56bba9f4b28b251c616231e9e35ab9733100c5245b7b469c5",
-        "raw": "0xf86501842db0878682520894658bdf435d810c91414ec09147daa6db624063798203e88026a05d50bd58d78c6bb56bba9f4b28b251c616231e9e35ab9733100c5245b7b469c5a005241e473259c43bb38387211fa93ce8d5edf98775a20f971d31192290ca3970",
         "s": "0x5241e473259c43bb38387211fa93ce8d5edf98775a20f971d31192290ca3970",
         "to": "0x658bdf435d810c91414ec09147daa6db62406379",
         "transactionIndex": "0x0",
         "v": "0x26",
         "value": "0x3e8"
+        "type": "0x0"
       }
     ],
     "transactionsRoot": "0x7ca7896b5edf21a06d64da4ed0e0a8137fc95fa3c0ad4a89d79c194d895e1a40",
     "uncles": [
     ]
   }
 }

@fjl fjl merged commit 0a2d22d into ethereum:master Jul 1, 2022
racytech pushed a commit to racytech/hive that referenced this pull request Apr 4, 2025
racytech pushed a commit to racytech/hive that referenced this pull request Apr 4, 2025
🤖 I have created a release *beep* *boop*
---


##
[3.0.0](ethpandaops/ethereum-package@2.2.0...3.0.0)
(2024-05-06)


### ⚠ BREAKING CHANGES

* add mev-rs relay/builder/boost
([ethereum#586](ethpandaops/ethereum-package#586))
* upcoming file path change in kurtosis upstream
([ethereum#582](ethpandaops/ethereum-package#582))

### Features

* add apache file server
([ethereum#581](ethpandaops/ethereum-package#581))
([205256a](ethpandaops/ethereum-package@205256a))
* add enr/enode to apache
([ethereum#589](ethpandaops/ethereum-package#589))
([b789e17](ethpandaops/ethereum-package@b789e17))
* add execution client urls to dora config
([ethereum#588](ethpandaops/ethereum-package#588))
([2a20d5a](ethpandaops/ethereum-package@2a20d5a))
* add mev-rs relay/builder/boost
([ethereum#586](ethpandaops/ethereum-package#586))
([525a8fb](ethpandaops/ethereum-package@525a8fb))
* Add peerdas support
([ethereum#591](ethpandaops/ethereum-package#591))
([14296ca](ethpandaops/ethereum-package@14296ca))
* add snooper urls to assertoor config
([ethereum#571](ethpandaops/ethereum-package#571))
([87f383f](ethpandaops/ethereum-package@87f383f))
* allow setting exit ip address
([ethereum#584](ethpandaops/ethereum-package#584))
([aabc942](ethpandaops/ethereum-package@aabc942))


### Bug Fixes

* non-existent field access on error message
([ethereum#577](ethpandaops/ethereum-package#577))
([8515d27](ethpandaops/ethereum-package@8515d27))
* participant redefining global flag
([ethereum#573](ethpandaops/ethereum-package#573))
([9139f4b](ethpandaops/ethereum-package@9139f4b))
* path for shadowforks post kt update
([ethereum#585](ethpandaops/ethereum-package#585))
([e0622a7](ethpandaops/ethereum-package@e0622a7))
* remove erigon's --chain parameter
([ethereum#575](ethpandaops/ethereum-package#575))
([02b9c50](ethpandaops/ethereum-package@02b9c50))
* upcoming file path change in kurtosis upstream
([ethereum#582](ethpandaops/ethereum-package#582))
([8d7c4f9](ethpandaops/ethereum-package@8d7c4f9))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants