Commit Graph

2711 Commits

Author SHA1 Message Date
lupin012
21d24a20a0
fix on number of samples for blocks (#5826)
eth_gasPrice(): A maximum of 3 samples should be taken per block (see
sample const)
The getBlockPrices() function takes 3 samples on the first block and one
on the others.
In the check s.Len() >= limit s.Len() after first block will contain 3
samples and so the loop will be executed only one time for each block
NOT three times
2022-11-18 03:14:49 +03:00
Manav Darji
1da4d3abbf
eth, consensus/bor: fixes and improvements related to mining (#6051)
In context of https://github.com/ledgerwatch/erigon/issues/5694, this PR
adds some fixes and improvement in the mining flow. Also, a relevant
change in txpool (present in erigon-lib) is made here:
https://github.com/ledgerwatch/erigon-lib/pull/737

#### Changes in triggering mining in `startMining()`
The mining module didn't honour the block time as a simple 3 second
timer and a notifier from txpool was used to trigger mining. This would
cause inconsistencies, at least with the bor consensus. Hence, a geth
like approach is used instead for simplicity. A new head channel
subscription is added in the `startMining()` loop which would notify the
addition of new block. Hence, this would make sure that the block time
is being honoured. Moreover, the fixed 3 second timer is replaced by the
`miner.recommit` value set using flags.

####  Changes in the arrangement of calls made post mining
When all the mining stages are completed, erigon writes all the data in
a cache. It then processes the block through all the stages as it would
process a block received from P2P. In this case, some of the stages
aren't really required. Like the block header and body download stage is
not required as the block was mined locally. Even execution stage is not
required as it already went through it in the mining stages.

Now, we encountered an issue where the chain was halted and kept mining
the same block again and again (liveness issue). The root cause is
because of an error in a stage of it's parent block. This stage turns
out to be the 4th stage which is "Block body download" stage. This stage
tries to download the block body from peers using the headers. As, we
mined this block locally we don't really need to download anything (or
process anything again). Hence, it reaches out to the cache which we
store for the block body.

Interestingly that cache turned out to be empty for some blocks. This
was because post mining, before adding block header and body to a cache,
we call the broadcast method which starts the staged sync. So,
technically it’s a bit uncertain at any stage if the block header and
body has been written or not.(see
[this](https://github.com/ledgerwatch/erigon/blob/devel/eth/backend.go#L553-L572)).
To achieve complete certainty, we rearranged the calls with the write to
cache being called first and broadcast next. This pretty much solves the
issue as now we’re sure that we’d always have a block body in the cache
when we reach the body download stage.

#### Misc changes
This PR also adds some logs in bor consensus.
2022-11-18 02:39:16 +03:00
Alex Sharov
874d96fb47
e3: Non parallel exec (with exec in RO goroutine) (#6073) 2022-11-17 20:52:12 +03:00
Alex Sharov
c50d4e6c0b
e3: panic logging (#6072) 2022-11-17 16:17:02 +03:00
Alex Sharov
d5c23c4df4
e3: enable test (#6071) 2022-11-17 16:06:57 +03:00
Alex Sharov
93926646f8
e3: prepare downloader for extraction (#6061) 2022-11-16 15:48:23 +03:00
Alex Sharov
7d034d0c79
e3: fix stuck exec after recon (#6059) 2022-11-16 14:22:49 +03:00
Giulio rebuffo
3a2d3be080
Added persistence in LightClient (#6056) 2022-11-15 20:39:18 +01:00
Alex Sharov
242b5a76df
e3: fix doneCount variable (#6053) 2022-11-15 18:03:10 +03:00
Andrew Ashikhmin
14c0643476
Enable both eth/66 and eth/67 by default (#6048) 2022-11-15 10:41:56 +01:00
Giulio rebuffo
ae01026ca9
Customizable networking for Erigon Lightclient (#6032) 2022-11-11 23:22:47 +01:00
ledgerwatch
5fc2ec4b52
Enable snapshot creation for Gnosis Chain (#6030)
Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
2022-11-11 15:38:59 +00:00
Alex Sharov
90952c4110
e3: wal ram configure (#6023) 2022-11-11 11:28:22 +07:00
Giulio rebuffo
f8916e9226
Made Lightclient default (#5813)
lightclient cl is default, for external cl, run `--externalcl`
2022-11-10 17:06:04 +00:00
hexoscott
475fa08fdf
eth_gasPrice performance tweaks (#6016)
Code news up an oracle for every call so existing cache checks always
came back as 0. Moved cache up a layer and pass in via the new
`gasprice.Cache` interface. Looked at putting the oracle instance onto
the ethApi itself to re-use it that way, but the backend transaction
made it a little hard work as we can't re-use that. This seemed cleaner
but happy to take feedback.

Locally takes me from ±2.5k rps to ±43k rps so quite a difference there.
(k6 with 1000 virtual users)
2022-11-10 15:36:04 +00:00
Alex Sharov
6b0f7fa913
e3: recon reduce ram (#6004) 2022-11-09 14:32:44 +07:00
Alex Sharov
57db64b692
e3: fix coinbase 2 (#6006) 2022-11-09 13:53:07 +07:00
Alex Sharov
906953b246
e3: fix coinbase (#6005) 2022-11-09 13:48:23 +07:00
hexoscott
636586c1b5
cache state check (#5844)
draft for now to get some early feedback on approach
2022-11-07 13:04:31 +00:00
Alex Sharov
160407b36a
e3: recon metrics (#5984) 2022-11-07 12:02:46 +07:00
Alex Sharov
1e5a513657
e3: configurable recon workers (#5983) 2022-11-07 11:42:44 +07:00
Alex Sharov
92a1aab1f1
e3: accumulator nil on unwind (#5981) 2022-11-07 10:14:35 +07:00
Enrique Jose Avila Asapche
da455c8f48
got rid of effective engine (#5975)
It is not being used and it hasn't been used for a while #5847
2022-11-07 08:55:03 +07:00
Alex Sharov
766d0fd5dd
e3: more workers (#5972) 2022-11-06 12:40:41 +07:00
Alex Sharov
4954b0be1c
e3: more logs (#5971) 2022-11-06 11:54:29 +07:00
alex.sharov
949ec358fa save 2022-11-06 11:52:25 +07:00
Alex Sharov
e7c53ac9b7
e3: fix sequential commit place (#5969) 2022-11-06 10:27:52 +07:00
Alex Sharov
bb1811a76e
e3: increase workers (#5966) 2022-11-05 16:31:10 +07:00
alex.sharov
1a6bc51f18 save 2022-11-05 16:29:13 +07:00
ledgerwatch
5deaa9cec1
Fix panic in txpool (due to modificatin with read lock) and snapshot … (#5931)
…access (due to inconsistent indices)

Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
2022-11-04 12:43:59 +00:00
Alex Sharov
b1fc489024
e3: fix tests (#5961) 2022-11-04 16:14:58 +07:00
Alex Sharov
d4fc7c7ef0
e3: reduce write-lock of rws (#5959) 2022-11-04 15:09:29 +07:00
Alex Sharov
f3d8533879
e3: cheaper recon estimate (#5958) 2022-11-04 13:21:44 +07:00
Alex Sharov
bc2a873c9d
e3: disable txlookup stage (#5957) 2022-11-04 10:51:09 +07:00
Alex Sharov
655e32a199
e3: commit between blocks (#5955) 2022-11-04 09:50:35 +07:00
Alex Sharov
7516c33527
e3: idx size metric (#5954) 2022-11-04 09:31:30 +07:00
Alex Sharov
d4c406d3f0
e3: aggressive prune on seq exec (#5953) 2022-11-04 09:26:34 +07:00
Alex Sharov
d418069553
e3: fix retainList on unwind (#5947) 2022-11-03 15:12:53 +07:00
Alex Sharov
32eaa82fba
e3: prune debug log (#5944) 2022-11-03 11:15:03 +07:00
Giulio rebuffo
5c3245d4e0
Added Checkpoint sync for CL full client (#5934) 2022-11-02 13:12:44 +01:00
Alex Sharov
7208b0dc60
remove fmt (#5937) 2022-11-02 10:08:25 +07:00
Alex Sharov
96deee29bb
e3: build files sequentially, flush indices in-advance before commit (#5935) 2022-11-02 10:04:12 +07:00
hexoscott
c611c7489f
reduce estimated RAM from 80% to 50% (#5930) 2022-11-01 21:54:39 +07:00
Alex Sharov
58c8baf2ef
e3: parallel exec - spend time for prune instead of flush when much data in db (#5925) 2022-11-01 14:17:25 +07:00
Alex Sharov
e490d2d0c7
e3: background merge (#5921) 2022-11-01 09:55:38 +07:00
Andrew Ashikhmin
9ffc457cbb
EIP-3860: Limit and meter initcode (#5892)
[EIP-3860](https://eips.ethereum.org/EIPS/eip-3860) is
[included](https://github.com/ethereum/execution-specs/pull/633) into
[Shanghai](https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/shanghai.md).

TODO: similar changes to `txpool`.

Co-authored-by: Andrei Maiboroda <andrei@ethereum.org>
2022-10-31 13:40:41 +01:00
Alex Sharov
4ead27fad9
e3: add "make test3" to CI (#5910) 2022-10-31 14:25:52 +07:00
Alex Sharov
381bea5b92
e3: eth_traceTransaction implementation (#5909) 2022-10-31 12:31:38 +07:00
Giulio rebuffo
adf5fc7b82
refactored files regarding lightclient (#5904) 2022-10-29 21:51:32 +02:00
Alex Sharov
8c36c3fe99
e3: recon progress metric (#5902) 2022-10-29 21:51:01 +07:00