* Added changelog entries for PR:
- https://github.com/hyperledger/besu/pull/430
- https://github.com/hyperledger/besu/pull/440
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* For post EIP-1559 blocks we must disable GasLimitRangeAndDeltaValidationRule.
We must also update ProofOfWorkValidationRule to include base fee field in the hash computation.
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* Rename logger
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* Rename logger
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* Fix base fee computation and add tests.
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* Address PR comments
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* Fix support of peers <eth/65
Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>
* Fix unit test
Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>
* Update ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/PeerPendingTransactionTracker.java
Co-Authored-By: Danno Ferrin <danno.ferrin@shemnon.com>
Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>
* make protocol version part of the function
Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>
Co-authored-by: Danno Ferrin <danno.ferrin@shemnon.com>
Pull two methods out of ProtocolSpec into the only class that uses them.
This is in preparation for future refactoring of the ProtocolSpec.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
It is possible for the service furture to fail exceptionally before we
first poll for waiting, so we should switch to a do/while loop so we
will get the exception re-thrown instead of ignoring it.
This may fix#662
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
Security frameworks create signatures of 64-bytes (for a 256-bit keys) - and do not produce the recId.
Furthermore, the signatures created maybe in the upper-half of the curve, which is illegal under Ethereum.
As these checks must be applied to signatures generated by the jce, it is prudent to separate the concept of signature generation, from the post-operations.
Signed-off-by: Trent Mohay <trent.mohay@consensys.net>
Add support for `berlinBlock` in genesis configs.
Until the final contents of Berlin are finalized this will be guarded by
a feature flag `--Xberlin-enabled`. Once Berlin is finalized and before
it is deployed on test nets the flag will be removed.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
This change allows the newly defined "SecurityModule" to work against a generic API, while the NodeKey interface adapts these generic types to the types already used throughout Besu (i.e. those defined in Secp256k1).
Signed-off-by: Trent Mohay <trent.mohay@consensys.net>
Speed up build time by removing some of the most time consuming tests
* CALLBlake2f_MaxRounds - runs Blake2f 4 billion rounds, something no
one ever does and there is never enough gas to do. We have a unit test
for this already.
* The "do this 50k times" tests. Each has a smaller "5k times" or less
variant. This drifts into performance testing instead of conformance
testing
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
* I propose to add Karim as a Besu project maintainer.
Karim contributed with many high quality commits (including bounties):
- NAT,
- log filters,
- fast sync,
- tracing.
Here are [his past contributions on Besu project]
(https://github.com/hyperledger/besu/commits?author=matkt)
and he even did some before the client was renamed to Besu.
Voting ends two weeks from today at
[midnight UTC on 2020-04-17](https://bit.ly/2JzWqd4)
For more information on this process see the
Becoming a Maintainer section in the MAINTAINERS.md file.
Signed-off-by: Nicolas MASSART <nicolas.massart@consensys.net>
* Added changelog entries for PR:
- https://github.com/hyperledger/besu/pull/430
- https://github.com/hyperledger/besu/pull/440
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* Implement gas limit and gas price block header validation rules as per specified in EIP-1559
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* We should enforce the per transaction gas limit, as specified by the EIP, to 8,000,000 gas.
Add a `TransactionInvalidReason`
Update the `validate` method in `MainnetTransactionValidator` to enforce this check.
Update the validation process in `MainnetBlockBodyValidator` to enforce this check for all transactions within a block.
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* fix unit test
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* Removed blockNumber from TransactionValidator.validate
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
Update BesuController to use the NodeKey, rather than working with KeyPair - which in turn allows the crypto operations to be injected.
Signed-off-by: Trent Mohay <trent.mohay@consensys.net>
It was identified that during the creation of injectable crypto, that the NodeKey effectively offered duplicated functionality between ECDH and ECIES key agreements. The ECIES was superfluous and has been removed.
Signed-off-by: Trent Mohay <trent.mohay@consensys.net>
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>
Update the Handhshaking classes to use an injected NodeKey object for ECIES encryption.
This has necessitated an update of NodeKey to support the creation of Key and ECIES agreement creation.
Signed-off-by: Trent Mohay <trent.mohay@consensys.net>
Updates the Clique mining classes to use the NodeKeys framework (Created in PR #618) (rather than KeyPair directly) - allowing Clique to use pluggable crypto.
Signed-off-by: Trent Mohay <trent.mohay@consensys.net>
The NodeKey class is now used through the Discovery protocol (as well as the IBFT2).
However RLPx continues to access the node's keyPair (and underlying private key).
Signed-off-by: Trent Mohay <trent.mohay@consensys.net>
Bypass default value from environment variable provider for positional parameter. In case of subcommands such as `help` this could have thrown class cast exception
Signed-off-by: Usman Saleem <usman@usmans.info>
Currently, Besu injects a KeyPair from the initial entry, through the hierarchy of classes and into various leaf classes. The leaf classes then execute statically defined cryptographic functions (eg Secp256k1.sign) using the injected key.
Thus the implementation of the cryptographic function is hardcoded by the leaf node, and cannot be injected - and thus its implementation cannot be altered.
This change combines the node's KeyPair with associated cryptographic functions in a single class, which can then be injected. This in turn enables other cryptographic backends to be utilised by Besu.
Signed-off-by: Trent Mohay <trent.mohay@consensys.net>
* Added changelog entries for PR:
- https://github.com/hyperledger/besu/pull/430
- https://github.com/hyperledger/besu/pull/440
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* Prepare EIP-1559 genesis field.
The fork name is not known so for the moment we let eip1559 as a placeholder to update when the actual fork name is known.
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* Added changelog entries for PR:
- https://github.com/hyperledger/besu/pull/430
- https://github.com/hyperledger/besu/pull/440
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* ### Description
BlockHeader object needs to be modified in order to add the new field (baseFee) as specified in the EIP.
We should take care about the RLP encoding/decoding of this structure since it has to include or not the new fields depending on whether we are pre fork or post fork.
- Update `core.BlockHeader.java`
- Add `baseFee`
- Update `readFrom` method for RLP decoding
- Update `writeTo` method for RLP encoding
- Update `plugin.data.BlockHeader.java`
- Add `getBaseFee` method
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* ### Description
Transaction object needs to be modified in order to add the 2 new fields (`gasPremium` and `feeCap`) as specified in the EIP.
We should take care about the RLP encoding/decoding of this structure since it has to include or not the new fields depending on whether we are pre fork or post fork.
- Update core `Transaction` object
- Add gasPremium and feeCap fields
- Update readFrom method for RLP decoding
- Update writeTo method for RLP encoding
- Update plugin `Transaction` interface
- Add `getGasPremium` and `getFeeCap` methods
This EIP introduces gasPremium and feeCap fields in the transaction. They need to be included in the signing mechanism.
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* We need a manager class to hold EIP-1559 core logic. This helper class will be then used by glue code. This separation make testing simpler.
Specifically the following methods:
- `long computeBaseFee(final long parentBaseFee, final long parentGasUsed)`
- `boolean isValidBaseFee(final long parentBaseFee, final long baseFee)`
- `long eip1559GasPool(final long blockNumber)`
- `long legacyGasPool(final long blockNumber)`
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* spotlessApply
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* TODO Add CLI command line flag `--Xeip1559-enabled`.
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* update known hash
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* clean up
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* clean up
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* Address PR comments
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* Address PR comments
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* remove useless constructor
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* add spdx header
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* Added changelog entries for PR:
- https://github.com/hyperledger/besu/pull/430
- https://github.com/hyperledger/besu/pull/440
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* ### Description
BlockHeader object needs to be modified in order to add the new field (baseFee) as specified in the EIP.
We should take care about the RLP encoding/decoding of this structure since it has to include or not the new fields depending on whether we are pre fork or post fork.
- Update `core.BlockHeader.java`
- Add `baseFee`
- Update `readFrom` method for RLP decoding
- Update `writeTo` method for RLP encoding
- Update `plugin.data.BlockHeader.java`
- Add `getBaseFee` method
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* ### Description
Transaction object needs to be modified in order to add the 2 new fields (`gasPremium` and `feeCap`) as specified in the EIP.
We should take care about the RLP encoding/decoding of this structure since it has to include or not the new fields depending on whether we are pre fork or post fork.
- Update core `Transaction` object
- Add gasPremium and feeCap fields
- Update readFrom method for RLP decoding
- Update writeTo method for RLP encoding
- Update plugin `Transaction` interface
- Add `getGasPremium` and `getFeeCap` methods
This EIP introduces gasPremium and feeCap fields in the transaction. They need to be included in the signing mechanism.
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* TODO Add CLI command line flag `--Xeip1559-enabled`.
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* Remove TODO
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* spotless apply
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* Merge step 0 and make EIP-1559 specific fields optional
Add feature flag guard for RLP encoding / decoding of transactions
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* fix error
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* Address PR comments
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* update plugin api known hash
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* Added changelog entries for PR:
- https://github.com/hyperledger/besu/pull/430
- https://github.com/hyperledger/besu/pull/440
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* ### Description
BlockHeader object needs to be modified in order to add the new field (baseFee) as specified in the EIP.
We should take care about the RLP encoding/decoding of this structure since it has to include or not the new fields depending on whether we are pre fork or post fork.
- Update `core.BlockHeader.java`
- Add `baseFee`
- Update `readFrom` method for RLP decoding
- Update `writeTo` method for RLP encoding
- Update `plugin.data.BlockHeader.java`
- Add `getBaseFee` method
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* TODO Add CLI command line flag `--Xeip1559-enabled`.
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* TODO Add CLI command line flag `--Xeip1559-enabled`.
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* Added unstable annotation for getBaseFee. Moved from long to `Optional<Long>`
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* Spotless apply
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* Fixed error
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* fix plugin API hash
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* RLP encoding / decoding operations are guarded with the feature flag.
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* spotless apply
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>