Skip to content

Commit

Permalink
Update CACHING.md
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeniy-scherbina authored Nov 15, 2023
1 parent 585a3cd commit 7c60dda
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion architecture/CACHING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ package provides two different middlewares:

## What requests are cached?

As of now we have 3 different groups of cacheable EVM methods:
As of now we have 4 different groups of cacheable EVM methods:
- cacheable by block number (for ex.: `eth_getBlockByNumber`)
- cacheable by block hash (for ex.: `eth_getBlockByHash`)
- static methods (for ex.: `eth_chainId`, `net_version`)
Expand Down Expand Up @@ -95,6 +95,40 @@ Cacheable by tx hash means that for specific:
- tx hash (which is part of params)
response won't change over time, so we can cache it indefinitely

`NOTE`: we can't cache txs which is in mempool, because response for same tx in mempool and in block is different:

tx in mempool example:
```json
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"blockHash": null,
"blockNumber": null,
"transactionIndex": null,
"from": "0x57852ef74abc9f0da78b49d16604bbf2d81c559e",
"gas": "0x5208",
...
}
}
```

tx in block example
```json
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"blockHash": "0xcc62755636e265e1f40cc0ea757477a79a233b6a417e3a8813be2ffe6859c0aa",
"blockNumber": "0x7e8e5e",
"transactionIndex": "0x0",
"from": "0x57852ef74abc9f0da78b49d16604bbf2d81c559e",
"gas": "0x5208",
...
}
}
```

### Where to find list of methods for every group?

It can be found in source code: https://github.com/Kava-Labs/kava-proxy-service/blob/main/decode/evm_rpc.go
Expand Down

0 comments on commit 7c60dda

Please sign in to comment.