Commit Graph

717 Commits

Author SHA1 Message Date
Andrew Ashikhmin
37ccbc53d6
Refactor payload building (#3592)
* Bump MaxPendingPayloads

* UnknownPayload error

* Improve ExchangeTransitionConfigurationV1 comment

* Extract MakeEmptyHeader

* Move MakeEmptyHeader to chain_makers

* Start with empty block as pending payload

* Only build payloads with the right parent hash

* Double check parent hash in SpawnMiningCreateBlockStage

* Simpler error formatting

* ReadHeadBlockHash instead of ReadHeadHeaderHash

* Avoid rebuilding already built blocks

* getPayload should stop the build process

* Tweaking stageLoopIsBusy

* Don't update pending payload after engine_getPayload
2022-02-23 21:27:38 +01:00
Andrew Ashikhmin
980276c322
Fix coinbase in stage_mining_exec (#3564)
* Simplify TerminalBlockHash & TerminalBlockNumber

* Simplify FeedHeaderPoS

* More accurate comment

* Relax TerminalBlockHash check

* Extract the sleep hack into stageLoopIsBusy

* Several short naps instead of a single longish sleep

* Fix coinbase in stage_mining_exec

* More orthodox loop

* typo in comment
2022-02-21 18:05:39 +01:00
Giulio rebuffo
7f596e16b3
added sleep (#3561) 2022-02-21 14:45:10 +01:00
Alex Sharov
3de83e2d96
RPCDaemon: to start with disabled txpool (#3539) 2022-02-18 09:45:20 +07:00
Andrew Ashikhmin
0701c83222
Fix stall on unwind in handleForkChoice (#3536)
* ReadHeader instead of ReadHeaderByHash

* Add Engine API to rpcdaemon README

* Fix nil pointer dereference in HandlePendingBlock

* Fix latestValidHash JSON

* Delete GetPayloadBodiesV1

* Break infinte unwind loop in handleForkChoice

* More logging
2022-02-17 18:30:57 +01:00
ledgerwatch
dffcc57ecc
[erigon2] Fix history bug, optimise bitmap search (#3510)
* Fix history bug, optimise bitmap search

* Optimise SeekInBitmap64

* Update erigon-lib

Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
2022-02-13 20:02:18 +00:00
Andrew Ashikhmin
fe9f841172
Add Beacon payloads to body downloader prefetch (#3482)
* Block instead of PayloadMessage

* tx.MarshalBinary instead of rlp.Encode in StartProposer

* Add Beacon payloads to body downloader prefetch

* Restore PayloadMessage
2022-02-11 13:24:29 +01:00
Alex Sharov
e695a6e58b
state and newHead: 1 goroutine per subscriber (#3452) 2022-02-10 08:25:58 +07:00
Andrew Ashikhmin
8466cb1b7b
New Engine API semantics (Kiln v1) (#3340)
* Disable PoS sync temporarily

* Resore PoS sync

* Handle Ctrl^C in HeadersPOS

* Consistent naming

* Extract verifyAndSavePoSHeader & downloadMissingPoSHeaders

* Preparation for EngineForkChoiceUpdated re-orgs

* Extract ForkingPoint

* Comments

* New proto for Engine API

* EngineExecutePayload -> EngineNewPayload

* Return INVALID_BLOCK_HASH if block hash is invalid

* Return EngineStatus_ACCEPTED for side chain blocks

* Update erigon-lib (PR 268)

* Fix payload2Hash

* reverseDownloadCh -> beaconPayloadCh

* Update erigon-lib

* Engine API updated

* ExecutionStatus -> PayloadStatus

* Introduce forkChoiceCh

* Mock ForkChoiceMessage/PayloadStatus

* Add ValidationError to PayloadStatus

* Small clean-ups

* Add INVALID_TERMINAL_BLOCK to EngineStatus

* Add a comment

* Extract handleNewPayload & handleForkChoice

* Partially implement handleForkChoice

* Update erigon-lib

* short vs long re-org

* Move header insertion out of downloadMissingPoSHeaders

* Update erigon-lib

* Refactor ProcessSegmentPOS

* Fix imports

* Wire downloadMissingPoSHeaders into handleForkChoice

* evictOldPendingPayloads

* nolint:unused for assertSegment

* Try nolint instead of nolint:unused

* Small comment improvements

* HeadHeaderHash/StageProgress in handleForkChoice

* TODO: bodyDownloader.AddToPrefetch(block)

* Review call suggestions

* Don't use ReadHeaderNumber in ProcessSegmentPOS

* Don't leave ethbackend waiting when server is stopping

* Update erigon-lib

* More explicit signature of downloadMissingPoSHeaders
2022-02-09 08:33:22 +01:00
Giulio rebuffo
1602842a63
fixed api.blockWithSenders (#3435)
* fix

* fix 2

* fixed api.blockWithSenders

* removed white space

* pretty
2022-02-05 19:11:56 +00:00
Alex Sharov
304b40dd0a
Snapshot: prohibit to change cli flags (#3311) 2022-01-22 11:18:24 +07:00
Enrique Jose Avila Asapche
ffedd6ac3f
Enabled proposer by default (#3319) 2022-01-21 22:50:34 +03:00
e-danko
d0123f52fd
Starknet grpc (#3312)
* created starknet_call method

* updated erigon lib

* updated erigon lib

* lint issues
2022-01-20 15:34:00 +00:00
Andrew Ashikhmin
c2d0f0082a
Report Valid ExecutionStatus only after all stages (#3212)
* Stricter transition check

* EthBackendServer.numberSent was unused

* Take account of PoS blocks in TopSeenHeight

* Report Valid ExecutionStatus only after all stages, not straight in headers

* Print TTD on startup

* No need to check parent.Hash() again

* core: change baseFee into baseFeePerGas in genesis json

* fix typo

Co-authored-by: Martin Holst Swende <martin@swende.se>
2022-01-07 16:54:26 +01:00
Alex Sharov
4ef541f5dc
Snapshots: tx lookup in RPC from snapshots (#3214) 2022-01-07 20:52:38 +07:00
Giulio rebuffo
195eb9abaa
Added mining for POS (#3187)
* added comunication with channels

* added final mining

* removed trash

* bug fixing

* async calls

* one thread

* tests

* better comments

* no lock

* better placing of skipCycleHack

* removed long timer

* moved transitioned block processing

* better naming

* disabled updates on blocks

* sync.Cond

* 2 sync.Cond

* better locking

* Use single sync.Cond. Proposer shutdown

Co-authored-by: yperbasis <andrey.ashikhmin@gmail.com>
2022-01-04 18:37:36 +01:00
Giulio rebuffo
864b744ed2
Support for syncing on mergemock (#3174)
* block proposing

* standard finalized

* mergemock execution

* private chain can now be ran yay

* perfectioned

* polished

* more polishing

* resize PR

* resize PR

* resize PR

* simplifications

* fixed tests

* better syncronous communication

* better syncronous once again

* clean

* Re-enabled headers verification

* mining finish

* mining finish

* cleaned hash computation

* fixed evm bug

* go.mod

* Update .gitignore

* Update .gitignore

* Update .gitignore

* removed new line from .gitignore

* added go.mod and go.sum

* feeRecipient into preset

* useExternal

* todo

* fixed comment for forkchoiceUpdateV1

* smaller

* smaller

* Revert changes to miner frequency

* Restore useExternalTx

* Fix headerLoadFunc

* do not reset payloadId

* rename

* extra is empty

Co-authored-by: yperbasis <andrey.ashikhmin@gmail.com>
2021-12-29 17:25:13 +01:00
Andrew Ashikhmin
445ac05220
Verify PoS headers before inserting them into DB (#3151)
* Remove TotalDifficulty stage

* Introduce FeedHeaderFuncType

* Some TODOs

* Don't gossip PoS headers

* FeedHeaderPoS

* Call header.Hash once

* Use FeedHeaderPoS for to write PoS header

* Support errors in EngineExecutePayloadV1

* useExternalTx boilerplate

* Call VerifyHeader on PoS header

* latestValidHash must be nil when status is SYNCING

* fixCanonicalChain instead of canonicalHeadersCollector

* engine.VerifyHeader + FeedHeaderPoS as headerLoadFunc

* fix daemon

Co-authored-by: Giulio Rebuffo <giulio.rebuffo@gmail.com>
2021-12-23 15:06:10 +01:00
Andrew Ashikhmin
cfb35633ad
Make waitingPosHeaders atomic since it's accessed concurrently (#3157) 2021-12-22 17:12:35 +01:00
Giulio rebuffo
23b3c1d9bc
Added reversed for proof-of-stake syncing (#3092)
* reverse sync slow but working

* progress

* p

* close request

* backwards refactoring

* cleanup 1

* added RequestAssembler

* remove trash code and spaghetti

* efficient

* fix

* refactor

* tf

* refact

* final refactoring

* headers forward restored

* test fixed

* make CI happy

* resolved comments

* not using insertList anymore

* oops

* better collectors

* removed debug config

* avoid pointers

* added sleep

* use of channels

* sleeping

* added logs for ETL

* added more cleanup

* correct glacier

* some refactoring

* maxRequests

* tweaks

* config.go

* config conflicts

* renamed functions
2021-12-13 17:46:15 +01:00
primal_concrete_sledge
d89e5d2603
Issue/2710 add grpc health check (#3091)
* ISSUE-2710: Add standard grpc health check to services with grpc server

* Go import changed files

* Add flags for healthcheck

* Add grpc healthcheck option to rpcdaemon

* Remove grpc port info if grpc is not enabled

* Resolve merge issues
2021-12-06 12:03:46 +00:00
Giulio rebuffo
3c95db0078
Fixed Proof-of-stake transition (#3075)
* added download channel to stage headers

* added direct execution

* now channel of headers rather than bodies

* simplifications

* fixed ttd headerForward

* garbage removed

* added some more stepping stones

* better transition

* covered edge case

* added names to returned values

* clean
2021-12-03 11:55:00 +01:00
ledgerwatch
b01df0f795
Bump EthBackend API to 3.0.0 in devel branch only to make it explicitly incompatible with stable (#3077) 2021-12-02 13:40:48 +00:00
Andrew Ashikhmin
094ab5e77d
[EIP-4399] Remove newly added Header.Random (reuse mixHash instead) (#3069)
* [EIP-4399] Remove newly added Header.Random (reuse mixHash instead)

* add a TODO

* Update mock payload hashes
2021-12-01 13:41:31 +01:00
Dmitry Savelev
d4f6ceff1c
Add NodeInfo implementation (#3046)
* Add NodeInfo implementation

* replace magic value with a constant.

* update dependencies

* bump minor version

* add nodes deduplication logic.

* shuffle values in test cases a little.
2021-11-30 22:42:12 +00:00
Giulio Rebuffo
8ee29ee0d1 clear test 2021-11-30 18:43:46 +01:00
Giulio Rebuffo
50dbf1fc33 lint 2021-11-30 18:24:20 +01:00
Giulio Rebuffo
b9018db353 comment 2021-11-30 18:14:34 +01:00
Giulio Rebuffo
5e9bf095c8 enum 2021-11-30 18:13:34 +01:00
Giulio Rebuffo
021aa1da08 lock 2021-11-29 15:58:46 +01:00
Giulio Rebuffo
e76bc807bb better api 2021-11-29 15:47:08 +01:00
Giulio Rebuffo
0c9e5cd513 fixed unit tests 2021-11-27 16:29:46 +01:00
Giulio Rebuffo
6866eec31f added transition checks 2021-11-26 23:03:47 +01:00
Giulio Rebuffo
6bffeb8f5f better notation 2021-11-26 19:47:23 +01:00
Giulio Rebuffo
dbfa51960c added downloader unit tests 2021-11-26 14:51:32 +01:00
Giulio Rebuffo
7c60126347 added unit tests for simple execution 2021-11-26 11:59:05 +01:00
Giulio Rebuffo
f1ca526e33 lint 2021-11-24 23:37:26 +01:00
Giulio Rebuffo
768617f412 added proper errors 2021-11-24 23:19:40 +01:00
Giulio Rebuffo
435d1d1519 channels implemented 2021-11-24 23:00:00 +01:00
Giulio Rebuffo
ddb01b6314 ? 2021-11-22 18:39:23 +01:00
Giulio Rebuffo
bac85f854b added getPayloadV1 2021-11-22 16:12:34 +01:00
Giulio Rebuffo
c05e3a9fa1 connected to daemon 2021-11-22 11:36:52 +01:00
Giulio Rebuffo
21cbc19f21 using batch over tx 2021-11-21 23:11:50 +01:00
Giulio Rebuffo
1267d540b1 added engine_executePayloadV1 2021-11-21 22:47:33 +01:00
Giulio Rebuffo
23883d9104 merge 2021-11-21 21:55:41 +01:00
Giulio Rebuffo
4eb650fb0c payload manipulation 2021-11-21 21:52:36 +01:00
Alex Sharov
e55256296b
snapshots: read block from snapshots, add sender to txs file (#2996) 2021-11-21 10:32:14 +07:00
Giulio Rebuffo
6dd2d67121 Added ExecutePayloadV1 method to engine_ namespace 2021-11-20 22:53:03 +01:00
Giulio Rebuffo
224441cb07 initial commit2 2021-11-20 17:27:11 +01:00
Alex Sharov
aad0d0c777
grpc GetBlock api (#2955) 2021-11-14 11:08:52 +07:00