When body gets evicted from the cache, its corresponding entry in
`requestMap` is also removed but was never re-instated when re-request
happens
Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
This is more reliable criterion because it is harder to spoof
continuously by malicious peers
Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
Split backend.go:New method to 2. 1st will create db and basic
configuration. 2nd will create instances of stagedsync, txpool, etc...
based on this configuration.
1. Replacing temporary MBDX table with limited-size btree
2. Always scan block numbers from the start to prioritise low-number
blocks
3. Other fixes and simplifications
Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
Run tests from a new repo
https://github.com/ethereum/execution-spec-tests.
Also introduce `HashCheck()` function that checks correctness of block's
uncle, transaction, and withdrawals hashes.
Workaround for https://github.com/ledgerwatch/erigon/issues/6308
Very inefficient, because it get 1 single header from the request of 192
headers, so moves quite slowly
Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
Works around a flaw in the upgrade logic of the system contracts. Since
they are updated directly, without first being self-destructed and then
re-created, the usual incarnation logic does not get activated, and all
historical records of the code of these contracts are retrieved as the
most recent version. This problem will not exist in erigon3, but until
then, a workaround will be used to access code of such contracts through
a special structure, `SystemContractCodeLookup`
Fixes https://github.com/ledgerwatch/erigon/issues/5865
Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
Change from:
```
begin(TxNoSync)
exec new block, index nee data
do limited pruning
commit()
send notifications about new data arrival to other apps, they may start reading new data at this time (by new read transactions)
```
Change to:
```
begin(TxNoSync)
exec new block, index nee data
commit() // no fsync here
send notifications about new data arrival to other apps, they may start reading new data at this time (by new read transactions)
begin()
do pruning
commit() // fsync here
```
it allows notify earlier. Fsync (of all changes) on modern drives is
fast, but on cloud-drives it’s about 1sec in worst cases.
Moving the txpool transaction pull into the execution phase and looping
until the gas is used up or the txpool runs dry.
Removed the concept of local vs remote transactions as comments/code
showed this split was no longer in use.
Created a `PreparedTxs` collection to satisfy the use case in the
integration tool when mining is active.
Untested locally as I have no way of mining/validating currently.
Co-authored-by: Alex Sharov <AskAlexSharov@gmail.com>