Commit Graph

33 Commits

Author SHA1 Message Date
hexoscott
80a37eb209
stop writing to closed channel panic (#6763) 2023-02-06 18:17:32 +07:00
hexoscott
f13016c7ec
Fork choice is waiting fix (#6711) 2023-01-30 07:52:29 +00:00
ledgerwatch
0ccda84439
Fix defer order to prevent concurrent map write panic (#6736)
Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
2023-01-29 09:06:36 +00:00
hexoscott
7dcbfbc283
reference hash, address, and chain config from lib (#6536) 2023-01-13 18:12:18 +00:00
Andrew Ashikhmin
58b3016c80
Switch validateAndStorePayload to Body.RawBody() (#6568)
Ensure that withdrawals are not lost in `validateAndStorePayload`.
2023-01-12 14:58:36 +01:00
Andrew Ashikhmin
4f536abe46
Unify forkSegment with HeaderAndBody (#6517)
Small refactoring after PR #6515.
2023-01-06 15:12:07 +01:00
ledgerwatch
2941e754e9
Fix hive tests and reorganise the fix for body download problem (#6515)
Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
2023-01-06 12:43:46 +00:00
ledgerwatch
7bf9372740
Bodies timeout not to cause broken in-memory validation (#6498)
Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro-2.local>
2023-01-04 07:34:19 +00:00
Andrew Ashikhmin
7286a0fef7
Create in-memory MDBX inside dirs.Tmp (#5702)
Previously "in-memory" MDBX instances for fork validation and mining
were created inside `os.TempDir()`. We should create them inside
Erigon's datadir so that the file permissions and the disk are the same
as for the main database.

Prerequisite: https://github.com/ledgerwatch/erigon-lib/pull/676.
2022-10-11 16:49:38 +01:00
ledgerwatch
94f4ea805d
Fixing hive SideChain reorg test (#5620)
the root cause is that when `inMemoryExecution` lambda gets created in
the `eth/backend.go`, it captures the reference of
`backend.notifications`, and so the execution of side-forks actually
adds notifications to there, and it all gets sent out to tx pool (and
RPC daemon) at the end of the stage loop (regardless of whether there
was forkchoice update or not)

so we can create a separate notification, but then somehow flush it to
the "main" nofitications when the in-memory exec state is flushed

Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro.local>
2022-10-05 05:42:38 +01:00
Andrew Ashikhmin
a8a104c35c
Merge & Downloader logging improvements (#5398)
* Prefix downloader logs with [Downloader]

* Better check for syncing

* Better handle nil dereference
2022-09-16 15:15:48 +02:00
Giulio rebuffo
c58a3be765
ops (#5048)
Co-authored-by: giuliorebuffo <giuliorebuffo@system76-pc.localdomain>
2022-08-13 23:40:53 +02:00
Giulio rebuffo
8ade569cc5
Save PoW blocks for processing received through P2P (#5015)
* save terminal blocks

* ops

* save less PoW blocks

Co-authored-by: giuliorebuffo <giuliorebuffo@system76-pc.localdomain>
2022-08-12 21:54:20 +02:00
Giulio rebuffo
6d86b3a403
use of memory batch (#4961)
Co-authored-by: giuliorebuffo <giuliorebuffo@system76-pc.localdomain>
2022-08-08 18:20:12 +02:00
Giulio rebuffo
7a64fe44eb
UX improvement for pre-merge sync with Teku (#4955)
Co-authored-by: giuliorebuffo <giuliorebuffo@system76-pc.localdomain>
2022-08-08 11:26:34 +02:00
Giulio rebuffo
a481b77489
removed incarnation updates and removed side forks past fcu (#4944)
* removed incarnation updates and removed side forks past fcu

* has

* fixed hive

Co-authored-by: giuliorebuffo <giuliorebuffo@system76-pc.localdomain>
2022-08-05 18:07:27 +02:00
Giulio rebuffo
3a972cc074
Removed the use of memory mutation for side-fork unwinds. (#4857)
* done

* updated sum and mod

* error handling

* error handling

* comments

Co-authored-by: giuliorebuffo <giuliorebuffo@system76-pc.localdomain>
2022-07-31 15:56:08 +02:00
Giulio rebuffo
101e181c52
if PoS download block is within reach, determine VALID or INVALID (#4812)
* if PoS download is fast enough, determine VALID or INVALID

* more acceptable absolute value

* solved comments

* remove useless

* moved check in stage_headers

Co-authored-by: giuliorebuffo <giuliorebuffo@system76-pc.localdomain>
2022-07-26 15:24:02 +02:00
Andrew Ashikhmin
c1f848746d
Update consensus tests to v11 (#4724)
* Consensus tests update 11

* Add GrayGlacier fork

* Wire currentRandom from tests into PREVRANDAO

* Serenity engine

* Support insertion of PoS blocks in MockSentry

* Introduce marshallTypedTransactionsAsRlpStrings arg into (*Block) RawBody()

* Revert "Introduce marshallTypedTransactionsAsRlpStrings arg into (*Block) RawBody()"

This reverts commit 903fca572be03c7de33318ce177a03a4be34927b.

* Post-merge fix

* Don't wait for Beacon Chain in tests

* Skip powToPosBlockRejection transition test

* ForkChoice in insertPoSBlocks

* Add withPosDownloader arg to MockWithEverything in order to fix TestPoSDownloader
2022-07-26 09:35:38 +02:00
Giulio rebuffo
1cb6be02a5
Avoid constantly triggering stageloop when using Engine API (#4797)
* avoid constantly triggering stageloop when using Engine API

* fix lint + test

* fixed comments

* ops

* little fixes here and there

Co-authored-by: giuliorebuffo <giuliorebuffo@system76-pc.localdomain>
2022-07-23 18:57:23 +02:00
Giulio rebuffo
46a8c531ce
Optimized PoS header downloader (#4775)
* optimized PoS header downloader

* removed println

* comments

* ops

* Restore schedulePoSDownload params + simplify

Co-authored-by: giuliorebuffo <giuliorebuffo@system76-pc.localdomain>
Co-authored-by: yperbasis <andrey.ashikhmin@gmail.com>
2022-07-22 11:07:58 +02:00
Andrew Ashikhmin
6060b87840
Fix binary vs raw confusion for PoS transaction (#4781)
* Replace PayloadMessage with Block

* RawTransactions -> BinaryTransactions for clarity

* add a log warning
2022-07-21 19:40:00 +02:00
Giulio rebuffo
1becfc509b
extra reset before starting change in rewind side fork (#4774)
* extra reset before starting change

* extra reset before starting change

Co-authored-by: giuliorebuffo <giuliorebuffo@system76-pc.localdomain>
2022-07-21 04:06:26 +02:00
Giulio rebuffo
7573a41069
fixed accumulator nil case (#4773)
Co-authored-by: giuliorebuffo <giuliorebuffo@system76-pc.localdomain>
2022-07-21 03:47:37 +02:00
Giulio rebuffo
73b028a5fd better payload cleanup (#4772)
Co-authored-by: giuliorebuffo <giuliorebuffo@system76-pc.localdomain>
2022-07-20 18:16:42 +02:00
Giulio rebuffo
d4f865d725
Added proper cleanup when we get notified of new height (#4753)
* added proper cleanup when we get notified of new height

* added extra cleanup

* removed bad if condition

* fixed hive tests

Co-authored-by: giuliorebuffo <giuliorebuffo@system76-pc.localdomain>
2022-07-19 22:31:15 +02:00
Giulio rebuffo
fb9f193349
fixed Two Block PoW Re-org to Higher-Height Chain (#4730)
Co-authored-by: giuliorebuffo <giuliorebuffo@system76-pc.localdomain>
2022-07-18 03:04:02 +02:00
Giulio rebuffo
8a754cd252
Added PoS download validation when applicable (#4728)
* added incomplete version of PoS download validation

* fixed stuff
2022-07-17 02:02:53 +02:00
Giulio rebuffo
6b6b74e034
removed code duplication (#4697) 2022-07-12 15:25:32 +02:00
Giulio rebuffo
b161c27ac3
optimized one db read (#4694) 2022-07-12 10:39:57 +02:00
Giulio rebuffo
51245d294f
Add PoS validator struct [Refactoring] (#4690)
* added fork_validor struct

* replaced occurences of hd with forkValidator

* added engineapi.validatorFork

* 32 blocks maxForkDepth

* removed useless if
2022-07-11 15:12:21 +02:00
Andrew Ashikhmin
daa84922d6
Commit transaction before responding on Engine API (#4506)
* Remove an unused interrupt value

* Remove sendErrResponse from safeAndFinalizedBlocksAreCanonical

* Clean up err handling

* startHandlingForkChoice returns response

* handleNewPayload returns response

* Commit transaction before responding on Engine API

* small fix

* Reply with SYNCING before long unwind

* schedulePoSDownload doesn't require requestStatus anymore
2022-06-20 23:03:17 +02:00
Andrew Ashikhmin
74a7d7c75a
Refactor PoS downloader (#3717)
* Remove blockHeight arg from FeedHeaderPoW

* Revert "Remove blockHeight arg from FeedHeaderPoW"

This reverts commit 9bf92921db11cd4e13386fcee29f30241d070fc6.

* Move PayloadMessage & ForkChoiceMessage to package engineapi

* RequestList instead of newPayloadCh & forkChoiceCh

* Introduce request status

* Send reply only when request status is New

* Move BeaconRequestList to HeaderDownload

* Don't SetFetching when PoS (Fetching means handling newBlockHashes)

* Merge Syncing & Synced into DataWasMissing

* Introduce SyncStatus

* onlyNew arg in WaitForRequest

* Move waitingForBeaconChain into RequestList

* Interrupt instead of skipCycleHack

* Introduce timeout for PoS headers

* Split downloadMissingPoSHeaders

* Move StartPoSDownloader into HeaderDownload

* Move Stopping interrupt to StartPoSDownloader

* Move stopping PayloadStatus back to HeadersPOS

* cleanUpPoSDownload

* Post-merge fix

* TestBogusForkchoice

* TestPoSDownloader

* requestStatus in attemptPoSDownload

* Broadcast in SetStatus

* Cosmetics

* attemptPoSDownload -> schedulePoSDownload

* Demote some logs to Trace
2022-03-22 17:49:12 +01:00