Commit Graph

79 Commits

Author SHA1 Message Date
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>
2022-07-25 13:14:03 +03:00
Felix Lange
f6ac80c507
cmd/geth, cmd/devp2p: fix some cli parsing issues (#25234)
* cmd/geth: add some missing argument count checks

* internal/flags: skip cmds with no action func in MigrateGlobalFlags

* internal/flags: add Merge

* cmd/devp2p: re-add listener config flags in discv4 commands
2022-07-04 19:52:19 +02:00
Seungbae.yu
2697e44d81
all: change format 0x%x to %#x (#25221) 2022-07-04 11:03:32 +03:00
willian.eth
52ed3570c4
cmd: migrate to urfave/cli/v2 (#24751)
This change updates our urfave/cli dependency to the v2 branch of the library.
There are some Go API changes in cli v2:

- Flag values can now be accessed using the methods ctx.Bool,
  ctx.Int, ctx.String, ... regardless of whether the flag is 'local' or
  'global'.

- v2 has built-in support for flag categories. Our home-grown category
  system is removed and the categories of flags are assigned as part of
  the flag definition.

For users, there is only one observable difference with cli v2: flags must now
strictly appear before regular arguments. For example, the following command is
now invalid:

   geth account import mykey.json --password file.txt

Instead, the command must be invoked as follows:

   geth account import --password file.txt mykey.json
2022-06-27 18:22:36 +02:00
lmittmann
bc013bc42e
all: prefer new(big.Int) over big.NewInt(0) (#25087)
minor performance improvement: `big.NewInt(0).Xxx` -> `new(big.Int).Xxx`
2022-06-14 15:09:48 +03:00
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.
2022-06-13 16:24:45 +02:00
Felix Lange
9244d5cd61
all: update license headers and AUTHORS from git history (#24947) 2022-05-24 20:39:40 +02:00
Håvard Anda Estensen
07508ac0e9
all: replace uses of ioutil with io and os (#24869) 2022-05-16 11:59:35 +02:00
rjl493456442
344d6f95cf
cmd: group network and db path flags together (#24698)
This PR groups all built-in network flags together and list them in the command as a whole.

And all database path flags(datadir, ancient) are also grouped, since usually these two are
used together.
2022-05-03 08:46:17 +02:00
s7v7nislands
195c2d3d69
cmd/*: refactor get flag value (#24761) 2022-04-26 09:32:31 +02:00
Martin Holst Swende
6ce4670bc0
cmd/devp2p: implement snap protocol testing (#24276)
This also contains some changes to the protocol handler to
make the tests pass.
2022-02-04 15:24:32 +01:00
Martin Holst Swende
ad7c90c198
cmd/devp2p/internal/v4test: fix false-positive hive test (#23966)
This PR fixes two problems in devp2p tests (and through them, hive).

- Make the output more detailed about what is returned (always print packet kind).
- Allow Ping response to unsolicited findnode.

Without this PR, nethermind fails a hive protocol test, and I misinterpreted the result (NethermindEth/nethermind#3617). Ergo, the output was not fool-proof.
2021-11-24 21:22:45 +01:00
meowsbits
5358e491f3
cmd/devp2p: update TTL max for Cloudflare (#23885)
This was apparently recently changed by Cloudflare, and
began returning an error: 'TTL must be between 60 and 86400
seconds, or 1 for Automatic'

Date: 2021-11-10 15:25:20-08:00
Signed-off-by: meows <b5c6@protonmail.com>
2021-11-11 17:07:11 +01:00
Martin Holst Swende
0efed7f58b
cmd/devp2p/internal/ethtest: clarify protocol version in tests (#23872)
Debugging recent geth failures in hive, it took a while to realize that it's because
geth doesn't support eth/65 any longer. This PR makes such failures a bit more
easy to figure out.
2021-11-09 14:45:34 +01:00
Martin Holst Swende
e1c000b0dd
cmd/geth: add support for sepolia testnet (#23730)
* cmd/geth: add support for sepolia testnet

* core: last details on sepolia genesis

* params: fix sepolia hash + reduce testing code

* Update params/bootnodes.go

* cmd/geth: fix attach path for sepolia

* params: update bootnodes

* params: fix

* core: fix docstring

* params: add sepolia CHT
2021-11-08 13:06:01 +02:00
Marius van der Wijden
84ff152de5
cmd/devp2p/internal/ethtest: only use eth66 if eth66 is negotiated (#23568)
* cmd/devp2p/internal/ethtest: only use eth66 if eth66 is negotiated

* cmd/devp2p/internal/ethtest: switch on concrete type not pointer

* cmd/devp2p/internal/ethtest: switch on concrete type not pointer
2021-09-15 10:52:48 +02:00
baptiste-b-pegasys
154b525ce8
cmd/devp2p/internal/ethtest: remove WriteTo method (#23379)
WriteTo is unused, and go vet warns about it because it
doesn't match the usual signature of the io.WriterTo method.
2021-08-25 19:06:42 +02:00
Péter Szilágyi
0db0b27754
Revert "Revert "eth: drop eth/65, the last non-reqid protocol version" (#23426)" (#23456)
This reverts commit c368f728c1.
2021-08-24 21:52:58 +03:00
Péter Szilágyi
c368f728c1
Revert "eth: drop eth/65, the last non-reqid protocol version" (#23426) 2021-08-20 15:14:21 +03:00
Péter Szilágyi
fd604becbb
Merge pull request #23120 from karalabe/drop-eth-65
eth: drop eth/65, the last non-reqid protocol version
2021-08-13 11:52:47 +03:00
Martin Holst Swende
4cd6a1458e
cmd/devp2p: fix ping/pong race in discv4 tests (#23306)
This PR modifies the post-PING-send expectations to both be laxer and stricter: it doesn't care what order the packets arrive, but also verifies that exactly one PING and one PONG is returned.
2021-08-03 11:21:39 +02:00
Martin Holst Swende
b9d4412715
cmd/devp2p: fixes for eth and discv4 tests (#23155)
This PR fixes a false positive PONG 'to' endpoint mismatch seen in hive tests:

    got {IP:172.17.0.7 UDP:44025 TCP:44025}, want {IP:172.17.0.7 UDP:44025 TCP:0}

Co-authored-by: Felix Lange <fjl@twurst.com>
2021-07-07 17:28:14 +02:00
Péter Szilágyi
d3f018fde8
eth: drop eth/65, the last non-reqid protocol version 2021-06-29 12:31:30 +03:00
Felix Lange
ee35ddc8fd
cmd/devp2p/internal/ethtest: ignore block announcement in tx test (#22957) 2021-05-27 20:53:33 +02:00
rene
d836ad141e
cmd/devp2p/internal/ethtest: add block hash announcement test (#22535) 2021-05-27 11:57:49 +02:00
rene
49bde05a55
cmd/devp2p: refactor eth test suite (#22843)
This PR refactors the eth test suite to make it more readable and
easier to use. Some notable differences:

- A new file helpers.go stores all of the methods used between
  both eth66 and eth65 and below tests, as well as methods shared
  among many test functions.
- suite.go now contains all of the test functions for both eth65
  tests and eth66 tests.
- The utesting.T object doesn't get passed through to other helper methods,
  but is instead only used within the scope of the test function,
  whereas helper methods return errors, so only the test function
  itself can fatal out in the case of an error.
- The full test suite now only takes 13.5 seconds to run.
2021-05-25 23:09:11 +02:00
rene
0f3a1e7f9b
cmd/devp2p/internal/ethtest: send simultaneous requests on one connection (#22801)
This changes the SimultaneousRequests test to send the requests from the same
connection, as it doesn't really make sense to test whether a node can respond
to two requests with different request IDs from separate connections.
2021-05-05 12:27:27 +02:00
rene
8ff98108e5
cmd/devp2p: fix flakey tests in CI (#22757)
This PR fixes a couple of issues in the eth test suite that caused flakiness when run in the CI.
2021-04-30 22:47:36 +02:00
rene
e4270cacf4
cmd/devp2p: fix flaky SameRequestID test (#22754) 2021-04-28 21:38:38 +02:00
Martin Holst Swende
0c99868416
cmd/devp2p, eth/protocols/eth: fix tests + make sanity checks earlier (#22749) 2021-04-28 08:48:07 +02:00
rene
cac1b21d39
cmd/devp2p/internal/ethtest: add more tx propagation tests (#22630)
This adds a test for large tx announcement messages, as well as a test to
check that announced tx hashes are requested by the node.
2021-04-23 18:14:39 +02:00
rene
ea54c58d4f
cmd/devp2p/internal/ethtest: run test suite as Go unit test (#22698)
This change adds a Go unit test that runs the protocol test suite
against the go-ethereum implementation of the eth protocol.
2021-04-23 11:15:42 +02:00
Felix Lange
653b7e959d
cmd/devp2p: add dns nuke-route53 command (#22695) 2021-04-19 14:54:55 +02:00
Felix Lange
424656519a
cmd/devp2p: add support for -limit option in nodeset filter command (#22694)
The new -limit option makes the filter operate on top N nodes by score.
This also adds ENR attribute stats in the nodeset info command.
Node set commands are now documented in README.
2021-04-19 14:54:38 +02:00
Felix Lange
27056f62e5
cmd/devp2p: update to newer cloudflare API client (#22588)
This upgrades the cloudflare client dependency to v0.14.0. The new
version changes the API because all methods now require a context
parameter. This change also reduces the log level of the 'Skipping...'
message to debug, following a similar change in the AWS deployer.
2021-03-26 23:15:20 +02:00
Felix Lange
bed74b38d9
cmd/devp2p: fix comparison of TXT record value (#22572)
* cmd/devp2p: fix comparison of TXT record value

The AWS API returns quoted DNS strings, so we must encode the new value
before comparing it against the existing record content.

* cmd/devp2p: add test

* cmd/devp2p: fix typo and rename val -> newValue
2021-03-25 13:32:32 +02:00
Felix Lange
5129cdc4f0
cmd/devp2p: skip ENR field tails properly in nodeset filter (#22565)
In Geth v1.10, we changed the structure of the "les" ENR entry. As a result, the DHT crawler that creates the DNS lists
no longer recognizes the les nodes, which is fixed in this commit. 

* cmd/devp2p: skip ENR field tails properly in nodeset filter
* cmd/devp2p: fix tail decoder for snap as well
* les: fix tail decoding in "eth" ENR entry
2021-03-24 12:32:39 +01:00
rene
36b51b8156
cmd/devp2p: add old block announcement test to eth test suite (#22474)
Add old block announcement test to eth test suite, checks to make sure old block announcement isn't propagated
2021-03-20 19:50:44 +01:00
Martin Holst Swende
5bf6612a2e
cmd/devp2p: fix error in updating the cursor when collecting records for route53 (#22538)
This PR fixes a regression introduced in #22360, when we updated to the v2 of the AWS sdk, which causes current crawler to just get the same first 100 results over and over, and get stuck in a loop.
2021-03-20 10:35:22 +01:00
Felix Lange
9429ab1472
cmd/devp2p: add flag for AWS region (#22537) 2021-03-20 00:22:24 +01:00
rene
d3040a80d7
cmd/devp2p/internal/ethtest: skip eth/66 tests when v66 not supported (#22460) 2021-03-19 15:15:39 +01:00
Quest Henkart
e3a3f7cd64
cmd/devp2p: use AWS-SDK v2 (#22360)
This updates the DNS deployer to use AWS SDK v2. Migration is relatively
seamless, although there were two locations that required a slightly
different approach to achieve the same results. In particular, waiting for
DNS change propagation is very different with SDK v2. 

This change also optimizes DNS updates by publishing all changes before
waiting for propagation.
2021-03-19 13:15:57 +01:00
rene
6a528fce33
cmd/devp2p/internal/ethtest: return request ID in BlockHeaders response (#22508)
This PR fixes an issue with the eth66 test suite where, during a readAndServe when
the test is manually responding to GetBlockHeader requests, it now responds
with a BlockHeaders eth66 packet that includes the inbound request ID.
2021-03-19 10:57:23 +01:00
Martin Holst Swende
3f74c8e0e5
cmd/devp2p: better testcase failure output for ethtests (#22482) 2021-03-13 21:33:30 +01:00
rene
de9465f991
cmd/devp2p: add eth66 test suite (#22363)
Co-authored-by: Martin Holst Swende <martin@swende.se>
2021-02-25 18:36:01 +01:00
rene
f9445e93bb
cmd/devp2p/internal/ethtest: use shared message types (#22315)
This updates the eth protocol test suite to use the message type
definitions of the 'production' protocol implementation in eth/protocols/eth.
2021-02-16 15:23:03 +01:00
rene
111abdcfbd
cmd/devp2p: fix documentation for eth-test (#22298) 2021-02-11 12:09:13 +01:00
Martin Holst Swende
d7a64dc02b
cmd/devp2p: add node filter for snap + fix arg error (#21950) 2020-12-03 13:16:20 +01:00
Marius van der Wijden
a1ddd9e1d3
cmd/devp2p/internal/ethtest: add transaction tests (#21857) 2020-11-30 15:23:48 +01:00
Alex Prut
810f9e057d
all: remove redundant conversions and import names (#21903) 2020-11-25 21:00:23 +01:00