Commit Graph

112 Commits

Author SHA1 Message Date
Felix Lange
12df45662a
all: remove remaining uses of untyped golang-lru (#26194) 2022-11-17 11:15:28 +01:00
Jolly Zhao
f58ebd9696
all: use github.com/deckarep/golang-set/v2 (generic set) (#26159)
Co-authored-by: Felix Lange <fjl@twurst.com>
2022-11-14 15:16:52 +01:00
zhiqiangxu
2b65219550
consensus/ethash: fix typo (#26016)
fix typo
2022-11-01 14:39:39 +01:00
Felix Lange
b628d72766
build: upgrade to go 1.19 (#25726)
This changes the CI / release builds to use the latest Go version. It also
upgrades golangci-lint to a newer version compatible with Go 1.19.

In Go 1.19, godoc has gained official support for links and lists. The
syntax for code blocks in doc comments has changed and now requires a
leading tab character. gofmt adapts comments to the new syntax
automatically, so there are a lot of comment re-formatting changes in this
PR. We need to apply the new format in order to pass the CI lint stage with
Go 1.19.

With the linter upgrade, I have decided to disable 'gosec' - it produces
too many false-positive warnings. The 'deadcode' and 'varcheck' linters
have also been removed because golangci-lint warns about them being
unmaintained. 'unused' provides similar coverage and we already have it
enabled, so we don't lose much with this change.
2022-09-10 13:25:40 +02:00
Manoj Kumar
6fdc619413
consensus/ethash: remove temp files created during DAG generation (#25381)
This makes it remove not only the actual DAG file, but also the temporary file
which the DAG data is written to while generating.
2022-08-02 14:33:23 +02:00
lightclient@protonmail.com
0c6f81f888
all: remove version field from rpc.API 2022-06-27 12:39:46 +02:00
lightclient
119f955686
all: remove public field from rpc.API (#25059)
all: remove public field from rpc.API
2022-06-27 13:33:13 +03:00
Marius van der Wijden
d8f963811d
cmd, params: implement Gray Glacier hard-fork (EIP-5133) (#25088)
* cmd/geth, params: implement Gray Glacier (EIP-5133)

* cmd/evm: add gray glacier tests

* params: nitpicks

* params: fixes
2022-06-15 14:10:38 +03:00
lmittmann
bc013bc42e
all: prefer new(big.Int) over big.NewInt(0) (#25087)
minor performance improvement: `big.NewInt(0).Xxx` -> `new(big.Int).Xxx`
2022-06-14 15:09:48 +03:00
Håvard Anda Estensen
07508ac0e9
all: replace uses of ioutil with io and os (#24869) 2022-05-16 11:59:35 +02:00
John Difool
a52bcccfe1
consensus/ethash: fix typos in var names (#24745) 2022-04-26 10:16:57 +02:00
Eng Zer Jun
8d066f1f42
all: use T.TempDir to create temporary test directories (#24633)
This commit replaces ioutil.TempDir with t.TempDir in tests. The
directory created by t.TempDir is automatically removed when the test
and all its subtests complete.

Prior to this commit, temporary directory created using ioutil.TempDir
had to be removed manually by calling os.RemoveAll, which is omitted in
some tests. The error handling boilerplate e.g.

	defer func() {
		if err := os.RemoveAll(dir); err != nil {
			t.Fatal(err)
		}
	}

is also tedious, but t.TempDir handles this for us nicely.

Reference: https://pkg.go.dev/testing#T.TempDir
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-04-08 15:44:55 +02:00
Marius van der Wijden
4f4622bc8b
core: eth: implement Kiln-v2 spec (#24506)
* core/beacon: eth/catalyst: updated engine api to new version

* core: implement exchangeTransitionConfig

* core/beacon: prevRandao instead of Random

* eth/catalyst: Fix ExchangeTransitionConfig, add test

* eth/catalyst: stop external miners on TTD reached

* node: implement --authrpc.vhosts flag

* core: allow for config override on non-mainnet networks

* eth/catalyst: fix peters comments

* eth/catalyst: make stop remote sealer more explicit

* eth/catalyst: add log output

* cmd/utils: rename authrpc.host to authrpc.addr

* eth/catalyst: disable the disabling of the miner

* eth: core: remove notion of terminal pow block

* eth: les: more of peters nitpicks
2022-03-17 17:20:03 +02:00
jovijovi
b3b8b268eb
consensus: define MaxGasLimit as a const in params (#24092)
* consensus: use the maxGasLimit constant to check the header.GasLimit to avoid creating new variables repeatedly

* consensus: check the header.GasLimit by the public constant MaxGasLimit

* consensus: check the header.GasLimit by the constant MaxGasLimit
2021-12-14 10:17:25 +01:00
Martin Holst Swende
178debe435
consensus/ethash: avoid runtime errors due to OOD on mmap writes (#23799)
When we map a file for generating the DAG, we do a simple truncate to e.g. 1Gb. This is fine, even if we have nowhere near 1Gb disk available, as the actual file doesn't take up the full 1Gb, merely a few bytes. When we start generating into it, however, it eventually crashes with a unexpected fault address .

This change fixes it (on linux systems) by using the Fallocate syscall, which preallocates suffcient space on disk to avoid that situation. 


Co-authored-by: Felix Lange <fjl@twurst.com>
2021-11-02 11:33:54 +01:00
Martin Holst Swende
32150f8aa9
cmd/geth, cmd/evm, params: implement Arrow Glacier (EIP 4345) (#23810)
This PR adds support for ArrowGlacier, as defined by

    https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/arrow-glacier.md
    https://eips.ethereum.org/EIPS/eip-4345

> Starting with FORK_BLOCK_NUMBER the client will calculate the difficulty based on a fake block number suggesting to the client that the difficulty bomb is adjusting 10,700,000 blocks later than the actual block number.

This also adds support for evm t8n to return the calculated difficulty, so it can be used to construct test.
2021-10-28 22:18:14 +02:00
Marius van der Wijden
53b1420ede
params: changed CatalystBlock to TerminalTotalDifficulty (#23700)
* params: changed CatalystBlock to TerminalTotalDifficulty

* eth/catalyst: comment out unused code
2021-10-11 18:58:11 +03:00
baptiste-b-pegasys
523866c2cc
all: change blacklist terms 2021-07-29 11:17:40 +03:00
@edgararout
0730acc5a0
consensus/ethash: less allocation during mining (#23199) 2021-07-28 14:24:41 +02:00
Martin Holst Swende
94451c2788
all: implement EIP-1559 (#22837)
This is the initial implementation of EIP-1559 in packages core/types and core.
Mining, RPC, etc. will be added in subsequent commits.

Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
Co-authored-by: lightclient@protonmail.com <lightclient@protonmail.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
2021-05-17 15:13:22 +02:00
Martin Holst Swende
14bc6e5130
consensus/ethash: change eip3554 from 9.5M to 9.7M (#22870) 2021-05-17 10:49:23 +02:00
Péter Szilágyi
1cca781a02
Merge pull request #22840 from holiman/eip_3554
consensus/ethash: implement EIP-3554 (bomb delay)
2021-05-12 10:19:08 +03:00
Martin Holst Swende
ae5fcdc67f
go.mod: upgrade to github.com/holiman/uint256 v1.2.0 (#22745) 2021-05-10 12:29:33 +02:00
Martin Holst Swende
17b1be2661
consensus/ethash: implement EIP-3554 (bomb delay) 2021-05-07 14:04:54 +02:00
Péter Szilágyi
85a0bab6d7
Merge pull request #21467 from holiman/minor_ethashfix
consensus/ethash: less lookups of block data
2021-04-27 12:26:46 +03:00
Felix Lange
a3f0da1ac4
build: upgrade to golangci-lint v1.39.0 (#22696)
* build: upgrade to golangci-lint v1.39.0

* consensus/ethash: fix go vet warning regarding reflect.SliceHeader

* eth/catalyst: fix lint issue

* consensus/ethash: fix bug in memoryMapFile
2021-04-27 11:49:06 +03:00
Guillaume Ballet
d7bfb978ba
ethash: no block reward in catalyst mode (#22697) 2021-04-20 10:29:36 +02:00
Guillaume Ballet
f79cce5de9
eth/catalyst: add catalyst API prototype (#22641)
This change adds the --catalyst flag, enabling an RPC API for eth2 integration.
In this initial version, catalyst mode also disables all peer-to-peer networking.

Co-authored-by: Mikhail Kalinin <noblesse.knight@gmail.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
2021-04-16 21:29:22 +02:00
Evolution404
e275b1a293
consensus/ethash: replace a magic number with it's constant (#22618) 2021-04-06 21:02:52 +03:00
Péter Szilágyi
55300d4fdb
all: fix miner hashRate -> hashrate on API calls 2021-03-31 10:56:51 +03:00
Felix Lange
cae6b5527e
cmd/geth, consensus/ethash: add support for --miner.notify.full flag (#22558)
The PR implements the --miner.notify.full flag that enables full pending block
notifications. When this flag is used, the block notifications sent to mining
endpoints contain the complete block header JSON instead of a work package
array.

Co-authored-by: AlexSSD7 <alexandersadovskyi7@protonmail.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
2021-03-26 18:30:10 +01:00
jacksoom
d50e9d24be
consensus/ethash: remove unnecessary variable definition (#22512) 2021-03-19 12:04:15 +01:00
Guillaume Ballet
e74bd587f7
consensus: remove seal verification from the consensus engine interface (#22274) 2021-02-05 20:44:34 +02:00
ucwong
83e4c49e2b
trie : use trie.NewStackTrie instead of new(trie.Trie) (#22246)
The PR makes use of the stacktrie, which is is more lenient on resource consumption, than the regular trie, in cases where we only need it for DeriveSha
2021-02-02 13:09:23 +01:00
Martin Holst Swende
681618275c
core: speed up header import (#21967)
This PR implements the following modifications

- Don't shortcut check if block is present, thus avoid disk lookup
- Don't check hash ancestry in early-check (it's still done in parallel checker)
- Don't check time.Now for every single header

Charts and background info can be found here: https://github.com/holiman/headerimport/blob/main/README.md
With these changes, writing 1M headers goes down to from 80s to 62s.
2021-01-26 12:17:11 +01:00
Marius van der Wijden
2aaff0ad76
consensus/ethash: increase seal timeout for tests (#22162)
It seems that the 2 second timeout is not enough for Travis CI:

   --- FAIL: TestTestMode (2.00s)
       ethash_test.go:53: sealing result timeout
2021-01-13 11:44:20 +01:00
Mr-Leshiy
c49aae9870
consensus: refactor FinalizeAndAssemble to use Finalize (#21993) 2020-12-11 15:49:44 +01:00
Martin Holst Swende
efe6dd2904
consensus/ethash: implement faster difficulty calculators (#21976)
This PR adds re-written difficulty calculators, which are based on uint256. It also adds a fuzzer + oss-fuzz integration for the new fuzzer. It does differential fuzzing between the new and old calculators.

Note: this PR does not actually enable the new calculators.
2020-12-11 11:06:44 +01:00
Alex Prut
810f9e057d
all: remove redundant conversions and import names (#21903) 2020-11-25 21:00:23 +01:00
Preston Van Loon
844485ec6a
consensus/ethash: fix usage of *reflect.SliceHeader (#21372)
* consensus/ethash: only use *reflect.SliceHeader, not reflect.SliceHeader. See comment here: https://github.com/golang/go/issues/40397\#issuecomment-663748689

* consensus/ethash: pr feedback from @mdempsky, makes a copy of dest such that is not mutated

* consensus/ethash: remove noop assign

* consensus/ethash: apply same fix to another location

Co-authored-by: Péter Szilágyi <peterke@gmail.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
2020-11-17 11:35:58 +02:00
Slava Karpenko
d990df909d
consensus/ethash: use 64bit indexes for the DAG generation (#21793)
* Bit boundary fix for the DAG generation routine

* Fix unnecessary conversion warnings

Co-authored-by: Sergey Pavlov <spavlov@gmail.com>
2020-11-11 21:13:12 +01:00
Martin Holst Swende
81ff700077
consensus/ethash: fix the percentage progress report 2020-11-09 11:56:29 +01:00
gary rong
87c0ba9213
core, eth, les, trie: add a prefix to contract code (#21080) 2020-08-21 15:10:40 +03:00
Martin Holst Swende
493100ba4d
consensus/ethash: less lookups of block data 2020-08-21 13:55:39 +02:00
gary rong
28c5a8a54b
les: implement new les fetcher (#20692)
* cmd, consensus, eth, les: implement light fetcher

* les: address comment

* les: address comment

* les: address comments

* les: check td after delivery

* les: add linearExpiredValue for error counter

* les: fix import

* les: fix dead lock

* les: order announces by td

* les: encapsulate invalid counter

* les: address comment

* les: add more checks during the delivery

* les: fix log

* eth, les: fix lint

* eth/fetcher: address comment
2020-07-28 18:02:35 +03:00
meowsbits
befecc9fdf
consensus/ethash: fix flaky test by reading seal results (#21085) 2020-05-25 18:01:03 +02:00
Hanjiang Yu
8f05cfa122
cmd, consensus: add option to disable mmap for DAG caches/datasets (#20484)
* cmd, consensus: add option to disable mmap for DAG caches/datasets

* consensus: add benchmarks for mmap with/with lock
2020-03-31 11:44:04 +03:00
Guillaume Ballet
c49a4165d0 consensus/ethash: fix a typo and error message (#20503) 2020-01-07 18:19:21 +01:00
Martin Holst Swende
bc01593afb consensus/ethash, params: eip-2384: bump difficulty bomb (#20347)
* consensus/ethash, params: implement eip-2384: bump difficulty bomb

* params: EIP 2384 compat checks

* consensus, params: add Muir Glacier block number (mainnet,ropsten) + official name

* core/forkid: forkid tests for muir glacier

* params/config: address review concerns

* params, core/forkid: review nitpicks

* cmd/geth,eth,les: add override option for muir glacier

* params: nit fix
2019-12-06 11:36:40 +02:00
Felix Lange
a91b704b01
consensus/ethash: refactor remote sealer (#20335)
The original idea behind this change was to remove a use of the
deprecated CancelRequest method. Simply removing it would've been an
option, but I couldn't resist and did a bit of a refactoring instead.

All remote sealing code was contained in a single giant function. Remote
sealing is now extracted into its own object, remoteSealer.
2019-11-28 10:51:57 +01:00