Commit graph

16585 commits

Author SHA1 Message Date
Manav Darji
0bc2dcbd71
cmd/utils: use defined filter api instance instead of a new one (#1270) 2024-06-20 17:19:12 +05:30
Manav Darji
c551b4198e
bump version to v1.3.4-beta 2024-06-19 10:58:22 +05:30
Manav Darji
2fd85b3717
eth, consensus: refactor whitelisting related logs and improve error handling (#1268)
* eth, consensus: refactor whitelisting related logs and error handling

* core: fix lint

* eth: fix tests, check against root error

* eth: use ctx correctly while logging

* eth: refactor comments and error message
2024-06-18 14:43:51 +05:30
Manav Darji
9c2d462e21
internal/cli: check for delete permissions before starting to prune (#1269) 2024-06-18 14:43:29 +05:30
Marcello Ardizzone
a9e5c95be8
chg: upgrade deps and solve sec issues (#1261)
* chg: upgrade deps and solve sec issues

* chg: use old kzg-4844 repo

* chg: ignore explicitly Errorf return value
2024-06-13 14:55:40 +05:30
Pratik Patil
bd5d54e9fe
Merge pull request #1267 from maticnetwork/psp-p2p-upstream
p2p: cherry-pick commits from geth for peering issues
2024-06-13 13:00:54 +05:30
Marcello Ardizzone
d67620c8f4
core, eth, internal, miner, params: enforce 30gwei for gas related configs in bor (#1264)
* add: enforce 30gwei for gas related configs in bor

* chg: fix lint
2024-06-12 14:41:25 +05:30
Pratik Patil
d0a212b4d0
Merge pull request #1266 from maticnetwork/master
Back merge master to develop after v1.3.3 release
2024-06-12 14:34:41 +05:30
Pratik Patil
625774fa78
Merge pull request #1265 from maticnetwork/1.3.3-candidate
v1.3.3 release
2024-06-12 12:53:42 +05:30
Pratik Patil
22670cd283
version bump to 1.3.3 2024-06-12 12:15:57 +05:30
Felix Lange
642f5528f6
p2p: fix race in dialScheduler (#29235)
Co-authored-by: Stefan <stefan@starflinger.eu>
2024-06-11 16:43:07 +05:30
Felix Lange
0e093b2c9c
p2p/discover: refactor node and endpoint representation (#29844)
Here we clean up internal uses of type discover.node, converting most code to use
enode.Node instead. The discover.node type used to be the canonical representation of
network hosts before ENR was introduced. Most code worked with *node to avoid conversions
when interacting with Table methods. Since *node also contains internal state of Table and
is a mutable type, using *node outside of Table code is prone to data races. It's also
cleaner not having to wrap/unwrap *enode.Node all the time.

discover.node has been renamed to tableNode to clarify its purpose.

While here, we also change most uses of net.UDPAddr into netip.AddrPort. While this is
technically a separate refactoring from the *node -> *enode.Node change, it is more
convenient because *enode.Node handles IP addresses as netip.Addr. The switch to package
netip in discovery would've happened very soon anyway.

The change to netip.AddrPort stops at certain interface points. For example, since package
p2p/netutil has not been converted to use netip.Addr yet, we still have to convert to
net.IP/net.UDPAddr in a few places.
2024-06-11 15:53:50 +05:30
lightclient
7850a9f5f6
p2p/discover: fix update logic in handleAddNode (#29836)
It seems the semantic differences between addFoundNode and addInboundNode were lost in
(and are unsure if is available) whereas addInboundNode is for adding nodes that have
contacted the local node and we can verify they are active.

handleAddNode seems to be the consolidation of those two methods, yet it bumps the node in
the bucket (updating it's IP addr) even if the node was not an inbound. This PR fixes
this. It wasn't originally caught in tests like TestTable_addSeenNode because the
manipulation of the node object actually modified the node value used by the test.

New logic is added to reject non-inbound updates unless the sequence number of the
(signed) ENR increases. Inbound updates, which are published by the updated node itself,
are always accepted. If an inbound update changes the endpoint, the node will be
revalidated on an expedited schedule.

Co-authored-by: Felix Lange <fjl@twurst.com>
2024-06-11 15:23:31 +05:30
Aaron Chen
b2c178d935
p2p/enode: fix TCPEndpoint (#29827) 2024-06-11 15:17:53 +05:30
Felix Lange
be1e580459
p2p/enode: fix endpoint determination for IPv6 (#29801)
enode.Node has separate accessor functions for getting the IP, UDP port and TCP port.
These methods performed separate checks for attributes set in the ENR.

With this PR, the accessor methods will now return cached information, and the endpoint is
determined when the node is created. The logic to determine the preferred endpoint is now
more correct, and considers how 'global' each address is when both IPv4 and IPv6 addresses
are present in the ENR.
2024-06-11 14:51:57 +05:30
Felix Lange
706cf1c779
p2p/discover: fix crash when revalidated node is removed (#29864)
In #29572, I assumed the revalidation list that the node is contained in could only ever
be changed by the outcome of a revalidation request. But turns out that's not true: if the
node gets removed due to FINDNODE failure, it will also be removed from the list it is in.
This causes a crash.

The invariant is: while node is in table, it is always in exactly one of the two lists. So
it seems best to store a pointer to the current list within the node itself.
2024-06-11 14:07:20 +05:30
Felix Lange
1351a54287
p2p/discover: improved node revalidation (#29572)
Node discovery periodically revalidates the nodes in its table by sending PING, checking
if they are still alive. I recently noticed some issues with the implementation of this
process, which can cause strange results such as nodes dropping unexpectedly, certain
nodes not getting revalidated often enough, and bad results being returned to incoming
FINDNODE queries.

In this change, the revalidation process is improved with the following logic:

- We maintain two 'revalidation lists' containing the table nodes, named 'fast' and 'slow'.
- The process chooses random nodes from each list on a randomized interval, the interval being
  faster for the 'fast' list, and performs revalidation for the chosen node.
- Whenever a node is newly inserted into the table, it goes into the 'fast' list.
  Once validation passes, it transfers to the 'slow' list. If a request fails, or the
  node changes endpoint, it transfers back into 'fast'.
- livenessChecks is incremented by one for successful checks. Unlike the old implementation,
  we will not drop the node on the first failing check. We instead quickly decay the
  livenessChecks give it another chance.
- Order of nodes in bucket doesn't matter anymore.

I am also adding a debug API endpoint to dump the node table content.

Co-authored-by: Martin HS <martin@swende.se>
2024-06-11 13:53:35 +05:30
Manav Darji
e6a462504a
bump version to v1.3.3-beta3 2024-06-10 12:34:00 +05:30
Manav Darji
2aa76a9926
eth: change block propagation and announcement logs to debug 2024-06-10 12:32:17 +05:30
Manav Darji
6bc8334852
eth/fetcher: modify queue limits for improving sync near chain tip (#1260) 2024-06-07 21:57:19 +05:30
Anshal Shukla
e28c2036fc
remove additional bootnodes (#1255) 2024-06-06 23:13:43 +05:30
Marcello Ardizzone
57b77e3b6c
chg: fix percentile validation in fee history (#1235) 2024-06-06 11:23:30 +05:30
Pratik Patil
5b0805d706
version bump to 1.3.3-beta2 2024-06-06 11:04:19 +05:30
Pratik Patil
c0d1fbb86a
Fix panic when fetching block in case of reorg (#1259) 2024-06-06 10:59:45 +05:30
Pratik Patil
a0acefc04c
eth: broadcast block to static and trusted peers as well (#1258) 2024-06-06 10:57:20 +05:30
Manav Darji
d8374ecf3c
bump version to v1.3.3-beta 2024-05-30 14:15:09 +05:30
Pratik Patil
3278c79d80
Merge pull request #1254 from maticnetwork/upstream_merge
Merge upstream_merge branch to develop
2024-05-29 11:00:59 +05:30
Pratik Patil
f25b6efad2
Merge branch 'develop' of https://github.com/maticnetwork/bor into upstream_merge 2024-05-28 22:24:54 +05:30
Manav Darji
e789b4e312
eth/internal: add debug.peerStats for stats related to all connected peers (#1252)
* implement debug.peerStats for stats related to all connected peers

* add identifier for ipc

* display block number in peer stats

* eth/downloader: log error while terminating sync
2024-05-28 17:51:00 +05:30
Pratik Patil
6a5c55266e
Merge branch 'develop' of https://github.com/maticnetwork/bor into upstream_merge 2024-05-28 17:20:23 +05:30
Pratik Patil
5db6fa7174
Merge pull request #1253 from maticnetwork/psp-develop
Revert "Merge upstream_merge branch to develop (#1229)"
2024-05-28 15:44:50 +05:30
Pratik Patil
54c8ddb618
some fixed due to recent changes 2024-05-28 14:57:20 +05:30
Pratik Patil
052405b03e
Revert "Merge upstream_merge branch to develop (#1229)"
This reverts commit 7e2be02c26.
2024-05-28 14:10:49 +05:30
Pratik Patil
4170c2756a
Merge pull request #1250 from maticnetwork/psp-master
Backmerge Master to develop after 1.3.2 release
2024-05-27 11:38:44 +05:30
Pratik Patil
368a1a3859
not going into snap sync (#1247) 2024-05-27 10:54:49 +05:30
Pratik Patil
5f6a76bafe
added error handeling in ethstats.go which prevents node to panic (#1249) 2024-05-27 09:11:44 +05:30
Manav Darji
bade7f57df
Merge pull request #1245 from maticnetwork/v1.3.2-stable
v1.3.2
2024-05-10 16:12:41 +05:30
Anshal Shukla
7543b5d87a
release: v1.3.2 2024-05-09 11:30:34 +05:30
Manav Darji
d95c05b98a
Enable ancient block pruning (#1216)
* core/state: typo

Signed-off-by: Delweng <delweng@gmail.com>

* core/rawdb: backport from https://github.com/bnb-chain/bsc/pull/543

Signed-off-by: Delweng <delweng@gmail.com>

* eth,ethdb,node,core/state: backport from https://github.com/bnb-chain/bsc/pull/543

Signed-off-by: Delweng <delweng@gmail.com>

* eth,core: backport from https://github.com/bnb-chain/bsc/pull/543

Signed-off-by: Delweng <delweng@gmail.com>

* cmd: open db with freeze disabled

Signed-off-by: Delweng <delweng@gmail.com>

* cli: snapshot prune-block

Signed-off-by: Delweng <delweng@gmail.com>

* fix typo

Signed-off-by: Delweng <delweng@gmail.com>

* cli/snapshot: fix the issue of dup open db error

Signed-off-by: Delweng <delweng@gmail.com>

* cli/snapshot: resolve datadir and ancient before backup

Signed-off-by: Delweng <delweng@gmail.com>

* core: more prune-block log

Signed-off-by: Delweng <delweng@gmail.com>

* core: truncatetail missing f.offset

Signed-off-by: Delweng <delweng@gmail.com>

* core/rawdb: indextx adjust offset of pruned block

Signed-off-by: Delweng <delweng@gmail.com>

* core/rawdb: freezer batch should implement the offset commit, ref https://github.com/bnb-chain/bsc/pull/1005

Signed-off-by: Delweng <delweng@gmail.com>

* core: check of ancientdb, backport https://github.com/bnb-chain/bsc/pull/817

Signed-off-by: Delweng <delweng@gmail.com>

* core/state: read raw borReceipt to backup

Signed-off-by: Delweng <delweng@gmail.com>

* core/rawdb: bor receipt maybe in []Receipt or Receipt RLP format

Signed-off-by: Delweng <delweng@gmail.com>

* core/state: typo and error msg

Signed-off-by: Delweng <delweng@gmail.com>

* core/rawdb: offSet -> offset

Signed-off-by: Delweng <delweng@gmail.com>

* cli/snapshot: comment

Signed-off-by: Delweng <delweng@gmail.com>

* cli/snapshot: add prune-block doc

Signed-off-by: Delweng <delweng@gmail.com>

* docs: add prune-block document

Signed-off-by: Delweng <delweng@gmail.com>

* core/rawdb: print wrong bor-receipt length

Signed-off-by: Delweng <delweng@gmail.com>

* internal/cli: add snapshot prune block tests (referenced from bsc's PR)

* improve errors

* cmd, core, eth, internal: fix lint

* internal/cli: refactor snapshot prune block test

* fix linters in tests

* internal/cli: add inspect-ancient-db command, update docs

* pruner: use a generic function for simplification

* internal/cli: fixes for inspect-db command

* internal/cli: improve pruning tests

* core/rawdb: update end block calculation logic in inspect command

* core/rawdb: improve checks db initialisation

* core/rawdb: remove offset check

* update mocks for span, ethdb and add command in makefile

* docs/cli: update docs with inspect command

* go mod tidy

* refactor and resolve conflicts

* resolve more conflicts

* refactor

* explicitly read node for hash scheme

* add check for hash scheme, fix tests

* fix typo

* update docs and add warning

* raise error if pbss is enabled

* revert read raw bor receipt change

* consensus/bor: handle nil header case in get root hash

* address comments

* core/rawdb: check chain continuity by matching parent hash

* core/rawdb: account for pruned ancient blocks

* go mod tidy

* fix tests

* fix tests

---------

Signed-off-by: Delweng <delweng@gmail.com>
Co-authored-by: Delweng <delweng@gmail.com>
2024-05-09 11:19:34 +05:30
Pratik Patil
902c1ce97e
eth: explicitly commented the code were bor could get into snap-sync mode (#1243)
* eth: explicitly commented the code were bor could get into snap-sync mode

* addressed comment
2024-05-09 08:42:55 +05:30
Anshal Shukla
9e032090eb
release: v1.3.2-beta-2 2024-05-06 20:57:09 +05:30
marcello33
0eceaca6f2
core/rawdb: add sanity-limit to header accessor 2024-05-06 20:56:36 +05:30
Jerry
3c284fa8af
Cancel pending downloader tasks before rewinding 2024-05-06 20:23:28 +05:30
Anshal Shukla
7c729f542b
Fix state sync hash (#1207)
* fix: hashing of statesync txn

* add: state sync txn in getBlockReceipts, testcase to check hashing of state sync txn in GetTransactonReceiptsByBlock
2024-05-06 20:04:02 +05:30
Anshal Shukla
8fc2a955a2
Merge pull request #1241 from maticnetwork/merge-master
Merge master
2024-05-06 19:48:27 +05:30
Anshal Shukla
f2a892c515
fix: lint 2024-05-06 16:10:32 +05:30
Anshal Shukla
9e07678b45
Merge branch 'develop' into merge-master 2024-05-06 11:26:23 +05:30
Martin HS
96ef9dbe54
cherry pick to fix lints 2024-05-05 15:47:42 +05:30
dependabot[bot]
bf6ca3433d
build(deps): bump golang.org/x/net from 0.22.0 to 0.23.0 (#1225)
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.22.0 to 0.23.0.
- [Commits](https://github.com/golang/net/compare/v0.22.0...v0.23.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Pratik Patil <pratikspatil024@gmail.com>
2024-05-03 13:46:14 +05:30
easyfold
3a719a86d1
eth/tracers: avoid data race when tracing block with bor tx (#1214) 2024-05-03 11:50:10 +05:30