127 Commits

Author SHA1 Message Date
George Patterson
c25483c29f Validate that blockperiodseconds is set to a positive integer (#3186)
Implemented getPositiveInt function in JsonUtil to validate a JSON positive number value. Using this function, the blockperiodseconds should now be validated whenever retrieved from the genesis config, including transitions.

Signed-off-by: George Patterson <g-patt@outlook.com>
2022-01-05 01:28:46 +00:00
Danno Ferrin
ed9d64d9cb Version upgrades for 22Q1 (#3217)
* lots of errorprone fixes
* some license updates
* some mockito updates
* upgrade the rocksdb version
* Prometheus left at 0.9.0 as 0.10.0+ introduces OpenMetrics 
  related changes that break unit tests.

Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
2021-12-24 16:02:07 -07:00
Simon Dudley
6ad73e6375 QBFT migration: Create migrating mining coordinator (#3097)
Create MigratingMiningCoordinator, a schedulable mining coordinator that will switch between mining coordinators based on the consensus schedule.

https://github.com/hyperledger/besu/issues/2999

Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
2021-12-07 01:41:37 +00:00
Antoine Toulme
11f5cfb022 Upgrade to Apache Tuweni 2.0 (#2376)
* Upgrade to Apache Tuweni 2.0

Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>

* Remove intermediate repository

Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>

* Remove all occurrences of toBytes

Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>

* Migrate to tuweni-bytes

Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>

* add changelog

Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>

* correct reference tests

Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>

* Initial API changes

Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>

* more changes

Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>

* Change APIs for VM ops

Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>

* Use constant UInt256.ONE

Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>

* Optimize a bit address <> word transformation

Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>

* spotless

Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>
2021-07-17 00:15:27 +02:00
Danno Ferrin
55f7c502d3 Extract RollingFileReader and RollingFileWriter (#1614)
Extract RollingFileReader and RollingFileWriter to the utility package.

Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
2020-11-30 21:18:08 -07:00
mark-terry
e783dd7294 Added zero gasPrice validation for Quorum compatibility mode. (#1554)
* Added zero gasPrice validation + configuration checks for GoQuorum compatibility mode.

Signed-off-by: Mark Terry <mark.terry@consensys.net>
2020-11-16 13:25:04 +10:00
Antoine Toulme
b9364ed243 Upgrade to Apache Tuweni 1.2.0 (#1493)
* Upgrade to Apache Tuweni 1.2.0

Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>

* no jsr305

Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>

Co-authored-by: Danno Ferrin <danno.ferrin@gmail.com>
2020-11-05 15:40:42 -08:00
Danno Ferrin
223d6457f9 Update GraalVM detection in Platform Detector (#1286)
How the GraalVM reports itself in the vendor and vm flags has evolved in
newer version.  Report GraalVM if it is seen in either string.

Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
2020-08-07 15:41:21 -06:00
matkt
c8e23c970e Add ethstats support (#1239)
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
2020-08-04 09:54:20 +02:00
Ratan (Rai) Sur
c231d0e704 Migrate some OptionalInt's to Optional<Integer>s (#1242)
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
2020-07-23 11:35:33 -05:00
Ratan (Rai) Sur
78f203d8a3 Copy Subscribers to Prevent Unwanted Recursion (#1169)
Occasionally, a callback given to a subscriber will complete a future 
which then runs another task which adds another callback to the 
subscriber list of the same type. By the time the first callback is 
finished, the new callback (which presumably wants another "real" 
instance of the event to happen) could be next up in the list of the 
first's subscribers callback iteration. This takes a snapshot of the 
subscribers when the desired event happens so there's no risk of 
following down the rabbit hole.

I collected some rough data about the size of the subscriber lists to 
see the penalty for copying them and I found that by the time a full 
sync began or a fast sync had started downloading headers, the maximum 
subscribers any one Subscribers class had was 7.

Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
2020-07-08 10:42:55 -05:00
Danno Ferrin
256e5c914d Errorprone version upgrade (#1096)
Upgrade to ErrorProne 2.4.0

* public constructors on abstract classes are removed
* Javadoc must have meaningfull documentation
* lambdas should not be variables
* Added to the list of confusing inner class names (Entry and Type)
* no assert keyword in tests
* Obsolete JDK classes produce errors now

Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
2020-06-17 10:34:56 -06:00
Abdelhamid Bakhta
8589177e49 Fix EIP-2124 Fork identifier for chain compatibility checks. (#1050)
Before this pull request Besu was using the latest known fork id to create status message for Ethereum P2P protocol handshake.
This latest known fork id was created based on a list of forks retrieved from the Genesis.
For private networks it is possible that all fork blocks number are set to 0.
The algorithm to compute the valid fork hashes excludes 0 values.
As a result, the list was empty and the `getLatestForkId` was returning `null`. This is an issue when you support capabilities >= to Eth/64 sub protocol because other peers expect the fork id value in the `RLP` encoded message.
Moreover, the algorithm to compute the fork id should be aware of the chain head number and update `CRC` value only for fork blocks below the current head.
This pull request fixes this issue by fetching the chain head number and update accordingly the `CRC` value.
Unit tests have been extended to cover an exhaustive list of possible combinations on named networks (`goerli`, `rinkeby`, `ropsten` and `mainnet`).

Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
2020-06-09 17:59:35 +02:00
Ratan Rai Sur
fbdd5301b0 Replace FutureUtil method with standard library equivalent (#390)
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
2020-04-03 13:54:10 -04:00
Antoine Toulme
b9c6c4b3cc Add eth65 support (#608)
* Add eth65 support

Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>

* Fix integration tests

Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>

* Fix acceptance tests

Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>

* add acceptance test that checks that transactions are gossiped between peers

Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>

* Update ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/messages/LimitedNewPooledTransactionHashesMessages.java

Co-Authored-By: Danno Ferrin <danno.ferrin@shemnon.com>
Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>

* code review comments

Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>

* Code review changes

Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>

* Reviewing diffs

Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>

* smaller synchronized blocks

Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>

Co-authored-by: Danno Ferrin <danno.ferrin@shemnon.com>
2020-04-01 11:16:09 -07: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
Danno Ferrin
e493b91742 Restore "FieldCanBeFinal" errorprone check (#287)
This was turned off a number of months ago because of long build times.
However it appears either because of code structure changes or fixed
errorprone that this finishes in a reasonable time now.

Code that violated this check is also fixed.

Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
2020-01-02 10:27:54 -07:00
Danno Ferrin
dfad8bff78 Update Dependencies (#281)
Update dependencies to most current version
 - except picocli which is a major version update
Alphabetize dependencies

Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
2020-01-01 20:42:13 +13:00
Antoine Toulme
ccefada736 Move to Apache Tuweni Bytes library (#215)
Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
2019-12-20 12:05:15 +10:00
Ratan Rai Sur
271d578956 Log Event Streaming for Plugin API (#186)
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
2019-11-13 17:03:38 -05: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
mbaxter
684a01e202 [PAN-3140] Expand p2p config options (#1940)
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
2019-09-13 16:14:07 -04:00
Ratan Rai Sur
995ef1adba Ban junit assertions (#1939)
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
2019-09-13 17:37:51 +03:00
Edward
9856cd32b0 Ensure plugin-api module gets published at the correct maven path (#1905)
* Ensure `plugin-api` module gets published at the correct maven path
* Move `plugins` to `plugin-api`

Signed-off-by: Edward Evans <edward.evans@consensys.net>

Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
2019-09-05 10:29:30 +10:00
Edward
9601f44ac8 Return the plugin-apis to this repo (#1900)
* Return plugin-api to the main repo
* Spotless
* Migrate all external plugin-api references to the project in this repo
* Add licence header
* Update repo reference for publish, even if commented
* Use real configuration for publishing plugin-api

This was tested with the
`:plugins:publishMavenJavaPublicationToMavenLocal` task and checking the
local Maven repo to make sure it was using the correct paths

Signed-off-by: Edward Evans <edward.evans@consensys.net>

Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
2019-09-04 12:12:27 +10:00
Danno Ferrin
43cc4ce5c9 Support plugin Richdata APIs via implementation (#1581)
* Rich Data for Events Plugin

* plugin-api -> api

* use BinaryData as a root and add getValue to UInt256Value

* bring rick data changes in line with proposed APIs.

Undo orthagonal naming changes.

* add size

* use log and transaction interfaces from rich data api

* update to released plugin api version and add new event listener.

* add tests

* fix acceptance tests

Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
2019-08-23 09:39:56 +02:00
Danno Ferrin
3ca363c813 [PAN-2946] Add strict short hex strings for retesteth (#1812)
The retesteth program wants byte trimmed UInt256, but our current impl does
nybble trimmed data (which is what the JSON-RPC spec calls for).  Add an API
so we can do both.


Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
2019-08-01 09:39:37 -06:00
Danno Ferrin
7a022beea9 [PAN-2954] - Allow fixedDifficulty=1 to mean "all solutions" (#1784)
If you try and do a difficulty of 1 the UInt256 class used for comparison throws
an error because 2^256 is 33 bytes.  Instead use 2^256-1 which is 32.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
2019-07-30 09:25:11 -06:00
mbaxter
d48ca9e5a9 [PAN-2952] Add storage key preimage tracking (#1772)
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
2019-07-29 13:26:13 -04:00
Ivaylo Kirilov
2c64a9ceba [PAN-2852] privacy group id consistent (#1667)
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
2019-07-15 14:08:46 +12:00
Abdelhamid Bakhta
65fb548b8d Use a percentage instead of fraction for the remote connections percentage CLI option. (#1682)
* Factorise metrics code for KeyValueStorage database

- introduce `MonitorableKeyValueStorage`
- factorise code
- remove metrics instanciation in `RocksDbKeyValueStorage` and `ColumnarRocksDbKeyValueStorage`

* Rename class

* Use percentage instead of fraction

* add tests

* fix PR discussion

- introduce `PercentageConverter` and `FractionConverter` in `tech.pegasys.pantheon.cli.converter`
- use custom error message for `PercentageConversionException
`

* fix PR discussion

- return primitive types instead of objects for converters

* fix tests

Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
2019-07-12 17:39:20 +02:00
Abdelhamid Bakhta
dba3469de0 [PAN-1683] Limit the fraction of wire connections initiated by peers (#1665)
* [PAN-1683] Limit the fraction of wire connections initiated by peers

To protect against eclipse attacks, we should not allow all of our wire connections to be initiated from network peers.  Some fraction of wire connections should be initiated by our node by connecting to peers in our discovery peer table. This PR ensures the fraction abides the limit.

* change fraction default value and add tests

* make fraction of remote wire connections configurable

- add a cli option to configure the fraction: `--fraction-remote-connections-allowed`
- introduce `Fraction` class to handle the conversion of the CLI option to a double and check if the value is between 0.0 and 1.0
- add tests
- fix broken tests

* remove unused local variable

* fix RunnerTest

* set fraction to 1.0 in PantheonFactoryConfigurationBuilder

* update test

* Introduce --limit-remote-wire-connections-enabled

* fix unused field

* fix conflict

* Update ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/rlpx/RlpxAgent.java

Co-Authored-By: Danno Ferrin <danno.ferrin@shemnon.com>

* Update ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/rlpx/RlpxAgent.java

Co-Authored-By: Danno Ferrin <danno.ferrin@shemnon.com>

* Update ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/rlpx/RlpxAgent.java

Co-Authored-By: Danno Ferrin <danno.ferrin@shemnon.com>

* fix PR discussion and tests

Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
2019-07-11 19:06:21 +02:00
mbaxter
f5e841c018 [PAN-2797] Refactor experimental CLI options (#1629)
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
2019-07-02 16:22:53 -04:00
mbaxter
037a6e8527 [PAN-2783] Invert dependency between permissioning and p2p (#1557)
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
2019-06-14 11:19:39 -04:00
mbaxter
e89d2a72af [PAN-2731] Extract connection management from P2PNetwork (#1538)
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
2019-06-11 14:39:58 -04:00
mark-terry
7e29b0954b [FIX] Changed Enode length error String implementation. (#1486)
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
2019-05-23 14:42:59 +10:00
mbaxter
2a64902bd2 [PAN-2614] Add simple PeerPermissions interface (#1446)
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
2019-05-17 14:09:49 -04:00
Danno Ferrin
16982ebad2 Equals cleanup (#1434)
* Don't copy collections if we don't need to.  Change types higher up if needed.
* Don't use Guava's Object.equal, use Java's Objects.equals.
** add errorprone test to enforce the banning of Guava's Objects class.

Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
2019-05-13 13:42:12 -06:00
mbaxter
9bc8d8531b Update EnodeURL to support enodes with listening disabled (#1403)
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
2019-05-13 10:41:51 -04:00
Adrian Sutton
9bc721ff2a Unwrap DelegatingBytes32 and prevent Hash from wrapping other Hash instances (#1423)
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
2019-05-09 14:45:58 +10:00
mark-terry
4a2417a0c1 [PAN-2590] Improved JSON-RPC responses when EnodeURI parameter has invalid EnodeId (#1417)
* [PAN-2590] Improved error response for invalid EnodeID in Add/Remove JSON-RPC calls.

* [PAN-2590] Tests.

Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
2019-05-09 10:05:32 +10:00
mbaxter
f861d67115 Handle case where peers advertise a listening port of 0 (#1391)
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
2019-05-02 12:10:09 -04:00
mbaxter
f9641148df [PAN-2585] Prefer EnodeURL over Endpoint (#1378)
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
2019-05-01 11:25:41 -04:00
mbaxter
61d5734062 [PAN-2560] Consolidate p2p node info methods (#1288)
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
2019-04-16 00:00:12 -04:00
mbaxter
7a892e9943 Create EnodeURL Builder (#1275)
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
2019-04-14 19:28:34 -04:00
mbaxter
c7947b8185 Keep enode nodeId stored as a BytesValue (#1274)
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
2019-04-12 18:33:02 -04:00
mbaxter
e870ade816 Normalize EnodeURLs (#1264)
Only specify discovery port explicitly when the discovery port differs
from the listening port.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
2019-04-12 10:34:25 -04:00
Abdelhamid Bakhta
173480b5dc Feature/pie 1502 ewp options cli (#1246)
* EWP options management

- create `EthereumWireProtocolConfiguration` object to hold per request limits
- add `EthereumWireProtocolConfiguration` in `SynchronizerConfiguration`
- create `PositiveNumber` class to handle command line options representing a positive number (a request limit for example)
- add unit tests to cover the new options
fixes PIE-1502

* Update EthereumWireProtocolConfiguration.java

* Update PantheonCommandTest.java

* fix tests

* spotlessApply

* fix tests and javadoc

* Update pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java

Co-Authored-By: abdelhamidbakhta <45264458+abdelhamidbakhta@users.noreply.github.com>

* Update pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java

Co-Authored-By: abdelhamidbakhta <45264458+abdelhamidbakhta@users.noreply.github.com>

* Update pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java

Co-Authored-By: abdelhamidbakhta <45264458+abdelhamidbakhta@users.noreply.github.com>

* Update pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java

Co-Authored-By: abdelhamidbakhta <45264458+abdelhamidbakhta@users.noreply.github.com>

* fix

* fix PR discussion

* Update EthereumWireProtocolConfiguration.java

Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
2019-04-09 22:02:00 +02:00
Adrian Sutton
bac2828313 Pipeline chain download - fetch and import data (#1207)
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
2019-04-05 06:57:02 +10:00