Marius van der Wijden
87bb5db675
core: allow external processor ( #25233 )
2 years ago
Marius van der Wijden
5f6e870ee6
core: apply ttd override to uninitialized db ( #25136 )
...
* core: apply ttd override to genesis block
* core: apply overrides properly
2 years ago
Marius van der Wijden
e537193421
core: allow external code to set the block validator for malicious tests ( #25119 )
...
* core: don't validate state
* core: allow external validator
* core: revert
* core: comments
* Update blockchain_reader.go
* core: move SetValidator to blockchain.go
* core: rename method
2 years ago
Seungbae.yu
2697e44d81
all: change format `0x%x` to `%#x` ( #25221 )
2 years ago
Marius van der Wijden
d12b1a91cd
consensus/beacon: check that only the latest pow block is valid ttd block ( #25187 )
...
* consensus/beacon: check that only the latest pow block is valid ttd block
* consensus/beacon: move verification to async function
* consensus/beacon: fix verifyTerminalPoWBlock, add test cases
* consensus/beacon: cosmetic changes
* consensus/beacon: apply karalabe's fixes
2 years ago
aaronbuchwald
300f6121ad
core/rawdb: simplify TestDiskSeek to use memorydb ( #25182 )
2 years ago
Ruohui Wang
3f712e7447
core/rawdb: fix typo in comment ( #25191 )
2 years ago
aaronbuchwald
68420e1aa5
core: fix typo in txpool ( #25149 )
...
Fix typo in txPool truncateQueue comment
2 years ago
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
2 years ago
lmittmann
bc013bc42e
all: prefer `new(big.Int)` over `big.NewInt(0)` ( #25087 )
...
minor performance improvement: `big.NewInt(0).Xxx` -> `new(big.Int).Xxx`
2 years ago
Martin Holst Swende
a907d7e81a
all: more linters ( #24783 )
...
This enables the following linters
- typecheck
- unused
- staticcheck
- bidichk
- durationcheck
- exportloopref
- gosec
WIth a few exceptions.
- We use a deprecated protobuf in trezor. I didn't want to mess with that, since I cannot meaningfully test any changes there.
- The deprecated TypeMux is used in a few places still, so the warning for it is silenced for now.
- Using string type in context.WithValue is apparently wrong, one should use a custom type, to prevent collisions between different places in the hierarchy of callers. That should be fixed at some point, but may require some attention.
- The warnings for using weak random generator are squashed, since we use a lot of random without need for cryptographic guarantees.
2 years ago
Gustavo Silva
eb94896270
Chore: Minimal gramatical errors (signleton -> singleton) ( #25057 )
...
core: fix typos
2 years ago
int88
594e321662
core/evm: fix error in comment ( #25040 )
...
Co-authored-by: Martin Holst Swende <martin@swende.se>
3 years ago
henridf
f5037185aa
core/types: improve LogForStorage and ReceiptForStorage comments ( #25032 )
...
Co-authored-by: Felix Lange <fjl@twurst.com>
3 years ago
Rajaram Gaunker
6160296445
core/types: remove unused field 'td' in Block ( #25010 )
3 years ago
Péter Szilágyi
41e75480df
eth, les, params: log chain config a bit saner ( #24904 )
...
Previously on Geth startup we just logged the chain config is a semi-json-y format. Whilst that worked while we had a handful of hard-forks defined, currently it's kind of unwieldy.
This PR converts that original data dump and converts it into a user friendly - alas multiline - log output.
3 years ago
rjl493456442
22defa5af7
all: introduce trie owner notion ( #24750 )
...
* cmd, core/state, light, trie, eth: add trie owner notion
* all: refactor
* tests: fix goimports
* core/state/snapshot: fix ineffasigns
Co-authored-by: Martin Holst Swende <martin@swende.se>
3 years ago
Martin Holst Swende
c375ee91e9
cmd/geth, core/state/snapshot: rework journal loading, implement account-check ( #24765 )
...
* cmd/geth, core/state/snapshot: rework journal loading, implement account-check
* core/state/snapshot, cmd/geth: polish code (#37 )
* core/state/snapshot: minor nits
* core/state/snapshot: simplify error logic
* cmd/geth: go format
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
3 years ago
Paweł Bylica
997f1c4f0a
core/vm: optimize jumpdest analysis ( #23500 )
...
core/vm: optimize PUSH opcode discrimination
3 years ago
Martin Holst Swende
d8a2305565
eth/tracers: add support for block overrides in debug_traceCall ( #24871 )
...
This PR adds support for block overrides when doing debug_traceCall.
- Previously, debug_traceCall against pending erroneously used a common.Hash{} stateroot when looking up the state, meaning that a totally empty state was used -- so it always failed,
- With this change, we reject executing debug_traceCall against pending.
- And we add ability to override all evm-visible header fields.
3 years ago
rjl493456442
f9806dc872
core: fix canonical hash marker update ( #24996 )
...
* core: fix reorg
* core: revert change for memory efficiency
* core: revert changes
3 years ago
Marius van der Wijden
8c0c0434c9
core/beacon: prevent invalid logsBloom length panic ( #24946 )
...
* core/beacon: prevent invalid logsBloom length panic
* core/beacon: prevent negative baseFeePerGas
* Update core/beacon/types.go
Co-authored-by: Martin Holst Swende <martin@swende.se>
* eth/catalys: go format
Co-authored-by: Martin Holst Swende <martin@swende.se>
3 years ago
Marius van der Wijden
86af788790
core: use less memory during reorgs ( #24616 )
...
This PR significantly reduces the memory consumption of a long reorg
3 years ago
Felix Lange
9244d5cd61
all: update license headers and AUTHORS from git history ( #24947 )
3 years ago
rjl493456442
59ac229f87
core/state/snapshot: detect and clean up dangling storage snapshot in generation ( #24811 )
...
* core/state/snapshot: check dangling storages when generating snapshot
* core/state/snapshot: polish
* core/state/snapshot: wipe the last part of the dangling storages
* core/state/snapshot: fix and add tests
* core/state/snapshot: fix comment
* README: remove mentions of fast sync (#24656 )
Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
* core, cmd: expose dangling storage detector for wider usage
* core/state/snapshot: rename variable
* core, ethdb: use global iterators for snapshot generation
* core/state/snapshot: polish
* cmd, core/state/snapshot: polish
* core/state/snapshot: polish
* Update core/state/snapshot/generate.go
Co-authored-by: Martin Holst Swende <martin@swende.se>
* ethdb: extend db test suite and fix memorydb iterator
* ethdb/dbtest: rollback changes
* ethdb/memorydb: simplify iteration
* core/state/snapshot: update dangling counter
* core/state/snapshot: release iterators
* core/state/snapshot: update metrics
* core/state/snapshot: update time metrics
* metrics/influxdb: temp solution to present counter meaningfully, remove it
* add debug log, revert later
* core/state/snapshot: fix iterator panic
* all: customized snapshot iterator for backward iteration
* core, ethdb: polish
* core/state/snapshot: remove debug log
* core/state/snapshot: address comments from peter
* core/state/snapshot: reopen the iterator at the next position
* ethdb, core/state/snapshot: address comment from peter
* core/state/snapshot: reopen exhausted iterators
Co-authored-by: Tbnoapi <63448616+nuoomnoy02@users.noreply.github.com>
Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
Co-authored-by: Martin Holst Swende <martin@swende.se>
3 years ago
Péter Szilágyi
34bda5eae3
core, eth, les, rpc: polish catalyst errors, add context
3 years ago
Marius van der Wijden
4a4d531052
eth/catalyst: update implementation to spec ( #24802 )
...
* eth/catalyst: return invalid payload attributes error
* eth/catalyst: implement LVH as specified, add tests
* eth/catalyst: return current block hash not header hash
* eth/catalyst: fix test
* eth/catalyst: bring error codes in line with spec
3 years ago
zhaochonghe
2bfd9a28d1
core: fix the order of address in queue ( #24907 )
...
reverse the order of address in queue
3 years ago
Sina Mahmoodi
bf693228a3
eth/tracers/js: goja tracer ( #23773 )
...
This adds a JS tracer runtime environment based on the Goja VM. The new
runtime replaces the duktape runtime, which will be removed soon.
Goja is implemented in Go and is faster for cases where the Go <-> JS
transition overhead dominates overall performance. It is faster because
duktape is written in C, and the transition cost includes the cost of using
cgo. Another reason for using Goja is that go-duktape is not maintained
anymore.
We expect the performace of JS tracing to be at least as good or better with
this change.
3 years ago
Marius van der Wijden
e6fa102eb0
core, eth, internal, rpc: implement final block ( #24282 )
...
* eth: core: implement finalized block
* eth/catalyst: fix final block
* eth/catalyst: update finalized head gauge
* internal/jsre/deps: updated web3.js to allow for finalized block
* eth/catalyst: make sure only one thread can call fcu
* eth/catalyst: nitpicks
* eth/catalyst: use plain mutex
* eth: nitpicks
3 years ago
Håvard Anda Estensen
4b309c7006
all: replace non-trivial uses of package ioutil with os ( #24886 )
...
Co-authored-by: Martin Holst Swende <martin@swende.se>
3 years ago
Håvard Anda Estensen
e644d45c14
all: use strings.EqualFold for string comparison ( #24890 )
3 years ago
Marius van der Wijden
381c66caf0
eth/catalyst: set the correct LatestValidHash ( #24855 )
...
* eth/catalyst: set the correct LatestValidHash
* eth/catalyst: core: return LVH during reorg, rework invalid teminal block
* eth/catalyst: nitpicks
3 years ago
Qian Bin
fe5a26733c
core/vm: reduce overhead in instructions-benchmark ( #24860 )
...
* core/vm: reduce footprint of OP benchmark
* core/vm: for opBenchmark, add code to detect inputs mutation
* Update core/vm/instructions_test.go
Co-authored-by: Martin Holst Swende <martin@swende.se>
* core/vm: opBenchmark, stop timer before sanity-test code
Co-authored-by: Martin Holst Swende <martin@swende.se>
3 years ago
Håvard Anda Estensen
07508ac0e9
all: replace uses of ioutil with io and os ( #24869 )
3 years ago
s7v7nislands
330e53fbb9
core/asm: use strings.Builder and fix godoc issues ( #24861 )
3 years ago
Martin Holst Swende
97f308a98f
core/vm: for tracing, do not report post-op memory
3 years ago
Qian Bin
e0a1fd5fdc
core/vm: optimize Memory.Set32 ( #24847 )
...
* core/vm: remove unnecessary memset for Memory.Set32
* core/vm: optimize Memory.Set32
3 years ago
s7v7nislands
539bbd6349
core/vm: separate opcode group for 0x20 range ( #24850 )
3 years ago
s7v7nislands
24c590cbec
core/vm: clean up some dead functions ( #24851 )
3 years ago
aaronbuchwald
52eb87d87c
core/vm: update benchmark to use Errorf instead of Sprintf ( #24845 )
3 years ago
Marius van der Wijden
86d5477079
core/state/snapshot: fix race condition ( #24685 )
...
Fixes three race conditions found through fuzzing by David Theodore
3 years ago
Alex Beregszaszi
3b967d16ca
core/vm: implement EIP-3855: PUSH0 instruction ( #24039 )
...
* core/vm: Implement PUSH0
* Move PUSH0 to enable3855
* Add method doc
3 years ago
rjl493456442
1941c5e6c9
core/rawdb: untie freezer and ancient chain data ( #24684 )
...
Previously freezer has only been used for storing ancient chain data, while obviously it can be used more. This PR unties the chain data and freezer, keep the minimal freezer structure and move all other logic (like incrementally freezing block data) into a separate structure called ChainFreezer.
This PR also extends the database interface by adding a new ancient store function AncientDatadir which can return the root directory of ancient store. The ancient root directory can be used when we want to open some other ancient-stores (e.g. reverse diff freezer).
3 years ago
rjl493456442
7f6f01d46f
core: recover state when beacon sets canonical head if it's missing ( #24613 )
...
* core: recover the state in SetChainHead if the head state is missing
* core: disable test logging
* core: address comment from martin
* core: improve log level in case state is recovered
* core, eth, les, light: rename SetChainHead to SetCanonical
3 years ago
milesvant
11b56ace2a
core: fix WriteBlockAndSetHead documentation ( #24818 )
3 years ago
s7v7nislands
5a584c2133
all: use common.FileExist for checking file existence ( #24748 )
3 years ago
tia-99
1f5943e4f9
core/types: fix unhandled errors in TestTransactionCoding ( #24692 )
3 years ago
Martin Holst Swende
0914234d10
cmd/geth, core/state/snapshot: fix flaw in dangling-storage check + inspect difflayers ( #24677 )
...
This PR fixes the flaw that @rjl493456442 found in https://github.com/ethereum/go-ethereum/pull/#issuecomment-1093817551 , namely, that the snapshot iterator uses the combined (disk + difflayers) 'view', wheres the raw iterator uses only the disk 'view'.
This PR instead splits up the work: one phase is iterating the disk layer data, another phase is loading the journalled difflayers and performing the same check there.
3 years ago
s7v7nislands
4024c1e869
fix typo ( #24731 )
3 years ago