Enable native encryption by default, but retain the feature flags. The problem with acceptance tests is that the new native libraries added some startup overhead, which when translated to starting up 12 nodes on the same vm resulted in longer time getting to a testable state. Start up timeout was increased to 60 seconds.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
Via JNA use native scep256k1 and altbn128 libraries.
This is gated by two feature flags and is disabled by default.
* `--Xsecp256k1-native-enabled` enables native secp256k1 across all of besu
* `--Xaltbn128-native-enabled` enables native altbn128 in the precompiled contracts
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
* Manage EIP-1559 transactions forging in local transaction pool.
- Updated `TransactionPool`
- Added `TransactionPriceCalculator` field for frontier transactions.
- Added `TransactionPriceCalculator` field for EIP-1559 transactions.
- Added `EIP1559` field.
- Added `minTransactionGasPrice` to compute transaction gas price according to EIP-1559 rules.
- Created `BaseFee` domain object.
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
## PR description
- Created `TransactionPriceCalculator` to compute the transaction gas price.
- Created `CoinbaseFeePriceCalculator` to compute the coinbase reward.
- Updated `MainnetTransactionProcessor` to apply new consensus rules:
- Updated transaction gas price for EIP-1559 transactions.
- Updated coinbase reward for EIP-1559 transactions.
- Updated `MainnetProtocolSpecs` to build the correct TransactionProcessor for EIP-1559 definition.
## Fixed Issue(s)
- #601
- #605
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* Move baseFee from SealableBlockHeader to ProcessableBlockHeader
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* Move baseFee from SealableBlockHeader to ProcessableBlockHeader
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* Write null gas price in the RLP structure if this an EIP-1559 transaction. (#738)
Write null gas price in the RLP structure if this an EIP-1559 transaction.
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>
* 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>
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>
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>
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>
* 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>
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>
* ### 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>
The EthQL API spec specifies pulledStates and knownStates in the
`syncing` query. Previously we always returned null. This plumbs through
the needed data so that the synchronization states can report the
fast sync progress via EthQL, as well as the `eth_syncing` JSON-RPC.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
* Restore test generation of blocks.bin
Restore the ability to generate our blocks.bin as part of the build.
(a) a fixed start time was added
(b) nonces for blocks imported for test are deterministically chosen.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
* more readable test files
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
* Update SLOAD_GAS cost to 200 in Aztlan Gas Calculator
Change SLOAD_GAS cost in Aztlan Gas Calculator from 800 to 200 and
update functions that use SLOAD_GAS.
Signed-off-by: edwardmack <ed@edwardmack.com>
* Update SLOAD_GAS cost to 200 in Aztlan Gas Calculator
Change SLOAD_GAS cost in Aztlan Gas Calculator from 800 to 200 and
update functions that use SLOAD_GAS.
Signed-off-by: edwardmack <ed@edwardmack.com>
Signed-off-by: Edward Mack <ed@edwardmack.com>
* remove overrides
removed overrides of calculateStorageCost and
calculateStorageRefundAmount in AztlanGasCalculator because these were
causing aztlan fork not to sync with kotti testnet.
Signed-off-by: Edward Mack <ed@edwardmack.com>
* merge
Signed-off-by: Edward Mack <ed@edwardmack.com>
* rename the method isPersistingState to isPersistingPrivateState because that is what it is used for
Signed-off-by: Stefan Pingel <stefan.pingel@consensys.net>
* rename the method isPersistingState to isPersistingPrivateState because that is what it is used for
Signed-off-by: Stefan Pingel <stefan.pingel@consensys.net>
* rename the method isPersistingState to isPersistingPrivateState because that is what it is used for
Signed-off-by: Stefan Pingel <stefan.pingel@consensys.net>