45 Commits

Author SHA1 Message Date
Sally MacFarlane
6791c5fea6 remove k8s NAT method (#8289)
* remove k8s NAT method

Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>

* changelog - update pr number in changelog

Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>

---------

Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>
2025-02-14 09:53:40 +10:00
Fabio Di Fabio
937c25acdd Update Java dependencies (#7786)
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
2024-10-21 09:49:06 +00:00
Sally MacFarlane
89dfa95860 [CHANGELOG] upcoming breaking change for k8s nat (#7534)
* upcoming breaking change for k8s nat
* log warning if deprecated NAT method used

Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>

---------

Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>
2024-09-16 13:26:14 +10:00
Matilda-Clerke
da98fa5541 Reintroduce engine get client version v1 with commit in manifest (#7548)
* Include Commit-Hash in manifests
* Add commit method in BesuInfo
* Use 8 character hash in EngineGetClientVersionV1 and revert calculateVersion back to original spec

Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Co-authored-by: garyschulte <garyschulte@gmail.com>
2024-08-30 18:13:53 +00:00
sirawt
8fc80ade8d chore: fix some typos (#7438)
Signed-off-by: MASDXI <sirawitt42@gmail.com>
2024-08-12 10:23:33 +10:00
Sally MacFarlane
39e276fd10 Refactor - eliminate non-constant string concatenation from debug and trace (#7336)
* eliminate non-constant string concatenation from debug and trace

Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>

* adjustments

Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>

---------

Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>
2024-07-18 11:29:17 +10:00
cangqiaoyuzhuo
90d2db9736 chore: fix some comments (#7215)
Signed-off-by: cangqiaoyuzhuo <850072022@qq.com>
Co-authored-by: Sally MacFarlane <macfarla.github@gmail.com>
2024-06-13 14:06:08 +10:00
Usman Saleem
42e9139265 build: Add default constructor and javadoc for metrics, nat, pki, plugins, services, testutil, util (#7071)
Signed-off-by: Usman Saleem <usman@usmans.info>
2024-05-08 04:39:10 +00:00
Usman Saleem
4c3f4b37a2 build - Update license headers formatting (#7017)
Fix headers formatting under: enclave/ evm/ nat/ pki/ util/
---------

Signed-off-by: Usman Saleem <usman@usmans.info>
2024-05-01 00:36:34 +00:00
Usman Saleem
e954537fcc build - Refactor Besu custom error prone dependency (#6692)
Move Besu custom error-prone checks into its own repository and use it as an external dependency. This allows to move to a newer version of Google errorprone checks as well while cleaning up build.gradle file.

Key changes resulted due to this change:

* String toLowerCase and toUpperCase to use Locale.ROOT as argument
* Use interface such as List,Map or NavigatableMap instead of concrete class where appropriate.
* Simplify StringBuilder to plain String
* Suppress warnings where appropriate.
-----
Signed-off-by: Usman Saleem <usman@usmans.info>
2024-03-27 06:17:40 +10:00
garyschulte
945a44c598 add a fallback for docker detection on Mac (#6356)
Signed-off-by: garyschulte <garyschulte@gmail.com>
2024-01-11 09:01:01 -08:00
Sally MacFarlane
0c122732c6 removed vintage junit dependency (#6296)
Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>
2023-12-14 11:53:37 +01:00
Fabio Pirola
d94ea7758e [#5561]migrate tests to junit5 (#6122)
* migrate teste from Junit4 to Junit5

Signed-off-by: Fabio Pirola <fspirola@gmail.com>

* migrate test from Junit4 to Junit5

Signed-off-by: Fabio Pirola <fspirola@gmail.com>

* #5571 besu - migrate tests from Junit4 to Junit5

Signed-off-by: Fabio Pirola <fspirola@gmail.com>

* #5571migrate-tests-to-Junit5

Signed-off-by: Fabio Pirola <fspirola@gmail.com>

* #5561migrate-tests-to-Junit5

Signed-off-by: Fabio Pirola <fspirola@gmail.com>

* [#5561] remove ide files

Signed-off-by: Fabio Pirola <fspirola@gmail.com>

* [#5561] remove ide files

Signed-off-by: Fabio Pirola <fspirola@gmail.com>

---------

Signed-off-by: Fabio Pirola <fspirola@gmail.com>
Co-authored-by: Sally MacFarlane <macfarla.github@gmail.com>
2023-11-21 19:16:48 +10:00
Usman Saleem
9eb32836b7 Fix javadocs to allow build to pass in JDK 17 (#4834)
- Added missing javadocs so that javadoc doclint passes against JDK 17 (invoke by Besu gradle build).
- Exclude following packages from javadoc lint:
org.hyperledger.besu.privacy.contracts.generated
org.hyperledger.besu.tests.acceptance.*
- Temporarily exclude ethereum and evm submodule for doc lint checks.
- Run the javadoc task using GitHub actions (use Java 17) to report any javadoc errors during the PR builds
- Updating plugin-api build.gradle with new hash as javadoc comments caused it to change

Signed-off-by: Usman Saleem <usman@usmans.info>
2023-01-18 22:51:00 +10:00
Antony Denyer
5ea8014a5e Print full exception when NatService fails to configure automaticially (#4023)
https://github.com/hyperledger/besu/issues/3787

Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
2022-06-29 10:15:36 +01:00
Antony Denyer
bbb70903ff Improve logging in NatService (#4006)
Improve logging in NatService to clarify what's happening. Increase log severity as it can cause peers to fail to connect when running in k8s.

Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
2022-06-24 13:28:20 +01:00
Diego López León
2cf97a0e67 Replace expected Junit 4 @Test field with assertThatThrownBy (#3814)
* Fix two operand stack tests

Signed-off-by: Diego López León <dieguitoll@gmail.com>

* Remove unreachable assert

Signed-off-by: Diego López León <dieguitoll@gmail.com>

* Replace expected annotation field with assert

Signed-off-by: Diego López León <dieguitoll@gmail.com>

* Extract variables to let only a single call for assert

Signed-off-by: Diego López León <dieguitoll@gmail.com>

Co-authored-by: Sally MacFarlane <sally.macfarlane@consensys.net>
2022-05-12 08:08:31 +10:00
Danno Ferrin
b4027d6e39 Use JUnit 5 for unit test execution (#3620)
Change the unit test execution to use the Junit5 JUnitPlatform. This
allows for a mix of junit 4 and junit 5 tests and for a gradual
migration to junit 5 instead of a big bang. One class depended on
junit 4 exceptions and was updated. Two tests depending on 
native libraries fail gracefully on mac (and only mac).

Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
2022-04-02 00:34:48 +10:00
Sandra Wang
69a375b823 [#2766]fix: clean up deprecation warnings (#3511)
* clean up deprecation warnings
*Quantity Interface getValue()
* LegacyPrivateStateStorage
* GraphQLDataFetcherContext

Signed-off-by: Sandra Wang <yx97.wang@gmail.com>

Co-authored-by: Sally MacFarlane <sally.macfarlane@consensys.net>
2022-03-11 14:08:55 +10:00
Diego López León
ed1329cf84 Introduce SLF4J for logging (#3285)
* Bump SLF4J version

Signed-off-by: Diego López León <dieguitoll@gmail.com>

* Replace log4j2 API with SLF4j API

Signed-off-by: Diego López León <dieguitoll@gmail.com>

* Replace usage of LogManager#getFormatterLogger

This is for keeping compatibility with SLF4J. If neccesary, a specific formatter can be created for the RlpBlockImporter class

Signed-off-by: Diego López León <dieguitoll@gmail.com>

* Unset the default logging value for the retesteth

This is because it's not possible to resolve the root logger level into a Log4J2 field

Signed-off-by: Diego López León <dieguitoll@gmail.com>

* Prevent creation of Logger context outside SLF4J

org.hyperledger.besu.cli.BesuCommand#setAllLevels was taken from
https://github.com/apache/logging-log4j2/blob/rel%2F2.17.1/log4j-core/src/main/java/org/apache/logging/log4j/core/config/Configurator.java#L309

Signed-off-by: Diego López León <dieguitoll@gmail.com>

* Add FATAL level deprecation message

Signed-off-by: Diego López León <dieguitoll@gmail.com>

* [Sonar] Fix java:S2139

Exceptions should be either logged or rethrown but not both

Signed-off-by: Diego López León <dieguitoll@gmail.com>

* [Sonar] Fix java:S3457

Printf-style format strings should be used correctly

Signed-off-by: Diego López León <dieguitoll@gmail.com>

* Add changelog

Signed-off-by: Diego López León <dieguitoll@gmail.com>
2022-01-25 20:14:54 -03:00
Sally MacFarlane
a718ec2dcc [MINOR] testing: changed more classes to MockitoJunitRunner (#3311)
* changed runner and removed unnecessary mockito stubbings

Signed-off-by: Sally MacFarlane <sally.macfarlane@consensys.net>
2022-01-24 07:29:35 +10:00
Frank Li
c07175ca48 Add upnp only for p2p nat method (#3250)
* new natmethod enum

Signed-off-by: Frank Li <b439988l@gmail.com>

* more tests

Signed-off-by: Frank Li <b439988l@gmail.com>

* more test

Signed-off-by: Frank Li <b439988l@gmail.com>
2022-01-11 04:54:11 -05:00
Sally MacFarlane
2fbd04a8e8 Kubernetes 14 (#3263)
* update to 7.0.1 and change package names

Signed-off-by: Sally MacFarlane <sally.macfarlane@consensys.net>

* Updating packages of our kubernates imports

Signed-off-by: Jiri Peinlich <jiri.peinlich@gmail.com>

* Updating kubernates client verion to 14.0

Signed-off-by: Jiri Peinlich <jiri.peinlich@gmail.com>

Signed-off-by: Sally MacFarlane <sally.macfarlane@consensys.net>

* added cddl with classpath extension as an alias

Signed-off-by: Sally MacFarlane <sally.macfarlane@consensys.net>

* get rid of builders

Signed-off-by: Sally MacFarlane <sally.macfarlane@consensys.net>

Co-authored-by: Jiri Peinlich <jiri.peinlich@gmail.com>
2022-01-11 16:35:09 +10:00
Sally MacFarlane
00993bec19 Updating kubernetes dependency (#3236)
* 6.0.1

Signed-off-by: Sally MacFarlane <sally.macfarlane@consensys.net>

* Removing includeUninitialized parameter

New version of the client-java-api-6.0.1.jar does not have the includeUnitialized parameter on the method.

Signed-off-by: Jiri Peinlich <jiri.peinlich@gmail.com>

* 6.0.1 compiles successfully

Signed-off-by: Sally MacFarlane <sally.macfarlane@consensys.net>

Co-authored-by: Jiri Peinlich <jiri.peinlich@gmail.com>
2022-01-06 08:36:50 +10:00
Sally MacFarlane
c0b1316d7b deprecation: replace calls to isEqualToComparingFieldByField (#3042)
* replace isEqualToComparingFieldByField with usingRecursiveComparison().isEqualTo

Signed-off-by: Sally MacFarlane <sally.macfarlane@consensys.net>

* isEqualTo()

Signed-off-by: Sally MacFarlane <sally.macfarlane@consensys.net>

* revert ibft and qbft tests back to compareFieldByField

Signed-off-by: Sally MacFarlane <sally.macfarlane@consensys.net>

* revert tests back to compareFieldByField

Signed-off-by: Sally MacFarlane <sally.macfarlane@consensys.net>
2021-11-15 20:20:59 +10:00
Danno Ferrin
3eccc26742 Gradle 7.1.1 and Dependency Version Upgrades (#2596)
Upgrade Gradle to 7.1.1.
Add Gradle configs to allow Java 16 compilation.
Upgrade most dependencies to current versions.

Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
2021-08-04 01:39:24 +10:00
Danno Ferrin
fd59570e2c Update spotless and google-java-format (#2593)
Update spotless to 5.14.2 and java-google-format to 1.10.0.
Both of these are needed to support Java 16 and Gradle 7.x.

Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
2021-07-28 22:44:27 -06:00
Danno Ferrin
f14f28b977 Cleanup logging statements (#1500)
A few logging statements had errors in the log statement.  Either the
parameter wasn't used or it was expecting a formatted logger for errors.

Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
2020-10-30 09:13:08 -06:00
Karim T
50db46f855 Add cluster ip for Kubernetes Nat Manager (#1156)
- Add compatibility with ClusterIP services in the kubernetes nat manager
- Add new Xnat-method-fallback-enabled flag

Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
2020-07-01 19:21:51 +02:00
Karim T
2ef6fe4998 Add cli option to specify the name of the loadbalancer used by the Kubernetes nat manager (#1078)
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
2020-06-16 13:09:08 +02:00
Karim T
d927446303 Improve log nat manager (#1058)
Improvement of nat manager logs to avoid false positives when running on a kubernetes environment.

Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
2020-06-08 18:41:29 +02:00
Karim T
7371d56421 Remove manual nat manager (#1041)
The NAT manager's `MANUAL` method has been removed. This mode does not seem really useful because it does the same thing as a NONE mode. 

Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
2020-06-05 18:34:17 +02:00
Karim T
73fbd31937 Revert "Remove manual nat manager (#921)" (#925)
This reverts commit 013280b843.

We must wait for a quarterly version before changing the CLI options

Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
2020-05-14 18:12:40 +02:00
Karim T
013280b843 Remove manual nat manager (#921)
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>

This mode does not seem really useful because it does the same thing as a NONE mode (it takes the parameters p2p-host, p2p-port, etc). At the moment this mode does not bring much and seems to be confusing. To avoid confusion the best is to delete ManualNatManager
2020-05-14 12:22:06 +02:00
Danno Ferrin
5a7e1fcd28 Loggers should be private, static and final. Enforced with errorprone (#823)
Some of our loggers were not private, static, and final.  In a few
cases these were non-static fields in classes that were repeatedly
instantiated in core transaction logic.

This is enforced via a new ErrorProne check, so the PR includes fixes
for all of the places this was a problem, not just the performance
impacting code.

Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
2020-04-30 16:51:58 -06:00
Karim T
d7a65c0eba [BESU-507] Resolve crashing NAT detectors on GKE (#731)
Resolve the NatManager crash when besu is launched on GKE and improved logs when switching to the fallback mode. It is no longer necessary in KUBERNETES to create a volume and to move the kubeconfig file in this volume.
Signed-off-by: Karim TAAM karim.t2am@gmail.com
2020-04-17 14:47:27 +02:00
Karim T
565508402a [BESU-531] Implement fallback method for Nat (#692)
* Log to trace denied because of host whitelisting (#663)

When we deny a connection based on HTTP hostname log to trace the
rejected value.

Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
Co-authored-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>

* implement fallback for nat

Signed-off-by: Karim TAAM <karim.t2am@gmail.com>

* fix unit test

Signed-off-by: Karim TAAM <karim.t2am@gmail.com>

* spotlessApply

Signed-off-by: Karim TAAM <karim.t2am@gmail.com>

* clean documentation

Signed-off-by: Karim TAAM <karim.t2am@gmail.com>

Co-authored-by: Danno Ferrin <danno.ferrin@gmail.com>
Co-authored-by: Usman Saleem <usman@usmans.info>
Co-authored-by: Abdelhamid Bakhta <45264458+abdelhamidbakhta@users.noreply.github.com>
2020-04-09 18:59:11 +02:00
Karim T
8a68402732 [BOUNTY-4] Add NAT Kubernetes Support (#410)
* add kubernetes support

Signed-off-by: Karim TAAM <karim.t2am@gmail.com>

* fix review issues

Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
2020-02-19 10:34:36 +01:00
Karim T
39826b1423 [BOUNTY-2] Add NAT Docker Support (#368)
* add docker detection

Signed-off-by: Karim TAAM <karim.t2am@gmail.com>

* add port mapping detection

Signed-off-by: Karim TAAM <karim.t2am@gmail.com>

* add tests and refactor ip detection

Signed-off-by: Karim TAAM <karim.t2am@gmail.com>

* clean RunnerBuilder

Signed-off-by: Karim TAAM <karim.t2am@gmail.com>

* clean useless modification

Signed-off-by: Karim TAAM <karim.t2am@gmail.com>

* spotless

Signed-off-by: Karim TAAM <karim.t2am@gmail.com>

* resolve tests issues

Signed-off-by: Karim TAAM <karim.t2am@gmail.com>

* streamline auto detection

Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>

Co-authored-by: Abdelhamid Bakhta <45264458+abdelhamidbakhta@users.noreply.github.com>
Co-authored-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
2020-02-10 21:13:20 +01:00
Danno Ferrin
838f7aa5e0 Fix Gradle 7.0 compatibility issues and build warnings (#288)
Removes as many Gradle 7.0 compatibility issues as possible
* `baseName` -> `archiveBaseName`
* `extension` -> `archiveExtension`
* `destinationDir` -> `destinationDirectory`
* `runtime` -> `runtimeOnly`
* Change some log4j-api and log4j-core dependencies
* Remove an unneeded and outdated plugin (`net.ltgt.apt`)
* tweak the plugin-api change detector's property annotations.

Warnings still exist with one external plugin used for license file
checking that we do not control the source code for.

Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
2020-01-13 08:28:50 -07:00
Karim T
624c25ec7e [BOUNTY-2] Explicit Configuration & General internal NAT API #190 (#298)
* refactor nat manager

Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>

* restart tests

Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>

* restart tests

Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>

* Add Tuweni to Plugin-APIs (#295)

Generally, byte[] -> Bytes of some form.  Most of the changes are the
side effect of the type changes or chaning to the names of Tuweni
equivilant calls (getHexString->toHexString, etc).

UnformattedData -> Bytes
Log Topics went from Hash to Bytes32
Difficulty went to UInt256 to match core impl.
Quantity lost BinaryData and is just getValue() and toHexString()

Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>

* DSL precondition to avoid creating orphan processes (#291)

Signed-off-by: Christopher Hare <chris.hare@consensys.net>

Co-authored-by: Danno Ferrin <danno.ferrin@shemnon.com>
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>

* Fix AT failure because of additional field sent by Orion (#299)

Signed-off-by: Stefan Pingel <stefan.pingel@consensys.net>
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>

* Update NatService.java

Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>

* Update NatServiceType.java

Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>

* Update NatServiceType.java

Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>

* Update NatServiceType.java

Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>

* Update NatServiceType.java

Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>

* remove method

Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>

* SPDX-License-Identifier: Apache-2.0

Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>

* SPDX-License-Identifier: Apache-2.0

Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>

* Comment waitForFile: "besu.networks"

Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>

* spotless apply

Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>

* test

Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>

* create file if not exist

Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>

* remove useless code

Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>

* fix waitForFile method

Signed-off-by: Karim TAAM <karim.t2am@gmail.com>

Co-authored-by: Danno Ferrin <danno.ferrin@shemnon.com>
Co-authored-by: CJ Hare <CjHare@users.noreply.github.com>
Co-authored-by: pinges <16143240+pinges@users.noreply.github.com>
Co-authored-by: Abdelhamid Bakhta <45264458+abdelhamidbakhta@users.noreply.github.com>
2020-01-09 22:16:09 +01:00
Danno Ferrin
5ec561a5b3 [PAN-3143] Handle zero port better in NAT (#147)
When setting the p2p port to zero and turning on UPNP nat an attempt is
made to map port zero.  This should actually map the opened port
instead.

The core logic is also now set up to throw an exception if a zero local
port is requested.

Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
2019-10-31 12:27:56 -06:00
Joshua Fernandes
bac5c673d3 Adding a spdx license check gradle task (#30)
* adding in spdx-license-identifier & updated check for the same; removing license check from spotless

Signed-off-by: Joshua Fernandes <joshua.fernandes@consensys.net>

* Change CheckSpdxHeader to a task.

Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
2019-09-20 14:59:57 +10:00
Joshua Fernandes
d6a2394e2d Migrating Pantheon to Besu (#1945)
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
2019-09-16 11:14:10 +10:00
Stephen Shelton
3e410b48fc Add UPnP Support (#1334)
Add support for working within Network Address Translation (NAT) environments.

This adds a CLI flag `--nat-method` with two options,  `NONE` (the default and 
current behavior) and `UPNP.`  `--nat-method` will affect what IP address and 
ports are advertised via the P2P discovery and other APIs that report the 
address and port for P2P actions.

`UPNP` is intended for a typical home or small office environment where a 
wireless router or modem provides NAT isolation. 
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
2019-07-06 12:50:52 -06:00