* [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>
* Add privacy group id to private transaction
* Update enclave send methods to accept privacy group id
* Update eea sendRawTransaction endpoint
* extract privacy group id from private transaction if present
* extract privateFor/privateFrom if privacy group id is not present
* Fix tests
* Change abstract class invocation to concrete class.
* Utility method to load enclave public key
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Currently when json-rpc and ws services are configured with a port value of 0, the "net_services" endpoint will display their ports as "0". A configured port of "0" actually means "choose a random port". We need to get the actual port that those services are using displayed in the "net_services" JSON-RPC response.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
- refactor packages
- remove `PantheonExceptionHandler` inner class and create a separate class
- introduce subcommand package
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* [PAN-2850] Create a transaction pool configuration object
* fix unit test by adding equals and hash code methods
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* Renaming local config ATˆ
* Base work for account permissioning
* Updating simple account permissioning smart contract and genesis file
runtime bytecode
* Updating account ATs to use account object
* Fix isAllowed account permissioning transaction
* Fix allow/forbid account tx
* Updated node builder for account permissioningˆ
* Updated threaded and process AT node runners for account permissioning
* Created condition for checking balance not changing after some time
* Smart contract based account permissioning ATs
* Spotless
* Moved AccPermController build into RunnerBuilder
* Fix ProcessPantheonNodeRunner account permissioning setup
* Spotless
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
The acceptance test for "verifying that events get published when
transactions are removed because of chain reorganisation" is being
deleted because the way test case is simulating chain reorganisation
is resulting in an inconsistent number of events fired.
There are already unit test cases and other acceptance cases around
validating pending transactions events hence this test case can be
safely removed.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* Return specific error for enclave
* Serialize into error object instead of regex to find the error.
* Return EnclaveException for errors in Enclave
* Fix enclave error response after rebase
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* Prevents intermittent `eth_getFilterLogs` failure when the `filterId`
began with a hex 0. Previously leading 0's were not trimmed so depending
on the randomly generated value, a filter could appear to not exist in
the `FilterRegistry`
* standardize Quantity.format to Quantity.create
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* Use the external jars to provide the plugin libraries.
* Add mavenLocal to local repositories to aid development
* Remove the :plugins project
* Move the PantheonPluginContextImpl into :pantheon
* rename a few files
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* Do plugin lifecycle in ThreadPantheonNodeRunner
* Sniff out rendezvous directory for test during register call, it changes.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
In most places the RPC gets dropped. In a few places it made more sense
to rename to GraphQLHttp when we are talking about the HTTP Server and
service.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* It returns for any block we would broadcast to other peers, when
we would broadcast them.
* It returns a JSON String containing hash, number, and timestamp
* This event data is not set in stone, it may change in type or content.
* Acceptance tests and unit tests got a re-work away from the assumption
that there is only one plugin type.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Clean up Acceptance tests to follow our coding conventions
For builders, don't use get/set for properties.
Otherwise use get/set for properties.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
To make sure it is automated I extended the cluster to accept a defined
PantheonNode instead of an automatic one (where automatic is the
default) and then cloned a simple test and forced it to use the
ThreadPantheonNodeRunner.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* Fix eea transaction count if account is null in privacy group state
* Fix failing acceptance test
- expected value was generated with the wrong privacy group
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Moves init code into a separate builder instead of a static init method, with common code in an abstract base class and subclasses of the builder for each of the consensus variants.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
It's now entirely handled through settings in the genesis config which --network DEV handles so no need for an additional boolean devMode flag.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>