Martin Holst Swende
4d3525610e
all: remove deprecated uses of math.rand ( #26710 )
...
This PR is a (superior) alternative to https://github.com/ethereum/go-ethereum/pull/26708 , it handles deprecation, primarily two specific cases.
`rand.Seed` is typically used in two ways
- `rand.Seed(time.Now().UnixNano())` -- we seed it, just to be sure to get some random, and not always get the same thing on every run. This is not needed, with global seeding, so those are just removed.
- `rand.Seed(1)` this is typically done to ensure we have a stable test. If we rely on this, we need to fix up the tests to use a deterministic prng-source. A few occurrences like this has been replaced with a proper custom source.
`rand.Read` has been replaced by `crypto/rand`.`Read` in this PR.
2 years ago
Delweng
b196ad1c16
all: add whitespace linter ( #25312 )
...
* golangci: typo
Signed-off-by: Delweng <delweng@gmail.com>
* golangci: add whietspace
Signed-off-by: Delweng <delweng@gmail.com>
* *: rm whitesapce using golangci-lint
Signed-off-by: Delweng <delweng@gmail.com>
* cmd/puppeth: revert accidental resurrection
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2 years ago
Felix Lange
9244d5cd61
all: update license headers and AUTHORS from git history ( #24947 )
3 years ago
Felföldi Zsolt
65689e7fce
les/vflux/server: fix priority cornercase causing fuzzer timeout ( #22650 )
...
* les/vflux/server: fix estimatePriority corner case
* les/vflux/server: simplify inactiveAllowance == 0 case
4 years ago
Felföldi Zsolt
2d89fe0883
les: move client pool to les/vflux/server ( #22495 )
...
* les: move client pool to les/vflux/server
* les/vflux/server: un-expose NodeBalance, remove unused fn, fix bugs
* tests/fuzzers/vflux: add ClientPool fuzzer
* les/vflux/server: fixed balance tests
* les: rebase fix
* les/vflux/server: fixed more bugs
* les/vflux/server: unexported NodeStateMachine fields and flags
* les/vflux/server: unexport all internal components and functions
* les/vflux/server: fixed priorityPool test
* les/vflux/server: polish balance
* les/vflux/server: fixed mutex locking error
* les/vflux/server: priorityPool bug fixed
* common/prque: make Prque wrap-around priority handling optional
* les/vflux/server: rename funcs, small optimizations
* les/vflux/server: fixed timeUntil
* les/vflux/server: separated balance.posValue and negValue
* les/vflux/server: polish setup
* les/vflux/server: enforce capacity curve monotonicity
* les/vflux/server: simplified requestCapacity
* les/vflux/server: requestCapacity with target range, no iterations in SetCapacity
* les/vflux/server: minor changes
* les/vflux/server: moved default factors to balanceTracker
* les/vflux/server: set inactiveFlag in priorityPool
* les/vflux/server: moved related metrics to vfs package
* les/vflux/client: make priorityPool temp state logic cleaner
* les/vflux/server: changed log.Crit to log.Error
* add vflux fuzzer to oss-fuzz
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
4 years ago
Felföldi Zsolt
62d8022b51
les: fix UDP connection query ( #22451 )
...
This PR fixes multiple issues with the UDP connection pre-negotiation feature:
- the enable condition was wrong (it checked the existence of the DiscV5 struct where it wasn't initialized yet, disabling the feature even if discv5 was enabled)
- the server pool queried already connected nodes when the discovery iterators returned them again
- servers responded positively before they were synced and really willing to accept connections
Metrics are also added on the server side that count the positive and negative replies to served connection queries.
4 years ago
Felföldi Zsolt
d96870428f
les: UDP pre-negotiation of available server capacity ( #22183 )
...
This PR implements the first one of the "lespay" UDP queries which
is already useful in itself: the capacity query. The server pool is making
use of this query by doing a cheap UDP query to determine whether it is
worth starting the more expensive TCP connection process.
4 years ago
Felföldi Zsolt
c027507e03
les: renamed lespay to vflux ( #22347 )
4 years ago
Felföldi Zsolt
85d81b2cdd
les: remove clientPeerSet and serverSet ( #21566 )
...
* les: move NodeStateMachine from clientPool to LesServer
* les: new header broadcaster
* les: peerCommons.headInfo always contains last announced head
* les: remove clientPeerSet and serverSet
* les: fixed panic
* les: fixed --nodiscover option
* les: disconnect all peers at ns.Stop()
* les: added comments and fixed signed broadcasts
* les: removed unused parameter, fixed tests
4 years ago
Felföldi Zsolt
4996fce25a
les, les/lespay/server: refactor client pool ( #21236 )
...
* les, les/lespay/server: refactor client pool
* les: use ns.Operation and sub calls where needed
* les: fixed tests
* les: removed active/inactive logic from peerSet
* les: removed active/inactive peer logic
* les: fixed linter warnings
* les: fixed more linter errors and added missing metrics
* les: addressed comments
* cmd/geth: fixed TestPriorityClient
* les: simplified clientPool state machine
* les/lespay/server: do not use goroutine for balance callbacks
* internal/web3ext: fix addBalance required parameters
* les: removed freeCapacity, always connect at minCapacity initially
* les: only allow capacity change with priority status
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
4 years ago
Binacs
4366c45e4e
les: make clientPool.connectedBias configurable ( #21305 )
4 years ago
gary rong
2e1ecc02bd
les, miner, accounts/abi/bind: fix load-sensitive unit tests ( #20698 )
5 years ago
Felföldi Zsolt
422604b438
les: rename UpdateBalance to AddBalance and simplify return format ( #20304 )
5 years ago
Felföldi Zsolt
bf5c6b29fa
les: implement server priority API ( #20070 )
...
This PR implements the LES server RPC API. Methods for server
capacity, client balance and client priority management are provided.
5 years ago
gary rong
b9bac1f384
les: fix and slim the unit tests of les ( #20247 )
...
* les: loose restriction of unit tests
* les: update unit tests
* les, light: slim the unit tests
5 years ago
gary rong
0ce5e113be
les: rework clientpool ( #20077 )
...
* les: rework clientpool
5 years ago
gary rong
68502595f6
les: wait for all task goroutines before dropping the peer ( #20010 )
...
* les: wait all task routines before drop the peer
* les: address comments
* les: fix issue
5 years ago
Felföldi Zsolt
a7de796840
les: implement new client pool ( #19745 )
5 years ago