Commit Graph

20746 Commits

Author SHA1 Message Date
Alex Sharov
aa3a804757 fix nil-ptr in txpool fee calc (#9410)
```
[INFO] [02-08|22:58:28.974] new subscription to logs established
[INFO] [02-08|22:58:28.975] rpc filters: subscribing to Erigon events
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x240 pc=0x122572f]

goroutine 2343 [running]:
github.com/ledgerwatch/erigon/consensus/misc.eip1559Calculator.CurrentFees({}, 0xc046591900, {0x7f1202466db8, 0xc0341b7d40})
        github.com/ledgerwatch/erigon/consensus/misc/eip1559.go:80 +0xcf
github.com/ledgerwatch/erigon-lib/txpool.(*TxPool).fromDB(0xc000936c80, {0x3277f60, 0xc000cd8eb0}, {0x3299818?, 0xc0341b7ce0}, {0x3299818?, 0xc0341b7d40?})  
        github.com/ledgerwatch/erigon-lib@v1.0.0/txpool/pool.go:2095 +0x8b3
github.com/ledgerwatch/erigon-lib/txpool.(*TxPool).Start.func1({0x3299818, 0xc0341b7ce0})
        github.com/ledgerwatch/erigon-lib@v1.0.0/txpool/pool.go:329 +0xfe
github.com/ledgerwatch/erigon-lib/kv/mdbx.(*MdbxKV).View(0x29e8d60800?, {0x3277f60?, 0xc000cd8eb0?}, 0xc03412f7a0)
        github.com/ledgerwatch/erigon-lib@v1.0.0/kv/mdbx/kv_mdbx.go:749 +0xa6
github.com/ledgerwatch/erigon-lib/txpool.(*TxPool).Start(0xc000936c80, {0x3277f60?, 0xc000cd8eb0}, {0x328d2d0, 0xc0161ad0a0})
        github.com/ledgerwatch/erigon-lib@v1.0.0/txpool/pool.go:319 +0xc9
github.com/ledgerwatch/erigon-lib/txpool.MainLoop({0x3277f60?, 0xc000cd8eb0}, {0x328d2d0, 0xc0161ad0a0}, 0xc000936c80, 0xc0340750e0, 0xc017e1e0a0, 0xc034088c60, 0xc03459f190)
        github.com/ledgerwatch/erigon-lib@v1.0.0/txpool/pool.go:1729 +0x205
created by github.com/ledgerwatch/erigon/eth.New
        github.com/ledgerwatch/erigon/eth/backend.go:718 +0x3fbd
```
2024-02-14 13:07:22 -06:00
Shane Bammel
31c2dd6036 Add missing implementations in headers stage
This is required for processing uncles in historical POW blocks.
2024-02-10 17:49:50 -06:00
Shane Bammel
3ec01ab133 Fix missing uncles in new block downloader 2024-02-07 10:39:14 -06:00
Shane Bammel
8c10b47d0c Add grpc conversion tests 2024-02-07 10:36:46 -06:00
Andrew Ashikhmin
705814b1ab
Mumbai: add Napoli block (#9346)
Cherry pick PR #9345

---------

Co-authored-by: Arpit Temani <temaniarpit27@gmail.com>
2024-01-30 10:45:47 +01:00
Andrew Ashikhmin
ffb6b83c09
(release) RpcDaemon doesn't see recently retired blocks (#9336)
Cherry pick PR #9318

---------

Co-authored-by: Alex Sharov <AskAlexSharov@gmail.com>
2024-01-29 13:49:47 +01:00
Andrew Ashikhmin
9f1cd651f0
(release) txpool: fix initial blockGasLimit and setBlobFee() (#9303)
Cherry pick PR #9301
2024-01-24 13:33:28 +01:00
Andrew Ashikhmin
20999401b2
release: downloader: prohibit_new_downloads.lock check missed download (#9300)
Cherry pick PR #9295

---------

Co-authored-by: Alex Sharov <AskAlexSharov@gmail.com>
2024-01-24 12:41:31 +01:00
Andrew Ashikhmin
4f6eda7694
release params: remove dev (#9265) 2024-01-18 17:04:17 +01:00
Andrew Ashikhmin
3040e2576c
logs: remove "height=unknown" (#9261)
"[EngineBlockDownloader] Downloading PoS headers... height=unknown"
might be
[confusing](https://discord.com/channels/687972960811745322/1001501454076477450/1197365760125841550)
for users.
2024-01-18 14:27:36 +01:00
Andrew Ashikhmin
4abc6cd119
Schedule Dencun for Sepolia & Holešky (#9255)
See https://github.com/ethereum/EIPs/pull/8051 &
https://github.com/ethereum/execution-specs/pull/860
2024-01-18 09:27:03 +01:00
battlmonstr
1914b52de0
mdbx: race conditions in MdbxKV.Close (#8409) (#9244)
In the previous code WaitGroup db.wg.Add(), Wait() and db.closed were
not treated in sync. In particular, it was theoretically possible to
first check closed, then set closed and Wait, and then call wg.Add()
while waiting (leading to WaitGroup panic).
In theory it was also possible that db.env.BeginTxn() is called on a
closed or nil db.env, because db.wg.Add() was called only after BeginTxn
(db.wg.Wait() could already return).

WaitGroup is replaced with a Cond variable.
Now it is not possible to increase the active transactions count on a
closed database. It is also not possible to call BeginTxn on a closed
database.
2024-01-17 15:28:37 +01:00
Somnath
5e5d8490b1
Move blob cache check in txpool (#9250)
This should help with less frequent lock/unlock. Following from an
earlier "TODO"
2024-01-17 17:46:02 +04:00
Andrew Ashikhmin
b38e17e393
Implement PIP-33: Napoli Hardfork (#8975)
Initial support of the upcoming Napoli hard fork on Polygon – see
[PIP-33](https://forum.polygon.technology/t/pip-33-napoli-upgrade). Per
[PIP-31](https://github.com/maticnetwork/Polygon-Improvement-Proposals/blob/main/PIPs/PIP-31.md),
it parallels the
[Cancun](https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/cancun.md)
upgrade of Ethereum, but does not include
[EIP-4788](https://eips.ethereum.org/EIPS/eip-4788),
[EIP-4844](https://eips.ethereum.org/EIPS/eip-4844),
[EIP-7516](https://eips.ethereum.org/EIPS/eip-7516). In other words,
Napoli includes [EIP-1153](https://eips.ethereum.org/EIPS/eip-1153),
[EIP-5656](https://eips.ethereum.org/EIPS/eip-5656),
[EIP-6780](https://eips.ethereum.org/EIPS/eip-6780) from Cancun.

This PR implements
[PIP-31](https://github.com/maticnetwork/Polygon-Improvement-Proposals/blob/main/PIPs/PIP-31.md),
[PIP-16: Transaction Dependency
Data](https://github.com/maticnetwork/Polygon-Improvement-Proposals/blob/main/PIPs/PIP-16.md)
(by merging `ParallelUniverseBlock` into `NapoliBlock`; the bulk of
PIP-16 was implemented in PR #8037), and [PIP-27: Precompiled for
secp256r1 Curve
Support](https://github.com/maticnetwork/Polygon-Improvement-Proposals/blob/main/PIPs/PIP-27.md)
([EIP-7212](https://eips.ethereum.org/EIPS/eip-7212); see also
https://github.com/maticnetwork/bor/pull/1069 &
https://github.com/ethereum/go-ethereum/pull/27540).

---------

Co-authored-by: Anshal Shukla <shukla.anshal85@gmail.com>
2024-01-17 14:13:16 +01:00
Andrew Ashikhmin
8f6fe88b29
Update TestGoerliForkDigest after Dencun (#9251)
Current fork digest for Görli has changed after the [Dencun
upgrade](https://blog.ethereum.org/2024/01/10/goerli-dencun-announcement)
on 17 Jan.
2024-01-17 11:50:13 +01:00
Giulio rebuffo
e1a1c0c049
Caplin: Fixed goroutine hell (#9246) 2024-01-17 10:06:18 +01:00
Arun Sathiya
e1195bad2a
ci: Use GITHUB_OUTPUT envvar instead of set-output command (#9215)
`save-state` and `set-output` commands used in GitHub Actions are
deprecated and [GitHub recommends using environment
files](https://github.blog/changelog/2023-07-24-github-actions-update-on-save-state-and-set-output-commands/).

This PR updates the usage of `set-output` to `$GITHUB_OUTPUT`

Instructions for envvar usage from GitHub docs:


https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-output-parameter
2024-01-17 14:23:20 +07:00
Michelangelo Riccobene
dd010bbb31
qa tests: add clean exit test on block downloading (#9238)
This test uses a pre-built database to test Erigon's behaviour on ctrl-c
during the block download phase (Caplin sync).
2024-01-17 14:23:07 +07:00
Alex Sharov
26ce6aa88b
return 1 lost mainnet file (#9242) 2024-01-17 14:21:51 +07:00
ddl
a1eee5eb8b
fix udpOrHttpTrackers amount (#9245)
seems we just choose the first 8 trackers in
https://github.com/ledgerwatch/trackerslist/blob/master/trackers_best.txt.
2024-01-17 14:21:39 +07:00
battlmonstr
e979d79c08
p2p: panic in enode DB Close on shutdown (#9237) (#9240)
If any DB method is called while Close() is waiting for db.kv.Close()
(it waits for ongoing method calls/transactions to finish)
a panic: "WaitGroup is reused before previous Wait has returned" might
happen.

Use context cancellation to ensure that new method calls immediately
return during db.kv.Close().
2024-01-16 15:34:31 +07:00
battlmonstr
2793ef6ec1
polygon: flatten redundant packages (#9241)
* move mocks to the owner packages
* squash single file packages
* move types to more appropriate files
* remove unused mocks
2024-01-16 09:23:02 +01:00
ddl
79499b5cac
refactor(p2p/dnsdisc): replace strings.IndexByte with strings.Cut (#9236)
similar to https://github.com/ledgerwatch/erigon/pull/9202
2024-01-15 18:46:26 +00:00
battlmonstr
cda48aeaf7
polygon/heimdall: drop GRPC support (#9230) 2024-01-15 16:49:46 +01:00
Giulio rebuffo
f03d2665ff
Added merkle proof and fixed bad handling of new validators (#9233) 2024-01-15 15:01:33 +01:00
milen
a7d5b55250
rpcdaemon: fix remote bor engine for trace transaction (#9214)
This PR fixes the below error when running a remote rpcdaemon for
Polygon debug_traceTransaction.

Request:
```
curl http://localhost:9545/ \
-X POST \
-H "Content-Type: application/json" \
--data '{
  "jsonrpc": "2.0",
  "id": 0,
  "method": "debug_traceTransaction",
  "params": [
    "0xf265c04fc31c91eec9971e118f059322a910776ce40584114c351732ab01aec7",
    {
      "tracer": "callTracer",
      "borTraceEnabled": true,
      "borTx": true
    }
  ]
}'
```

Response:
```
{"jsonrpc":"2.0","id":0,"result":null,"error":{"code":-32000,"message":"method handler crashed"}}
```

Logs:
```
EROR[01-11|18:45:14.087] RPC method debug_traceTransaction crashed: interface conversion: *cli.remoteConsensusEngine is not consensus.Engine: missing method APIs
```
2024-01-15 13:26:39 +00:00
battlmonstr
fb0226d293
polygon/sync: move PeersWithBlockNumInfo and mocks, refactor bor.GetRootHash (#9232) 2024-01-15 12:37:37 +01:00
battlmonstr
c5b75d00ca
polygon/sync: span updates (#9229)
It is possible that a span update happens during a milestone.
A headers slice might cross to the new span.
Also if 2 forks evolve simulaneously, a shorter fork can still be in the
previous span.
In these cases we need access to the previous span to calculate
difficulty and validate header times.

SpansCache will keep recent spans.
The cache will be updated on new span events from the heimdall.
The cache is pruned on new milestone events and in practice no more than
2 spans are kept.

The header difficulty calculation and time validation depends on having
a span for that header in the cache.
2024-01-15 12:36:25 +01:00
a
8d4d4d802c
refac some (#9185) 2024-01-14 23:22:34 -06:00
battlmonstr
ac9f9e0a25
polygon/sync: fork choice logic (#9228) 2024-01-14 13:40:47 +00:00
Mark Holt
d8b91c4d02
Fix startup sync for txpool processing for bor block production (#9219)
When the sync loop first runs it suppresses block sync events both in
the initial loop and when the blocks being processed are greater than
1000.

This fix removed the first check, because otherwise the first block
received by the process ends up not getting sent to the tx pool. Which
means it won't produce new block for polygon.

As well as this fix - I have also moved the gas initialization to the
txpool start method rather than prompting it with a 'synthetic block
event'

As the txpool start has access to the core & tx DB's it can find the
current block and chain config internally so that it doesn't need to be
externally activated it can just do this itself on start up. This has
the advantage of making the txpool more self contained.
2024-01-13 10:33:34 +00:00
Pan chao
2b0fd6d447
chore: some proofreading in the docs (#9223)
Hi, caught a few mistakes while reading the docs. Hope I can be of any
help.
Have a nice day.
2024-01-13 12:04:55 +07:00
Giulio rebuffo
7b58dab998
Added LightClient Containers (#9222) 2024-01-13 01:12:02 +01:00
battlmonstr
52a948731c
polygon: refactor header validations for reuse in sync (#9224) 2024-01-12 21:01:28 +01:00
Mark Holt
320fe0ab8b
Don't run pos downloader or engine api for bor (#9220)
Pos downloader and the engine api code are not necessary for Bor. This
adds code to suppress their start up.
2024-01-12 16:07:59 +00:00
Arpit Temani
a592cbf163
Removed the check for milestoneID in the GetVoteOnHash() (#9021)
Removed the check for milestoneID in the GetVoteOnHash()

https://github.com/maticnetwork/bor/pull/1109
2024-01-12 21:20:53 +05:30
battlmonstr
c11e5047fb
polygon: refactor header.Time validation (#9213) 2024-01-12 16:11:01 +01:00
Bayram Guvanjov
a191296f05
Deneb integration to Caplin (#9093)
Pr is ready to review and merge. 

This PR includes implementing and integrating Ethereum Deneb's hard work
with the Caplin Ethereum client.

Changes:

- Full compatibility with Deneb Ethereum hard fork
- Added new EIPs introduced in Deneb. (`EIP-4788`, `EIP-4844`,
`EIP-7044`, `EIP-7045`, `EIP-7514`)
- Tests integration

---------

Co-authored-by: Giulio <giulio.rebuffo@gmail.com>
2024-01-12 14:20:26 +01:00
Alex Sharov
574ec8089d
caplin state_antiqate: reduce worst case ram limit (#9217) 2024-01-12 14:19:24 +01:00
ddl
db1dcbb9d7
refactor(erigon-lib/metrics): replace strings.IndexByte with strings.Cut (#9202)
above go1.18  Index calls are more clearly written using Cut.
https://github.com/golang/go/issues/46336
2024-01-12 13:07:49 +00:00
racytech
fa1e1bab27
Tests v13 fix (#9200) 2024-01-12 12:42:08 +01:00
Alex Sharov
e806db977f
mdbx: reduce 2 times hard dplimit (#9216)
can do it, because we don't do read-after-write in same rwtx
2024-01-12 11:27:18 +01:00
Alex Sharov
3bb1917e8a
recsplit: reduce ram pressure (#9218)
reasons: 
- indexing done in background (or in many workers)
- `recsplit` has 2 etl collectors
2024-01-12 11:26:20 +01:00
Mark Holt
66cd4e71fa
Mumbai uploader regression fixes (#9212)
This fixes a couple of regressions for running the uploader for mumbai

* Now flags have moved to a higher context they need to be set in the
context not the flag values
* Span 0 of mumbai has a header/span mismatch for span zero sprint 0. So
the check here needs to be suppressed
2024-01-11 21:15:26 +00:00
Giulio rebuffo
8315033a92
Added more checks on state reconstruction + made history reconstruction resumable. (#9211)
Co-authored-by: Bayram Guvanjov <bayramguwanjow@gmail.com>
2024-01-11 20:05:54 +01:00
Andrew Ashikhmin
c1e3ec59af
deps: upgrade go-multiaddr to v0.12.1 (#9208) 2024-01-11 16:42:11 +01:00
battlmonstr
04498180dc
p2p/discv4: revert gotreply handler change from #8661 (#9119) (#9195)
The handler had race conditions in the candidates processing goroutine.
2024-01-11 15:04:46 +00:00
dependabot[bot]
9a9808f715
build(deps): bump github.com/quic-go/quic-go from 0.38.1 to 0.38.2 (#9196)
Bumps [github.com/quic-go/quic-go](https://github.com/quic-go/quic-go)
from 0.38.1 to 0.38.2.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/quic-go/quic-go/releases">github.com/quic-go/quic-go's
releases</a>.</em></p>
<blockquote>
<h2>v0.38.2</h2>
<p>This release contains fixes for a resource exhaustion attack on
QUIC's path validation logic (CVE-2023-49295), see <a
href="https://seemann.io/posts/2023-12-18-exploiting-quics-path-validation">https://seemann.io/posts/2023-12-18-exploiting-quics-path-validation</a>
for details:</p>
<ul>
<li>limit the number of queued PATH_RESPONSE frames to 256 (<a
href="https://redirect.github.com/quic-go/quic-go/pull/4199">quic-go/quic-go#4199</a>)</li>
<li>don't retransmit PATH_CHALLENGE and PATH_RESPONSE frames (<a
href="https://redirect.github.com/quic-go/quic-go/pull/4200">quic-go/quic-go#4200</a>)</li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/quic-go/quic-go/compare/v0.38.1...v0.38.2">https://github.com/quic-go/quic-go/compare/v0.38.1...v0.38.2</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="9aaefe19fc"><code>9aaefe1</code></a>
don't retransmit PATH_CHALLENGE and PATH_RESPONSE frames (<a
href="https://redirect.github.com/quic-go/quic-go/issues/4200">#4200</a>)</li>
<li><a
href="17fc98c2d8"><code>17fc98c</code></a>
limit the number of queued PATH_RESPONSE frames to 256 (<a
href="https://redirect.github.com/quic-go/quic-go/issues/4199">#4199</a>)</li>
<li>See full diff in <a
href="https://github.com/quic-go/quic-go/compare/v0.38.1...v0.38.2">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=github.com/quic-go/quic-go&package-manager=go_modules&previous-version=0.38.1&new-version=0.38.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/ledgerwatch/erigon/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-11 11:45:36 +01:00
Mark Holt
7308e87c0e
Fix txpool queue overflow (#9197)
When discarding spamming we need to remove the tx from the subpools as
well as the sender tx list. Otherwise the tx is ignored by other
operations and left in the subpool

As well as the fix here this PR also contains several changes to TX
TRACING and other logging to make it easier to see what is going on with
pool processing
2024-01-11 10:03:41 +00:00
Michelangelo Riccobene
470f05ee6f
clean-exit test: increase test time (#9193)
This PR
- increase the test time
- use the updated python scripts that reports as an issue a long exit
time
- change the test name to states that it is runned in the snapshot
downloading phase
(a later PR will add a similar test on the block downloading phase)
2024-01-11 08:47:23 +07:00