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>
* 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>
* Start external services before we start mining
Reasons:
- you may wish to query the blockchain using rpc before you start
processing
- you may wish to register a websocket e.g to listen for blocks
currently you will probably miss one because we start processing
before we start the ws service
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* Add beforeExternalServices hook for plugins
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* move the acceptance test plugins
move the test plugins that are used in the acceptance tests into the same
package namespace as the acceptance tests so that they are ignored by
sonar for code coverage
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* Fix typo in log
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
Co-authored-by: Sally MacFarlane <sally.macfarlane@consensys.net>
This is a re-implementation of the initial POC done in https://github.com/PegaSysEng/pantheon/pull/1909/ by Danno Ferrin <danno.ferrin@gmail.com>
* Only enable plugin rpc api when enabled on --rpc-http-api or --rpc-ws-apis
* Only allow new rpc endpoints to be defined
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* Create new datatypes module
Create a new `datatypes` module to hold datatypes that are broadly used.
This will aid modularization by making sure the base types in the module
minimize the amount of unrelated support classes needed.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
* Add Address, Hash, and Wei to datatypes
Move the Address, Hash, and Wei to datatypes in as they are needed for
EVM modularization.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
EIP-1702 account versioning was a candidate for the Istanbul hard fork
but was removed prior to the first testnet. Other versioning techniques
have greater core dev mind share and one preparatory step landed in
London, EIP-3541, making EIP-1702 very unlikely to make it to Mainnet.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
* Refactor: PrivacyBlockProcessor to clarify intent
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* Wire up privacy genesis options into PrivacyParameters
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* Refactor private state genesis into it's own class
- pass through in privacyParameters
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* Refactor: inject PrivateStateGenesis into PrivacyPrecompiles
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* Private Genesis initialisation
- set code, balance and storage from private-genesis.json
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* Check on-chain with private genesis in acceptance tests
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* Remove unused EthGetCodeCall
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* Use a plugin based aproach for privacy genesis
- if the plugin is registered it will be used to apply private genesis
state
- if onchain flexible privacy groups is enable that will be applied
after
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* PrivateGenesisAcceptanceTest::createPrivacyGroup can be private
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* PrivateStateGenesis add debug logs
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* Warn if genesis account allocation is in reserved precompile range
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* Add sender into unsignedPrivateMarkerTransaction for plugin to make descision
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* Remove locking solution as may not be needed
- if this is required we should first evaluate actual use cases
and test scenarios
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* Rename PrivateStateGenesis -> PrivateStateGenesisAllocator
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* Tidy up naming for getPrivateStateGenesisAllocator
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* Privacy Plugin javadocs
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* Refactor: clarify intent of arg when testing permissioning plugin
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* Refactor: remove duplicate createPrivateMarkerTransaction
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* PrivateMarkerTransactionFactory: add option to delegate to plugin
if defined the plugin will be responsible for creating the pmt
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* Implement locking strategy for eea_sendRawTransaction
- this will lock per address being sent to prevent nonce
too low errors
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* Refactor plugin integration to use a more explicit poco
- the plugin will need to sign the transaction with the data it's given
- it will not need to query anything e.g nonce etc
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* refactor: update naming and tidy up based on comments
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* Isolate code for calculating gas limit when using privacy plugin
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
Co-authored-by: Vijay Michalik <vijay.michalik@consensys.net>
* Hook up an empty plugin for future unrestricted privacy encryption
Skeleton implementation for PrivacyPayloadEncryptionProvider
Wire up unencrypted serialization for private transactions
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* wire up simple privacy plugin in acceptance tests
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* Pass the marker transaction through to plugin
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* Move getters/setters into consistent place
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* Rename plugin methods and config to be more generic
- remove protections around transaction.restriction
- the plugin is responsible for this
- make plugin more generic so could be used for restricted/unrestricted
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* Provide more meaningful error message
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* Fix up test naming to match impl naming
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* Rename UNRESTRICTED_PRIVACY to PLUGIN_PRIVACY
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* fix typo in PrivacyParmeters::toString
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* Fix exception messages to be PrivacyPlugin
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* Remove blockNumber from getPrivateTransactionFromPayload
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* Permissioning: Add plugin extension point
Added plugin extension point to allow developers to write their
own implementation of `NodePermissioningProvider::isPermitted`
This will allow developers to implement their own interpretations of
things like on-chain permissioning.
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* refactor: rename NodePermissioningProvider::isPermitted
Interface will be used for other pemissioning needs
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* Permissioning: added hook for NodeMessagePermissioning
All message sent to a peer will call into isMessagePermitted
if providers have been registered through the plugin api
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* AcceptanceTests: test node nodePermissioningProvider
4 node cluster with permissioning blocking a direct between two nodes
and permissioning blocking transaction messages for a single node
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* fix: unit tests for NodePermissioningControllerFactory
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* fix: fat finger typo
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* fix: reduce likely hood of flakey test
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* fix: remove comment
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* fix: typos
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* fix: remove jitpack references
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* fix: tidy up EthPeerTest args
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* fix: update plugin hash check
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* fix: improve test reliability
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* refactor: move test-plugins out from besu/main into acceptance-tests
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>