Commit graph

666 commits

Author SHA1 Message Date
Chen Kai
507576e905
Merge branch 'ethereum:master' into portal 2024-01-13 23:11:05 +08:00
ddl
1335ba5f28
p2p/dnsdisc: use strings.Cut over strings.IndexByte (#28787) 2024-01-12 19:57:47 +01:00
fearlseefe
30b71fd14b refactor: use lookupworker 2024-01-09 17:09:38 +08:00
fearlseefe
c972aeda11 feat: use Lookup method 2024-01-09 17:09:38 +08:00
fearlseefe
6fbbe06767 fix: port conflict in test 2024-01-09 17:09:38 +08:00
fearlessfe
800ecad368 feat: finish contentLookup 2024-01-09 17:09:38 +08:00
fearlessfe
c0ac288ee7 faet: add content lookup test 2024-01-09 17:09:38 +08:00
fearlseefe
7fb680502e refactor: content storage
move ContentStorage interface to storage
2024-01-02 21:40:09 +08:00
thinkAfCod
c0ca1e4829 fix: lint checks 2023-12-26 10:54:22 +08:00
thinkAfCod
b14abef0cb fix: update utp-go version and modify test case 2023-12-25 18:02:35 +08:00
Chen Kai
cd5a92e383 fix:fix portal test
Signed-off-by: Chen Kai <281165273grape@gmail.com>
2023-12-25 12:46:16 +08:00
Chen Kai
d04b685d31 Merge branch 'master' into portal1 2023-12-20 20:48:32 +08:00
Felix Lange
5b22a472d6
p2p/discover: add liveness check in collectTableNodes (#28686)
* p2p/discover: add liveness check in collectTableNodes

* p2p/discover: fix test

* p2p/discover: rename to appendLiveNodes

* p2p/discover: add dedup logic back

* p2p/discover: simplify

* p2p/discover: fix issue found by test
2023-12-18 10:47:21 +01:00
alex
edc864f9ba
all: fix typos in comments (#28682)
chore(core,eth):fix a couple of typos
2023-12-18 09:35:12 +01:00
fearlseefe
6e2481873b faat: change the content_storage package 2023-12-13 19:26:41 +08:00
fearlessfe
4fc88f8dbe feat: content storage
impl #5
2023-12-13 19:26:41 +08:00
Chen Kai
2b0315e3ab feat:add more disc/portal api
Signed-off-by: Chen Kai <281165273grape@gmail.com>
2023-12-12 09:42:49 +08:00
Chen Kai
555b58c26c feat:rpc part2
Signed-off-by: Chen Kai <281165273grape@gmail.com>
2023-12-11 12:44:25 +08:00
Chen Kai
088af7da90 Merge branch 'master' into portal1 2023-12-10 17:27:12 +08:00
Martin Holst Swende
5416e3ac25 log: remove lazy, remove unused interfaces, unexport methods (#28622)
This change

- Removes interface `log.Format`,
- Removes method `log.FormatFunc`,
- unexports `TerminalHandler.TerminalFormat` formatting methods (renamed to `TerminalHandler.format`)
- removes the notion of `log.Lazy` values

The lazy handler was useful in the old log package, since it
could defer the evaluation of costly attributes until later in the
log pipeline: thus, if the logging was done at 'Trace', we could
skip evaluation if logging only was set to 'Info'.

With the move to slog, this way of deferring evaluation is no longer
needed, since slog introduced 'Enabled': the caller can thus do
the evaluate-or-not decision at the callsite, which is much more
straight-forward than dealing with lazy reflect-based evaluation.

Also, lazy evaluation would not work with 'native' slog, as in, these
two statements would be evaluated differently:

```golang
  log.Info("foo", "my lazy", lazyObj)
  slog.Info("foo", "my lazy", lazyObj)
```
2023-12-10 17:21:06 +08:00
Martin Holst Swende
b8d44ed98b
log: remove lazy, remove unused interfaces, unexport methods (#28622)
This change 

- Removes interface `log.Format`, 
- Removes method `log.FormatFunc`, 
- unexports `TerminalHandler.TerminalFormat` formatting methods (renamed to `TerminalHandler.format`)
- removes the notion of `log.Lazy` values


The lazy handler was useful in the old log package, since it
could defer the evaluation of costly attributes until later in the
log pipeline: thus, if the logging was done at 'Trace', we could
skip evaluation if logging only was set to 'Info'.

With the move to slog, this way of deferring evaluation is no longer
needed, since slog introduced 'Enabled': the caller can thus do
the evaluate-or-not decision at the callsite, which is much more
straight-forward than dealing with lazy reflect-based evaluation.

Also, lazy evaluation would not work with 'native' slog, as in, these
two statements would be evaluated differently:

```golang
  log.Info("foo", "my lazy", lazyObj)
  slog.Info("foo", "my lazy", lazyObj)
```
2023-12-05 11:54:44 +01:00
Chen Kai
a9643f4ba7 feat:rpc disc/history part1
Signed-off-by: Chen Kai <281165273grape@gmail.com>
2023-12-05 10:08:40 +08:00
thinkAfCod
da7196970f fix: update utp-go version and modify test case 2023-12-03 11:39:28 +08:00
Chen Kai
b724ba2b79 Merge branch 'opmaster' into portal1
Signed-off-by: Chen Kai <281165273grape@gmail.com>
2023-12-01 15:55:50 +08:00
jwasinger
28e7371701
all: replace log15 with slog (#28187)
This PR replaces Geth's logger package (a fork of [log15](https://github.com/inconshreveable/log15)) with an implementation using slog, a logging library included as part of the Go standard library as of Go1.21.

Main changes are as follows:
* removes any log handlers that were unused in the Geth codebase.
* Json, logfmt, and terminal formatters are now slog handlers.
* Verbosity level constants are changed to match slog constant values.  Internal translation is done to make this opaque to the user and backwards compatible with existing `--verbosity` and `--vmodule` options.
* `--log.backtraceat` and `--log.debug` are removed.

The external-facing API is largely the same as the existing Geth logger.  Logger method signatures remain unchanged.

A small semantic difference is that a `Handler` can only be set once per `Logger` and not changed dynamically.  This just means that a new logger must be instantiated every time the handler of the root logger is changed.

----
For users of the `go-ethereum/log` module. If you were using this module for your own project, you will need to change the initialization. If you previously did 
```golang
log.Root().SetHandler(log.LvlFilterHandler(log.LvlInfo, log.StreamHandler(os.Stderr, log.TerminalFormat(true))))
```
You now instead need to do 
```golang
log.SetDefault(log.NewLogger(log.NewTerminalHandlerWithLevel(os.Stderr, log.LevelInfo, true)))
```
See more about reasoning here: https://github.com/ethereum/go-ethereum/issues/28558#issuecomment-1820606613
2023-11-29 08:33:50 +01:00
Chen Kai
aeae3676c6 fix:fix pong nil bug
Signed-off-by: Chen Kai <281165273grape@gmail.com>
2023-11-27 22:06:05 +08:00
Chen Kai
b28975bd17 feat:add offer/accept protocol
Signed-off-by: Chen Kai <281165273grape@gmail.com>
2023-11-26 20:16:06 +08:00
Chen Kai
0e9882efc3 Merge branch 'opmaster' into portal 2023-11-16 18:02:16 +08:00
Chen Kai
8430b0114c feat:handle offer extension
Signed-off-by: Chen Kai <281165273grape@gmail.com>
2023-11-16 17:47:22 +08:00
Håvard Anda Estensen
a75a2d6db6
all: replace some cases of strings.SplitN with strings.Cut (#28446) 2023-11-15 14:42:33 +01:00
Chen Kai
92a254f34f fix:fix lint
Signed-off-by: Chen Kai <281165273grape@gmail.com>
2023-11-15 13:51:07 +08:00
Chen Kai
29083a9cb3 feat:add offer handle method
Signed-off-by: Chen Kai <281165273grape@gmail.com>
2023-11-15 13:45:09 +08:00
thinkAfCod
29c9241a77 fix: modify max packet size 2023-11-14 19:51:50 +08:00
thinkAfCod
dc349d90b5 fix: update lib of utp 2023-11-11 23:35:27 +08:00
Chen Kai
2024d388ad
Merge branch 'ethereum:master' into portal 2023-11-10 13:27:22 +08:00
grapebaba
5944d6589c feat:add find content
Signed-off-by: grapebaba <281165273@qq.com>
2023-11-03 21:56:14 +08:00
thinkAfCod
adfd669e40 fix: update lib of utp 2023-10-30 12:19:31 +08:00
Martin Holst Swende
233db64cc1
all: make vendored copy of reexec (#28382)
a little copying is better than a little dependency

-- go proverb

We have this dependency on docker, a.k.a moby: a gigantic library, and we only need ~70 LOC,
so here I tried moving it inline instead.

Co-authored-by: Felix Lange <fjl@twurst.com>
2023-10-28 00:14:43 +02:00
grapebaba
bf12305507 feat:handle find content message
Signed-off-by: grapebaba <281165273@qq.com>
2023-10-26 13:26:02 +08:00
grapebaba
499017009a feat:make portal wire ping/pong findnodes/nodes works
Signed-off-by: grapebaba <281165273@qq.com>
2023-10-26 13:26:02 +08:00
Felix Lange
9b46986edc
all: use rlp.DecodeBytes instead of rlp.Decode where possible (#27994) 2023-08-24 11:47:42 +03:00
Péter Szilágyi
be65b47645
all: update golang/x/ext and fix slice sorting fallout (#27909)
The Go authors updated golang/x/ext to change the function signature of the slices sort method. 
It's an entire shitshow now because x/ext is not tagged, so everyone's codebase just 
picked a new version that some other dep depends on, causing our code to fail building.

This PR updates the dep on our code too and does all the refactorings to follow upstream...
2023-08-12 00:04:12 +02:00
Felix Lange
7ec60d5f0c
p2p: move ping handling into pingLoop goroutine (#27887)
Moving the response sending there allows tracking all peer goroutines
in the peer WaitGroup.
2023-08-09 16:00:31 +02:00
ucwong
6d2bcb911a
p2p/simulations/examples: use atomic.Int64 (#27861) 2023-08-07 18:30:05 +02:00
ucwong
d04bde0a20
p2p: use atomic types (#27764)
Co-authored-by: Felix Lange <fjl@twurst.com>
2023-08-01 23:20:52 +02:00
Seungbae Yu
60ecf48dd4
cmd/bootnode, p2p: support for alternate mapped ports (#26359)
This changes the port mapping procedure such that, when the requested port is unavailable
an alternative port suggested by the router is used instead.

We now also repeatedly request the external IP from the router in order to catch any IP changes.

Co-authored-by: Felix Lange <fjl@twurst.com>
2023-07-14 14:58:27 +02:00
Felix Lange
a426999fc9
p2p/discover: filter bootnodes by netrestrict (#27701)
This prevents an issue where the node would attempt to contact the bootstrap
nodes even if they weren't contained in the netrestrict list.
2023-07-12 12:01:38 +02:00
lightclient
645b0db98e
cmd/utils, p2p: clean up discovery setup (#27518)
This simplifies the code that initializes the discovery a bit, and
adds new flags for enabling/disabling discv4 and discv5 separately.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
2023-07-11 21:21:32 +02:00
lightclient
cbf2579691
p2p, p2p/discover: add dial metrics (#27621)
This PR adds metrics for p2p dialing, which gives us visibility into the quality of the dial 
candidates  returned by our discovery methods.
2023-07-06 16:20:31 +02:00
Exca-DK
5520cd97a1
p2p/discover: swap verification order in discv4 ping handler (#27532)
In all other UDPv4 methods, the deadline is checked first. It seems weird to me that ping is an exception. Deadline comparison is also less resource intensive.

Co-authored-by: Exca-DK <Exca-DK@users.noreply.github.com>
2023-06-22 10:06:14 +02:00