Commit Graph

304 Commits

Author SHA1 Message Date
battlmonstr
c8a25d0226
Refactor getting chain info by chain name. (#3635)
* get chain config, genesis hash and network ID by chain name in params/config
* get genesis block chain name in core/genesis
2022-03-03 21:57:10 +07:00
ledgerwatch
17b2a9ba93
Bor fixes (#3553)
* Integration to work with bor

* Turn off validator set check

* disable verifySeal, add skeleton of postExec stage

* Pass around syscall

* Print

* Print more

* Default heimdall values for integration

* restore contract

* Print

* Print

* Print

* Print

* Print

* Print

* Print

* Print

* Fix nonce of system contract

* Remove prints

* Revert some more printing

* More fixes

* Print log

* Fix transfer log

* More printing

* More printing

* Print

* Print

* Print

* Print

* Print

* Print

* Print

* Fix validaor reward

* Remove printing

* Remove more prints

* Less printing

* Fetch validators from heimdall

* Remove syscall from Seal and CalcDifficulty

* Remove syscall from Prepare

* Print

* Remove DNS discovery

* Print apply snapshot

* Print

* Chunk up snapshot generation

* Chunk up snapshot generation

* Better logs when snapshotting

* Handle parents

* Prevent shadowing of snap

* Fix heimdall fetch

* Logging fixes

* Save generated snapshots

* Add header

* Less logging

Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro.local>
2022-02-24 00:03:10 +00:00
battlmonstr
e6c056e666
Rename Datadir/dataDir to follow conventions. (#3576)
* rename from Datadir to DataDir (functions and public vars)
* rename dataDir to datadir (local variables)
2022-02-22 17:39:48 +00:00
ledgerwatch
78974d7844
Fix for BSC incorrect execution (#3560)
* Fix for BSC incorrect execution

* collect skip analysis

Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
2022-02-21 12:42:23 +00:00
Enrique Jose Avila Asapche
e348b3ea93
deleted kovan (#3546) 2022-02-19 08:15:44 +00:00
Alex Sharov
226982d293
Use class dir.Rw - to separate Ro and Rw access to snapshotDir (#3534)
* save

* save

* save

* save

* save

* save

* save
2022-02-18 09:24:17 +07:00
Alex Sharov
c9cee7a884
path -> filepath (path package is for urls) (#3493) 2022-02-12 20:33:09 +07:00
Jared Doro
0223489183
[WIP] Adding Support for Sepolia (#3462)
* [WIP] Adding Sepolia

* Fix formatting

* Added Timestamp to Sepolia genesis

* update config

* fixed formating
2022-02-10 07:27:36 +00: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
Enrique Jose Avila Asapche
35fcd3a829
Merging Turbo bor into devel (#3372)
* implemented bor consensus

* add bor flags to default

* change bucket into snapshot to clique

* enable stateSync

* bypass reciept checks

* fix receipt calculation and bor logs

* fix: contract call wrt bor

* Update mumbai config

* Add: bor-mainnet flag and config

* Add bor consensus to integration

* use header coinbase in block context

* london fork mumbai changes

* fix genesis error

* Jaipur fork for mumbai

* add sysCall to verifyHeader

* added bor related rpc method implementation

* added bor specific rpc extensions

* fixes in snapshot implementation, major refactor for bor rpc

* modify consensus specific db path for bor

* fix: remove parallel compute for get root hash rpc method

* Added bor-receipt flow

* Use turbo-bor-lib and bor tables

* Use bor table in RPC snapshot

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* update rpc readme

* link rpc docs in readme

* Update Readme

* Update Readme

* move erigon namespace rpc methods to eth

* rm: erigon namespace

* rm: erigon namespace, update list of available rpc methods, add example

* fix: binary name in rpc readme

* fix: max db size

* Add london to bor-mainnet

* updated node.go

* add system req to readme

* golang version fix readme

* added networknames in correct place

* nil

* ran gofmt

* erigon

* fixed fake.go

* dont need turbor-lib

* old readme

* fixing readme

* half

* other half

* changed return

* fixing return

* fixed return

* fixed flags

* gofmt

* merge with devel

* latest erigon-lib

* fixed context.coinbase

* took out syscall

* fixed params in hash

* bor type now is consensus.Engine

* parlia is consensus.Engine

* missing arg and repeated importation

* repeated importation

* fixed eth_receipts.go

* deleted duplicate issuance

* part of consensus.Engine type

* added eth_api issuance

* networkname

* added erigon_system file

* fork struct taken out

* added erigon block

* getLogByHash for erigonImpl

* gofmt

* fixed lint

* ops

* gofmt

* gofmt

* added APIImple functions

* fixed clique test

* took out print

* fixed state added balance

* fixed README

* fixed rpcDaemon README

* fixed integration README

* updated blockchain.go

* lint

* added bor back into blockchain.go

* took out comment

* lint

* updated daemon

* updated wtb

* removed duplicate

* removed VerifyHeaders

* prevent use of wrong Transfer

* fixed state_processor.go

* fixed state_transition.go

* fixed headers

* returning err

* error handling in bor read tx look up

* put for txLookUp

* dealing with error

* lint

* traces

* more traces

* fixed receipt in execution

* getTrasanction receipt for bor or others

* nil

* lint

* ops

* deleted syscall

* took out else

* Merge branch 'devel

* tests syscalls

* changed borReceipt to receipt

* reset header algos

* arguments fix

* took out prefixes

* lint

* erigon-named

* borReceiptKey = blocknumber

* reverts e3b60c2e159d03efcb855f7ab3da5a098dd60c33.

* correct hashing tx

* dont need it here

* lint

* added txlookup for bor

* change to uint256

* outputs for isBor

* wrapper

* added isBor and isParlia

* isBor

* fixed BorTransfer

* not readBody

* correct prefix

* added blockNum

* added readStorageBody

* readStorageBody

* lint

* got rid of unnecessary bor_receipt func

* onlny if bor

* use clone

* append

* writeToSlice

* added isBor flag

* fixed writeToSlice

* normal sorting

* lint

* Reset erigon-snapshots

* Move bor prefix into if

Co-authored-by: Krishna Upadhyaya <krishnau1604@gmail.com>
Co-authored-by: Manav Darji <manavdarji.india@gmail.com>
Co-authored-by: Uttam Singh <uttamkhanduja@yahoo.in>
Co-authored-by: Giulio Rebuffo <giulio.rebuffo@gmail.com>
Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro.local>
2022-02-07 21:30:46 +00:00
Alex Sharov
304b40dd0a
Snapshot: prohibit to change cli flags (#3311) 2022-01-22 11:18:24 +07:00
Alex Sharov
6fd002eb5a
Snapshot: move old blocks to snapshots (non-async version) (#3309)
* save

* save
2022-01-20 12:01:02 +07:00
Alex Sharov
1e3228124a
Move cli root context to erigon-lib (#3294)
* save

* save

* save
2022-01-19 10:49:07 +07:00
Andrew Ashikhmin
f141803661
No need for ApplyBinanceSmartChainEIPs (#3282) 2022-01-18 13:43:21 +00:00
Dmitry Savonin
a49d409457
Full BSC support with validator mode (#3233)
* migrated consensus and chain config files for bsc support

* migrated more files from bsc

* fixed consensus crashing

* updated erigon lib for parlia snapshot prefix

* added staticpeers for bsc

* [+] added system contracts
[*] fixed bug with loading snapshot
[+] enabled gas bailout
[+] added fix to prevent syncing more than 1000 headers (for testing only)
[*] fixed bug with crashing sender recover sometimes

* migrated system contract calls

* [*] fixed bug with returning mutable balance object
[+] migrated lightclient contracts from bsc
[*] fixed parlia consensus config param

* [*] fixed tendermint deps

* [+] added some logs

* [+] enabled bsc forks
[*] fixed syscalls from coinbase
[*] more logging

* Fix call sys contract gas calculation

* [*] fixed executing system transactions

* [*] enabled receipt hash, gas and bloom filter checks

* [-] removed some logging scripts
[*] set header checkpoint to 10 million blocks (for testing forks)

* [*] fixed bug with commiting dirty inter block state state after system transaction execution
[-] removed some extra logs and comments

* [+] added chapel and rialto testnet support

* [*] fixed chapel allocs

* [-] removed 6 mil block limit for headers sync

* Fix hardforks on chapel and other testnets

* [*] fixed header sync issue after merge

* [*] tiny code cleanup

* [-] removed some comments

* [*] increased mdbx map size to 4 TB

* [*] increased max chaindata size to 6 tb

* [*] bring more compatibility with origin erigon and some code cleanup

* [+] added support of validator mode for BSC chain

* [*] enable private key load for bsc, rialto and chapel chains

* [*] fixed running BSC validator node

* Fix the branch list

* [*] tiny fixes for linter

* [*] formatted imports for core and parlia packages

* [*] fixed import rules in other files

* Revert "[*] formatted imports for core and parlia packages"

This reverts commit c764b58b34fedc2b14d69458583ba0dad114f227.

* [*] changed import rules in more packages

* [*] fixed type mismatch in hack command

* [*] fixed crash on new epoch, enabled bootstrap flags

* [*] fixed linter errors

* [*] fixed missing err check for syscalls

* [*] now BSC implementation is fully compatible with erigon original sources

* Revert "Add chain config and CLI changes for Binance Smart Chain support (#3131)"

This reverts commit 3d048b7f1a.

* Revert "Add Parlia consensus engine for Binance Smart Chain support (#3086)"

This reverts commit ee99f17fbe.

* [*] fixed several issues after merge

* [*] fixed integration compilation

* Revert "Fix the branch list"

This reverts commit 8150ca57e5f2707a84a9f6a1c5b809b7cc84547b.

* [-] removed receipt repair migration

* [*] fixed parlia fork numbers output

* [*] bring more devel compatibility, fixed bsc address list for access list calculation

* [*] fixed bug with commiting state transition for bad blocks in BSC

* [*] fixed bsc changes apply for integration command and updated config print for parlia

* [*] fixed bug with applying bsc forks for chapel and rialto testnet chains
[*] let's use finalize and assemble for mining to  let consensus know for what it's finalizing block

* Fix compilation errors in hack.go

* Fix lint

* reset changes in erigon-snapshots to devel

* Remove unrelated changes

* Fix embed

* Remove more unrelated changes

* Remove more unrelated changes

* Restore clique and aura miner config

* Refactor interfaces not to use slice pointers

* Refactor parlia functions to return tx and receipt instead of dealing with slices

* Fix for header panic

* Fix lint, restore system contract addresses

* Remove more unrelated changes, unify GatherForks

Co-authored-by: Dmitry Ivanov <convexman18@gmail.com>
Co-authored-by: j75689 <j75689@gmail.com>
Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro.local>
2022-01-14 19:06:35 +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
Andrew Ashikhmin
d14c223881
Simplify miner gas limit post EIP-1559. Default to 30M (#3205) 2022-01-05 16:36:24 +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
Alex Sharov
156287a982
Sanity check p2p block (#3197) 2022-01-04 15:46:22 +07:00
brendan-kelly
3d048b7f1a
Add chain config and CLI changes for Binance Smart Chain support (#3131)
* Add chain config and CLI changes for Binance Smart Chain support

* Remove BSC hashes for now

* Add an if statement for BSC forks

* Fix up if statement

* Compiles

* Remove extra dependencies from go.mod/go.sum

* Add a TODO

* Potentially fix the tests
2021-12-16 07:26:44 +00:00
Alex Sharov
ecb10e8548
Snapshots download and seed (#3117)
* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* Squashed 'interfaces/' content from commit e5b1945d0

git-subtree-dir: interfaces
git-subtree-split: e5b1945d02da7a7f00e2289034ee90a6edd60184

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save
2021-12-14 10:13:17 +00:00
brendan-kelly
ee99f17fbe
Add Parlia consensus engine for Binance Smart Chain support (#3086)
* Add Parlia consensus engine for Binance Smart Chain support

* Leave RamanujanBlock as nil in params/config.go

* Run `go fmt` on files needing it

* Add comment for PoSA

* Remove empty branches and ineffectual assignments in parlia.go

* Remove commented imports

* Fix compilation error

* Remove EIP155Signer in transaction_signing.go

* Fix compilation issue

* Fix go fmt issues

* Remove Ramanujan from print statement

* Remove references to EthAPIBackend approach

* Fix Finalize method across consensus engines

* Run go fmt

* More linting

* Remove more changes

* remove a comment

* Remove unneeded hashing function

* Remove bytes check and fix actual vs expected mistake
2021-12-11 00:07:10 +00: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
Alex Sharov
178fd1931d
Genesis sync from existing snapshots (#3087) 2021-12-05 09:03:08 +07: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
Giulio rebuffo
d7ee2b1447
Merge pull request #2997 from ledgerwatch/enginev1
Added ExecutePayloadV1 to engine_ namespace [the merge]
2021-11-30 19:21:17 +01:00
ledgerwatch
feebc7d3e6
save (#3059) (#3060)
Co-authored-by: Alex Sharov <AskAlexSharov@gmail.com>
2021-11-30 12:36:01 +00:00
Giulio Rebuffo
e76bc807bb better api 2021-11-29 15:47:08 +01:00
Giulio rebuffo
cfed35921c
Merge branch 'devel' into enginev1 2021-11-29 09:57:56 +01:00
TBC Dev
57d641b6f9
Avoid redundant Block.Header() deep-copy (#3050)
* Add separate Block.Nonce() and Block.NonceU64()

* Add Block.Seal()

* Avoid redundant Block.Header() deep-copy

* Add warning comment for Block.Header()
2021-11-29 08:52:36 +00:00
Alex Sharov
8104a90993
Snapshot: exec and trie to support snapshot files (#3033) 2021-11-29 10:43:19 +07: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
alex.sharov
726278fd8a save 2021-11-24 10:55:25 +07:00
Alex Sharov
6d24a30a01
Drop txpool v1 (#3017)
* drop_txpool_v1

* drop_txpool_v1

Co-authored-by: Alex Sharp <alexsharp@alexs-macbook-pro.home>
2021-11-22 18:38:51 +00:00
TBC Dev
e1c44cd19b
Change sentry peer_id from H512 pubkey to H256 keccak256(pubkey) (#3013)
* Rename protoHandshake.ID to protoHandshake.Pubkey

* Fix enode.ID comment descriptions

* Change sentry peer_id from H512 pubkey to H256 keccak256(pubkey)

* Simplify PeerInfo helpers
2021-11-22 05:39:31 +00:00
Alex Sharov
5b634a790e
Canonical tx ids (#2986)
* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save
2021-11-18 14:07:55 +00:00
Giulio rebuffo
e6916d4d00
[EIP-4399 2/3] Added total difficulty stage and transition logic (#2964)
* added diff stage

* added td stage

* improvements + more tests

* added err check

* added err check

* transition raw interfaces

* interface for transition

* unwind updates

* maybe this fix

* now fixed?

* fixes

* better db-format

* better db-format

* sum and mod

* sum and mod

* fixed headers unwind
2021-11-17 15:50:41 +00:00
alex.sharov
5d0f081a9c save 2021-11-04 15:45:55 +07:00
Alex Sharov
702631bf6f
prohibit change prune mode (#2908) 2021-11-03 20:05:52 +07:00
e-danko
c970261ac9
switched Fermion to Clique (#2823)
* switched Fermion to Clique

* Update Fermion to Clique: updated genesis block hash
2021-10-13 17:51:45 +03:00
Alex Sharov
2d64584d4f
Better prune logs (#2812) 2021-10-11 11:58:57 +07:00
alex.sharov
74168d9426 remove debug prints 2021-10-06 14:05:22 +07:00
Alex Sharov
a6a63e8b0e
Integration to print right stage in logs (#2785) 2021-10-06 14:02:50 +07:00
Alex Sharov
21785780bf
IntermediateHash stage - switch from incremental to re-generate mode - if jump > 100K blocks (#2781) 2021-10-05 15:32:18 +07:00
Alex Sharov
de16cb9e23
add logs in recoverFromDb func (#2769) 2021-10-04 19:46:05 +07:00
e-danko
0c93c314d4
added Fermion network (#2737) 2021-09-29 08:35:43 +07:00
e-danko
7d338f5e1c
#2660: added Kovan network (#2733) 2021-09-27 19:56:17 +07:00
Alexandr Borodulin
d7159cd8bd
More convenient pruning for non-PoW consensus: add --prune.*.before flags (#2714) 2021-09-23 09:13:19 +07:00
Alex Sharov
787ec652a0
Sender check read from db (#2717) 2021-09-22 11:57:09 +07:00