erigontech / erigontech/erigon
Experiment: history vals table to be
- Dominant language
- Go
- Stars
- 3.6k
- Forks
- 1.5k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 455
Description
Erigon2 algo of `debug_AccountRange`:
```
AccountsHistory: key + shard_id -> roaringBitmap(blockNums)
AccountChangeSet: blockNum -> key + account(encoded)
```
```
`WalkAsOfAccounts` func:
foundTS, _ = seek(kv.E2AccountsHistory, addr, timestamp)
foundVal, _ = seek(kv.AccountChangeSet, foundTS, addr)
if !bytes.HasPrefix(foundVal, addr) {
return NotFound
}
accountEncoded := foundVal[20:]
return accountEncoded
```
Erigon3 algo of `debug_AccountRange`:
```
Hist.KeysTable: txNum -> key
Hist.ValsTable: key + txNum -> val
History:RangeAsOf()
```
Key difference: `E2's table AccountsHistory - starting from "key" and doesn't have actual value. E3's opposite: Hist.ValsTable`. So, basically in E3 we "storing value inside InvertedIndex table" and having perf penalty because of this (insert/delete is more expensive to tables - with randomized keys. tables with `txNum/blockNum` key-prefix have cheaper insert/delete).
---------
ToDo: attempt to move `value` from `Hist.ValsTable` to `Hist.KeysTable`. And rename `KeysTable` to DataTable (or EventsTable), `ValsTable` to `InvIndexTable` (mapping of keys to txNum)
Context1: after stepSize reduction - `flush` bottleneck is writing Commitment.History.
Context2: after stepSize reduction - we probably don't need DupSort for most of tables.
Contributor guide
Assessment
This issue has not been assessed yet.