From 46636c7af279c3530fe30e99bfa5f7956150dcb5 Mon Sep 17 00:00:00 2001 From: Luis Pinto Date: Wed, 11 Sep 2024 00:37:08 +0100 Subject: [PATCH 01/47] block header cache not initialized before used (#7601) Signed-off-by: Luis Pinto Co-authored-by: Sally MacFarlane --- .../ethereum/chain/DefaultBlockchain.java | 62 +++++++++---------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/chain/DefaultBlockchain.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/chain/DefaultBlockchain.java index 1b210490740..b2b4e6abfc8 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/chain/DefaultBlockchain.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/chain/DefaultBlockchain.java @@ -116,6 +116,37 @@ private DefaultBlockchain( chainHeadTransactionCount = chainHeadBody.getTransactions().size(); chainHeadOmmerCount = chainHeadBody.getOmmers().size(); + this.reorgLoggingThreshold = reorgLoggingThreshold; + this.blockChoiceRule = heaviestChainBlockChoiceRule; + this.numberOfBlocksToCache = numberOfBlocksToCache; + + if (numberOfBlocksToCache != 0) { + blockHeadersCache = + Optional.of( + CacheBuilder.newBuilder().recordStats().maximumSize(numberOfBlocksToCache).build()); + blockBodiesCache = + Optional.of( + CacheBuilder.newBuilder().recordStats().maximumSize(numberOfBlocksToCache).build()); + transactionReceiptsCache = + Optional.of( + CacheBuilder.newBuilder().recordStats().maximumSize(numberOfBlocksToCache).build()); + totalDifficultyCache = + Optional.of( + CacheBuilder.newBuilder().recordStats().maximumSize(numberOfBlocksToCache).build()); + CacheMetricsCollector cacheMetrics = new CacheMetricsCollector(); + cacheMetrics.addCache("blockHeaders", blockHeadersCache.get()); + cacheMetrics.addCache("blockBodies", blockBodiesCache.get()); + cacheMetrics.addCache("transactionReceipts", transactionReceiptsCache.get()); + cacheMetrics.addCache("totalDifficulty", totalDifficultyCache.get()); + if (metricsSystem instanceof PrometheusMetricsSystem prometheusMetricsSystem) + prometheusMetricsSystem.addCollector(BesuMetricCategory.BLOCKCHAIN, () -> cacheMetrics); + } else { + blockHeadersCache = Optional.empty(); + blockBodiesCache = Optional.empty(); + transactionReceiptsCache = Optional.empty(); + totalDifficultyCache = Optional.empty(); + } + metricsSystem.createLongGauge( BesuMetricCategory.ETHEREUM, "blockchain_height", @@ -179,37 +210,6 @@ private DefaultBlockchain( "chain_head_ommer_count", "Number of ommers in the current chain head block", () -> chainHeadOmmerCount); - - this.reorgLoggingThreshold = reorgLoggingThreshold; - this.blockChoiceRule = heaviestChainBlockChoiceRule; - this.numberOfBlocksToCache = numberOfBlocksToCache; - - if (numberOfBlocksToCache != 0) { - blockHeadersCache = - Optional.of( - CacheBuilder.newBuilder().recordStats().maximumSize(numberOfBlocksToCache).build()); - blockBodiesCache = - Optional.of( - CacheBuilder.newBuilder().recordStats().maximumSize(numberOfBlocksToCache).build()); - transactionReceiptsCache = - Optional.of( - CacheBuilder.newBuilder().recordStats().maximumSize(numberOfBlocksToCache).build()); - totalDifficultyCache = - Optional.of( - CacheBuilder.newBuilder().recordStats().maximumSize(numberOfBlocksToCache).build()); - CacheMetricsCollector cacheMetrics = new CacheMetricsCollector(); - cacheMetrics.addCache("blockHeaders", blockHeadersCache.get()); - cacheMetrics.addCache("blockBodies", blockBodiesCache.get()); - cacheMetrics.addCache("transactionReceipts", transactionReceiptsCache.get()); - cacheMetrics.addCache("totalDifficulty", totalDifficultyCache.get()); - if (metricsSystem instanceof PrometheusMetricsSystem prometheusMetricsSystem) - prometheusMetricsSystem.addCollector(BesuMetricCategory.BLOCKCHAIN, () -> cacheMetrics); - } else { - blockHeadersCache = Optional.empty(); - blockBodiesCache = Optional.empty(); - transactionReceiptsCache = Optional.empty(); - totalDifficultyCache = Optional.empty(); - } } public static MutableBlockchain createMutable( From 6ea0ed4c7001895863964fc0e30858c0f6b735ce Mon Sep 17 00:00:00 2001 From: garyschulte Date: Tue, 10 Sep 2024 18:55:45 -0700 Subject: [PATCH 02/47] propagate release name preprocessing via job output (#7599) Signed-off-by: garyschulte --- .github/workflows/release.yml | 59 ++++++++++++++++++++++++----------- 1 file changed, 41 insertions(+), 18 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c7436653578..2f0661e3cfb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,8 +9,28 @@ env: GRADLE_OPTS: "-Dorg.gradle.parallel=true -Dorg.gradle.caching=true" jobs: + preprocess_release: + runs-on: ubuntu-22.04 + steps: + - name: Pre-process Release Name + id: pre_process_release_name + run: | + RELEASE_NAME="${{ github.event.release.name }}" + # strip all whitespace + RELEASE_NAME="${RELEASE_NAME//[[:space:]]/}" + if [[ ! "$RELEASE_NAME" =~ ^[0-9]+\.[0-9]+(\.[0-9]+)?(-.*)?$ ]]; then + echo "Release name does not conform to a valid besu release format YY.M.v[-suffix], e.g. 24.8.0-RC1." + exit 1 + fi + echo "release_name=$RELEASE_NAME" >> $GITHUB_OUTPUT # Set as output using the new syntax + outputs: + release_name: ${{ steps.pre_process_release_name.outputs.release_name }} + artifacts: runs-on: ubuntu-22.04 + needs: preprocess_release + env: + RELEASE_NAME: ${{ needs.preprocess_release.outputs.release_name }} # Use the output from the pre_process_release job permissions: contents: write outputs: @@ -19,17 +39,6 @@ jobs: steps: - name: checkout uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - - name: Pre-process Release Name - id: pre_process_release_name - run: | - RELEASE_NAME="${{ github.event.release.name }}" - # strip all whitespace - RELEASE_NAME="${RELEASE_NAME//[[:space:]]/}" - if [[ ! "$RELEASE_NAME" =~ ^[0-9]+\.[0-9]+(\.[0-9]+)?(-.*)?$ ]]; then - echo "Release name does not conform to a valid besu release format YY.M.v[-suffix], e.g. 24.8.0-RC1." - exit 1 - fi - echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV # Store in environment variable - name: Set up Java uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 with: @@ -90,7 +99,9 @@ jobs: publish: runs-on: ubuntu-22.04 - needs: [testWindows, artifacts] + needs: [preprocess_release, testWindows, artifacts] + env: + RELEASE_NAME: ${{ needs.preprocess_release.outputs.release_name }} # Use the output from the pre_process_release job permissions: contents: write steps: @@ -115,7 +126,9 @@ jobs: artifactoryPublish: runs-on: ubuntu-22.04 - needs: artifacts + needs: [preprocess_release, artifacts] + env: + RELEASE_NAME: ${{ needs.preprocess_release.outputs.release_name }} # Use the output from the pre_process_release job steps: - name: checkout uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 @@ -152,7 +165,9 @@ jobs: run: docker run --rm -i hadolint/hadolint < docker/Dockerfile buildDocker: - needs: hadolint + needs: [preprocess_release, hadolint] + env: + RELEASE_NAME: ${{ needs.preprocess_release.outputs.release_name }} # Use the output from the pre_process_release job permissions: contents: read packages: write @@ -213,7 +228,9 @@ jobs: run: ./gradlew --no-daemon dockerUpload -PdockerOrgName=${{ env.registry }}/${{ secrets.DOCKER_ORG }} -Pversion=${{env.RELEASE_NAME}} -Prelease.releaseVersion=${{ env.RELEASE_NAME }} multiArch: - needs: buildDocker + needs: [preprocess_release, buildDocker] + env: + RELEASE_NAME: ${{ needs.preprocess_release.outputs.release_name }} # Use the output from the pre_process_release job runs-on: ubuntu-22.04 permissions: contents: read @@ -240,7 +257,9 @@ jobs: run: ./gradlew manifestDocker -PdockerOrgName=${{ env.registry }}/${{ secrets.DOCKER_ORG }} -Pversion=${{env.RELEASE_NAME}} -Prelease.releaseVersion=${{ env.RELEASE_NAME }} amendNotes: - needs: multiArch + needs: [preprocess_release, multiArch] + env: + RELEASE_NAME: ${{ needs.preprocess_release.outputs.release_name }} # Use the output from the pre_process_release job runs-on: ubuntu-22.04 permissions: contents: write @@ -253,7 +272,9 @@ jobs: `docker pull ${{env.registry}}/${{secrets.DOCKER_ORG}}/besu:${{env.RELEASE_NAME}}` dockerPromoteX64: - needs: multiArch + needs: [preprocess_release, multiArch] + env: + RELEASE_NAME: ${{ needs.preprocess_release.outputs.release_name }} # Use the output from the pre_process_release job runs-on: ubuntu-22.04 steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 @@ -278,7 +299,9 @@ jobs: run: ./gradlew "-Prelease.releaseVersion=${{ env.RELEASE_NAME }}" "-PdockerOrgName=${{ env.registry }}/${{ secrets.DOCKER_ORG }}" manifestDockerRelease verifyContainer: - needs: dockerPromoteX64 + needs: [preprocess_release, dockerPromoteX64] + env: + RELEASE_NAME: ${{ needs.preprocess_release.outputs.release_name }} # Use the output from the pre_process_release job runs-on: ubuntu-22.04 permissions: contents: read From b18d15058f9b7bcd42a3ad4ed0b344f16a176c07 Mon Sep 17 00:00:00 2001 From: garyschulte Date: Wed, 11 Sep 2024 10:01:21 -0700 Subject: [PATCH 03/47] deprecate 24.9.0, create 24.9.1 release (#7606) Signed-off-by: garyschulte --- CHANGELOG.md | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aa6250508e5..ec895443c33 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,16 +7,10 @@ ### Breaking Changes ### Additions and Improvements -- Update Java and Gradle dependecies [#7571](https://github.com/hyperledger/besu/pull/7571) -- Layered txpool: new options `--tx-pool-min-score` to remove a tx from pool when its score is lower than the specified value [#7576](https://github.com/hyperledger/besu/pull/7576) -- Add `engine_getBlobsV1` method to the Engine API [#7553](https://github.com/hyperledger/besu/pull/7553) ### Bug fixes -- Layered txpool: do not send notifications when moving tx between layers [#7539](https://github.com/hyperledger/besu/pull/7539) -- Layered txpool: fix for unsent drop notifications on remove [#7538](https://github.com/hyperledger/besu/pull/7538) -- Honor block number or tag parameter in eth_estimateGas and eth_createAccessList [#7502](https://github.com/hyperledger/besu/pull/7502) -## 24.9.0 +## 24.9.1 ### Upcoming Breaking Changes @@ -32,6 +26,9 @@ - Performance optimzation for ECMUL (2 of 2) [#7543](https://github.com/hyperledger/besu/pull/7543) - Include current chain head block when computing `eth_maxPriorityFeePerGas` [#7485](https://github.com/hyperledger/besu/pull/7485) - Remove (old) documentation updates from the changelog [#7562](https://github.com/hyperledger/besu/pull/7562) +- Update Java and Gradle dependecies [#7571](https://github.com/hyperledger/besu/pull/7571) +- Layered txpool: new options `--tx-pool-min-score` to remove a tx from pool when its score is lower than the specified value [#7576](https://github.com/hyperledger/besu/pull/7576) +- Add `engine_getBlobsV1` method to the Engine API [#7553](https://github.com/hyperledger/besu/pull/7553) ### Bug fixes - Fix tracing in precompiled contracts when halting for out of gas [#7318](https://github.com/hyperledger/besu/issues/7318) @@ -42,6 +39,14 @@ - `evmtool` was not respecting the `--genesis` setting, resulting in unexpected trace results. [#7433](https://github.com/hyperledger/besu/pull/7433) - The genesis config override `contractSizeLimit` was not wired into code size limits [#7557](https://github.com/hyperledger/besu/pull/7557) - Fix incorrect key filtering in LayeredKeyValueStorage stream [#7535](https://github.com/hyperledger/besu/pull/7557) +- Layered txpool: do not send notifications when moving tx between layers [#7539](https://github.com/hyperledger/besu/pull/7539) +- Layered txpool: fix for unsent drop notifications on remove [#7538](https://github.com/hyperledger/besu/pull/7538) +- Honor block number or tag parameter in eth_estimateGas and eth_createAccessList [#7502](https://github.com/hyperledger/besu/pull/7502) + +## 24.9.0 + +This release version has been deprecated release due to CI bug + ## 24.8.0 From 6ed1db32ae3c1b5bdc0576321fee35157feb6ae4 Mon Sep 17 00:00:00 2001 From: George Tebrean <99179176+gtebrean@users.noreply.github.com> Date: Thu, 12 Sep 2024 11:18:26 +0300 Subject: [PATCH 04/47] Issue - 7554 remove unused privacy test classes (#7569) * remove unused classes Signed-off-by: George Tebrean * removed duplication from changelog Signed-off-by: Sally MacFarlane --------- Signed-off-by: George Tebrean Signed-off-by: George Tebrean <99179176+gtebrean@users.noreply.github.com> Signed-off-by: Sally MacFarlane Co-authored-by: Sally MacFarlane --- CHANGELOG.md | 4 +- .../acceptance/dsl/AcceptanceTestBase.java | 7 - .../dsl/AcceptanceTestBaseJunit5.java | 7 - .../priv/EeaSendRawTransactionSuccess.java | 38 -- .../condition/priv/ExpectJsonRpcError.java | 53 -- .../dsl/condition/priv/PrivConditions.java | 120 ---- .../priv/PrivCreatePrivacyGroupSuccess.java | 39 -- .../priv/PrivDeletePrivacyGroupSuccess.java | 39 -- .../PrivDistributeRawTransactionSuccess.java | 42 -- .../priv/PrivFindPrivacyGroupSuccess.java | 40 -- .../PrivGetEeaTransactionCountSuccess.java | 42 -- ...ivGetExpectedFailedTransactionReceipt.java | 38 -- ...vGetExpectedInvalidTransactionReceipt.java | 38 -- ...tExpectedSuccessfulTransactionReceipt.java | 38 -- ...rivGetPrivacyPrecompileAddressSuccess.java | 42 -- .../PrivGetPrivateTransactionReturnsNull.java | 38 -- .../PrivGetPrivateTransactionSuccess.java | 43 -- .../priv/PrivGetTransactionCountSuccess.java | 42 -- .../priv/PrivateSyncingStatusCondition.java | 40 -- .../tests/acceptance/dsl/node/BesuNode.java | 2 - .../node/configuration/BesuNodeFactory.java | 54 -- .../privacy/PrivacyNodeConfiguration.java | 65 -- .../privacy/PrivacyNodeFactory.java | 294 -------- .../dsl/privacy/PrivacyCluster.java | 184 ----- .../acceptance/dsl/privacy/PrivacyNode.java | 315 --------- .../PrivateTransactionGroupResponse.java | 117 ---- .../dsl/privacy/account/PrivacyAccount.java | 85 --- .../account/PrivacyAccountResolver.java | 101 --- ...pectExistingPrivateTransactionReceipt.java | 41 -- ...nternalErrorPrivateTransactionReceipt.java | 40 -- .../ExpectNoPrivateTransactionReceipt.java | 41 -- .../condition/ExpectValidContractCode.java | 29 - ...xpectValidFlexiblePrivacyGroupCreated.java | 53 -- .../ExpectValidPrivacyGroupCreated.java | 51 -- ...ctValidPrivateContractDeployedReceipt.java | 57 -- .../ExpectValidPrivateTransactionReceipt.java | 91 --- .../PrivGetTransactionReceiptTransaction.java | 52 -- .../privacy/condition/PrivateCondition.java | 21 - .../condition/PrivateContractCondition.java | 23 - .../condition/PrivateContractVerifier.java | 29 - .../condition/PrivateTransactionVerifier.java | 88 --- ...issioningPrivateSmartContractFunction.java | 73 -- .../CallPrivateSmartContractFunction.java | 121 ---- ...DeployPrivateSmartContractTransaction.java | 87 --- ...ContractWithPrivacyGroupIdTransaction.java | 89 --- .../LoadPrivateSmartContractTransaction.java | 87 --- ...ContractTransactionWithPrivacyGroupId.java | 88 --- .../contract/PrivateContractTransactions.java | 154 ----- .../AddToFlexiblePrivacyGroupTransaction.java | 57 -- ...CreateFlexiblePrivacyGroupTransaction.java | 46 -- .../FindFlexiblePrivacyGroupTransaction.java | 52 -- .../FindPrivacyGroupTransaction.java | 45 -- .../GetAllPrivateMarkerTransactionHashes.java | 56 -- .../LockFlexiblePrivacyGroupTransaction.java | 47 -- ...CreateRandomPrivacyGroupIdTransaction.java | 31 - .../PrivDistributeTransactionTransaction.java | 40 -- .../transaction/PrivacyTransactions.java | 172 ----- ...veFromFlexiblePrivacyGroupTransaction.java | 50 -- ...strictedCreatePrivacyGroupTransaction.java | 60 -- ...UnlockFlexiblePrivacyGroupTransaction.java | 47 -- .../privacy/util/LogFilterJsonParameter.java | 59 -- .../dsl/transaction/NodeRequests.java | 8 - .../EeaSendRawTransactionTransaction.java | 47 -- .../privacy/PrivCallTransaction.java | 64 -- .../PrivCreatePrivacyGroupTransaction.java | 46 -- .../privacy/PrivDebugGetStateRoot.java | 45 -- .../PrivDeletePrivacyGroupTransaction.java | 46 -- ...ivDistributeRawTransactionTransaction.java | 46 -- .../PrivFindPrivacyGroupTransaction.java | 47 -- .../privacy/PrivGetCodeTransaction.java | 54 -- ...PrivGetEeaTransactionCountTransaction.java | 47 -- .../privacy/PrivGetLogsTransaction.java | 54 -- ...etPrivacyPrecompileAddressTransaction.java | 38 -- .../PrivGetPrivateTransactionTransaction.java | 46 -- .../privacy/PrivGetTransaction.java | 46 -- .../PrivGetTransactionCountTransaction.java | 47 -- .../PrivGetTransactionReceiptTransaction.java | 47 -- .../privacy/PrivSyncingTransactions.java | 40 -- .../privacy/PrivTraceTransaction.java | 49 -- .../privacy/PrivacyRequestFactory.java | 629 ------------------ .../privacy/PrivacyTransactions.java | 69 -- .../PrivGetFilterChangesTransaction.java | 53 -- .../filter/PrivGetFilterLogsTransaction.java | 53 -- .../filter/PrivNewFilterTransaction.java | 52 -- .../PrivUninstallFilterTransaction.java | 50 -- acceptance-tests/tests/build.gradle | 27 - .../privacy/contracts/PrivacyGroupTest.java | 195 ------ .../privacy/contracts/PrivacyProxyTest.java | 178 ----- .../MultiTenancyAcceptanceTest.java | 408 ------------ .../MultiTenancyPrivacyGroup.java | 58 -- .../multitenancy/MultiTenancyPrivacyNode.java | 50 -- ...tiTenancyPrivateNonceIncrementingTest.java | 241 ------- ...tiTenancyValidationFailAcceptanceTest.java | 232 ------- 93 files changed, 3 insertions(+), 7153 deletions(-) delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/EeaSendRawTransactionSuccess.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/ExpectJsonRpcError.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivConditions.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivCreatePrivacyGroupSuccess.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivDeletePrivacyGroupSuccess.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivDistributeRawTransactionSuccess.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivFindPrivacyGroupSuccess.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivGetEeaTransactionCountSuccess.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivGetExpectedFailedTransactionReceipt.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivGetExpectedInvalidTransactionReceipt.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivGetExpectedSuccessfulTransactionReceipt.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivGetPrivacyPrecompileAddressSuccess.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivGetPrivateTransactionReturnsNull.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivGetPrivateTransactionSuccess.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivGetTransactionCountSuccess.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivateSyncingStatusCondition.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/configuration/privacy/PrivacyNodeConfiguration.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/configuration/privacy/PrivacyNodeFactory.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/PrivacyCluster.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/PrivacyNode.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/PrivateTransactionGroupResponse.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/account/PrivacyAccount.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/account/PrivacyAccountResolver.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/ExpectExistingPrivateTransactionReceipt.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/ExpectInternalErrorPrivateTransactionReceipt.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/ExpectNoPrivateTransactionReceipt.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/ExpectValidContractCode.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/ExpectValidFlexiblePrivacyGroupCreated.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/ExpectValidPrivacyGroupCreated.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/ExpectValidPrivateContractDeployedReceipt.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/ExpectValidPrivateTransactionReceipt.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/PrivGetTransactionReceiptTransaction.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/PrivateCondition.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/PrivateContractCondition.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/PrivateContractVerifier.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/PrivateTransactionVerifier.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/contract/CallOnchainPermissioningPrivateSmartContractFunction.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/contract/CallPrivateSmartContractFunction.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/contract/DeployPrivateSmartContractTransaction.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/contract/DeployPrivateSmartContractWithPrivacyGroupIdTransaction.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/contract/LoadPrivateSmartContractTransaction.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/contract/LoadPrivateSmartContractTransactionWithPrivacyGroupId.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/contract/PrivateContractTransactions.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/AddToFlexiblePrivacyGroupTransaction.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/CreateFlexiblePrivacyGroupTransaction.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/FindFlexiblePrivacyGroupTransaction.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/FindPrivacyGroupTransaction.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/GetAllPrivateMarkerTransactionHashes.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/LockFlexiblePrivacyGroupTransaction.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/PluginCreateRandomPrivacyGroupIdTransaction.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/PrivDistributeTransactionTransaction.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/PrivacyTransactions.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/RemoveFromFlexiblePrivacyGroupTransaction.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/RestrictedCreatePrivacyGroupTransaction.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/UnlockFlexiblePrivacyGroupTransaction.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/util/LogFilterJsonParameter.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/EeaSendRawTransactionTransaction.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivCallTransaction.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivCreatePrivacyGroupTransaction.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivDebugGetStateRoot.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivDeletePrivacyGroupTransaction.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivDistributeRawTransactionTransaction.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivFindPrivacyGroupTransaction.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivGetCodeTransaction.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivGetEeaTransactionCountTransaction.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivGetLogsTransaction.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivGetPrivacyPrecompileAddressTransaction.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivGetPrivateTransactionTransaction.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivGetTransaction.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivGetTransactionCountTransaction.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivGetTransactionReceiptTransaction.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivSyncingTransactions.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivTraceTransaction.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivacyRequestFactory.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivacyTransactions.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/filter/PrivGetFilterChangesTransaction.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/filter/PrivGetFilterLogsTransaction.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/filter/PrivNewFilterTransaction.java delete mode 100644 acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/filter/PrivUninstallFilterTransaction.java delete mode 100644 acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/contracts/PrivacyGroupTest.java delete mode 100644 acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/contracts/PrivacyProxyTest.java delete mode 100644 acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/multitenancy/MultiTenancyAcceptanceTest.java delete mode 100644 acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/multitenancy/MultiTenancyPrivacyGroup.java delete mode 100644 acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/multitenancy/MultiTenancyPrivacyNode.java delete mode 100644 acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/multitenancy/MultiTenancyPrivateNonceIncrementingTest.java delete mode 100644 acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/multitenancy/MultiTenancyValidationFailAcceptanceTest.java diff --git a/CHANGELOG.md b/CHANGELOG.md index ec895443c33..9ea4ced222a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ ### Breaking Changes ### Additions and Improvements +- Remove privacy test classes support [#7569](https://github.com/hyperledger/besu/pull/7569) + ### Bug fixes @@ -26,7 +28,7 @@ - Performance optimzation for ECMUL (2 of 2) [#7543](https://github.com/hyperledger/besu/pull/7543) - Include current chain head block when computing `eth_maxPriorityFeePerGas` [#7485](https://github.com/hyperledger/besu/pull/7485) - Remove (old) documentation updates from the changelog [#7562](https://github.com/hyperledger/besu/pull/7562) -- Update Java and Gradle dependecies [#7571](https://github.com/hyperledger/besu/pull/7571) +- Update Java and Gradle dependencies [#7571](https://github.com/hyperledger/besu/pull/7571) - Layered txpool: new options `--tx-pool-min-score` to remove a tx from pool when its score is lower than the specified value [#7576](https://github.com/hyperledger/besu/pull/7576) - Add `engine_getBlobsV1` method to the Engine API [#7553](https://github.com/hyperledger/besu/pull/7553) diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/AcceptanceTestBase.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/AcceptanceTestBase.java index 4072c6f1bc1..5256e71ee30 100644 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/AcceptanceTestBase.java +++ b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/AcceptanceTestBase.java @@ -26,7 +26,6 @@ import org.hyperledger.besu.tests.acceptance.dsl.condition.login.LoginConditions; import org.hyperledger.besu.tests.acceptance.dsl.condition.net.NetConditions; import org.hyperledger.besu.tests.acceptance.dsl.condition.perm.PermissioningConditions; -import org.hyperledger.besu.tests.acceptance.dsl.condition.priv.PrivConditions; import org.hyperledger.besu.tests.acceptance.dsl.condition.process.ExitedWithCode; import org.hyperledger.besu.tests.acceptance.dsl.condition.txpool.TxPoolConditions; import org.hyperledger.besu.tests.acceptance.dsl.condition.web3.Web3Conditions; @@ -44,7 +43,6 @@ import org.hyperledger.besu.tests.acceptance.dsl.transaction.miner.MinerTransactions; import org.hyperledger.besu.tests.acceptance.dsl.transaction.net.NetTransactions; import org.hyperledger.besu.tests.acceptance.dsl.transaction.perm.PermissioningTransactions; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.PrivacyTransactions; import org.hyperledger.besu.tests.acceptance.dsl.transaction.txpool.TxPoolTransactions; import org.hyperledger.besu.tests.acceptance.dsl.transaction.web3.Web3Transactions; @@ -93,8 +91,6 @@ public class AcceptanceTestBase { protected final PermissioningTransactions permissioningTransactions; protected final MinerTransactions minerTransactions; protected final Web3Conditions web3; - protected final PrivConditions priv; - protected final PrivacyTransactions privacyTransactions; protected final TxPoolConditions txPoolConditions; protected final TxPoolTransactions txPoolTransactions; protected final ExitedWithCode exitedSuccessfully; @@ -109,10 +105,8 @@ protected AcceptanceTestBase() { bftTransactions = new BftTransactions(); accountTransactions = new AccountTransactions(accounts); permissioningTransactions = new PermissioningTransactions(); - privacyTransactions = new PrivacyTransactions(); contractTransactions = new ContractTransactions(); minerTransactions = new MinerTransactions(); - blockchain = new Blockchain(ethTransactions); clique = new CliqueConditions(ethTransactions, cliqueTransactions); eth = new EthConditions(ethTransactions); @@ -121,7 +115,6 @@ protected AcceptanceTestBase() { net = new NetConditions(new NetTransactions()); cluster = new Cluster(net); perm = new PermissioningConditions(permissioningTransactions); - priv = new PrivConditions(privacyTransactions); admin = new AdminConditions(adminTransactions); web3 = new Web3Conditions(new Web3Transactions()); besu = new BesuNodeFactory(); diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/AcceptanceTestBaseJunit5.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/AcceptanceTestBaseJunit5.java index 0cf24b57364..4f3046c1abf 100644 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/AcceptanceTestBaseJunit5.java +++ b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/AcceptanceTestBaseJunit5.java @@ -26,7 +26,6 @@ import org.hyperledger.besu.tests.acceptance.dsl.condition.login.LoginConditions; import org.hyperledger.besu.tests.acceptance.dsl.condition.net.NetConditions; import org.hyperledger.besu.tests.acceptance.dsl.condition.perm.PermissioningConditions; -import org.hyperledger.besu.tests.acceptance.dsl.condition.priv.PrivConditions; import org.hyperledger.besu.tests.acceptance.dsl.condition.process.ExitedWithCode; import org.hyperledger.besu.tests.acceptance.dsl.condition.txpool.TxPoolConditions; import org.hyperledger.besu.tests.acceptance.dsl.condition.web3.Web3Conditions; @@ -44,7 +43,6 @@ import org.hyperledger.besu.tests.acceptance.dsl.transaction.miner.MinerTransactions; import org.hyperledger.besu.tests.acceptance.dsl.transaction.net.NetTransactions; import org.hyperledger.besu.tests.acceptance.dsl.transaction.perm.PermissioningTransactions; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.PrivacyTransactions; import org.hyperledger.besu.tests.acceptance.dsl.transaction.txpool.TxPoolTransactions; import org.hyperledger.besu.tests.acceptance.dsl.transaction.web3.Web3Transactions; @@ -96,8 +94,6 @@ public class AcceptanceTestBaseJunit5 { protected final PermissioningTransactions permissioningTransactions; protected final MinerTransactions minerTransactions; protected final Web3Conditions web3; - protected final PrivConditions priv; - protected final PrivacyTransactions privacyTransactions; protected final TxPoolConditions txPoolConditions; protected final TxPoolTransactions txPoolTransactions; protected final ExitedWithCode exitedSuccessfully; @@ -112,10 +108,8 @@ protected AcceptanceTestBaseJunit5() { bftTransactions = new BftTransactions(); accountTransactions = new AccountTransactions(accounts); permissioningTransactions = new PermissioningTransactions(); - privacyTransactions = new PrivacyTransactions(); contractTransactions = new ContractTransactions(); minerTransactions = new MinerTransactions(); - blockchain = new Blockchain(ethTransactions); clique = new CliqueConditions(ethTransactions, cliqueTransactions); eth = new EthConditions(ethTransactions); @@ -124,7 +118,6 @@ protected AcceptanceTestBaseJunit5() { net = new NetConditions(new NetTransactions()); cluster = new Cluster(net); perm = new PermissioningConditions(permissioningTransactions); - priv = new PrivConditions(privacyTransactions); admin = new AdminConditions(adminTransactions); web3 = new Web3Conditions(new Web3Transactions()); besu = new BesuNodeFactory(); diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/EeaSendRawTransactionSuccess.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/EeaSendRawTransactionSuccess.java deleted file mode 100644 index 9aef5825ea4..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/EeaSendRawTransactionSuccess.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.condition.priv; - -import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat; - -import org.hyperledger.besu.datatypes.Hash; -import org.hyperledger.besu.tests.acceptance.dsl.condition.Condition; -import org.hyperledger.besu.tests.acceptance.dsl.node.Node; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.EeaSendRawTransactionTransaction; - -public class EeaSendRawTransactionSuccess implements Condition { - - private final EeaSendRawTransactionTransaction sendRawTransactionTransaction; - - public EeaSendRawTransactionSuccess( - final EeaSendRawTransactionTransaction sendRawTransactionTransaction) { - this.sendRawTransactionTransaction = sendRawTransactionTransaction; - } - - @Override - public void verify(final Node node) { - final Hash transactionHash = node.execute(sendRawTransactionTransaction); - assertThat(transactionHash).isNotNull(); - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/ExpectJsonRpcError.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/ExpectJsonRpcError.java deleted file mode 100644 index a642a2731c9..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/ExpectJsonRpcError.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.condition.priv; - -import static org.assertj.core.api.Assertions.failBecauseExceptionWasNotThrown; - -import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcError; -import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.RpcErrorType; -import org.hyperledger.besu.tests.acceptance.dsl.condition.Condition; -import org.hyperledger.besu.tests.acceptance.dsl.node.Node; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction; - -import org.assertj.core.api.Assertions; -import org.web3j.protocol.exceptions.ClientConnectionException; - -public class ExpectJsonRpcError implements Condition { - - private final Transaction transaction; - private final JsonRpcError error; - - public ExpectJsonRpcError(final Transaction transaction, final JsonRpcError error) { - this.transaction = transaction; - this.error = error; - } - - public ExpectJsonRpcError(final Transaction transaction, final RpcErrorType error) { - this(transaction, new JsonRpcError(error)); - } - - @Override - public void verify(final Node node) { - try { - node.execute(transaction); - failBecauseExceptionWasNotThrown(ClientConnectionException.class); - } catch (final Exception e) { - Assertions.assertThat(e) - .isInstanceOf(RuntimeException.class) - .hasMessageContaining(error.getMessage()); - } - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivConditions.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivConditions.java deleted file mode 100644 index 2bbf04534de..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivConditions.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.condition.priv; - -import org.hyperledger.besu.datatypes.Address; -import org.hyperledger.besu.datatypes.Hash; -import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.RpcErrorType; -import org.hyperledger.besu.ethereum.privacy.PrivateTransaction; -import org.hyperledger.besu.tests.acceptance.dsl.condition.Condition; -import org.hyperledger.besu.tests.acceptance.dsl.privacy.condition.PrivateCondition; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.PrivacyTransactions; - -import java.util.List; - -public class PrivConditions { - - private final PrivacyTransactions transactions; - - public PrivConditions(final PrivacyTransactions transactions) { - this.transactions = transactions; - } - - public Condition getPrivacyPrecompileAddress(final Address precompileAddress) { - return new PrivGetPrivacyPrecompileAddressSuccess( - transactions.getPrivacyPrecompileAddress(), precompileAddress); - } - - public Condition getPrivateTransaction( - final Hash transactionHash, final PrivateTransaction privateTransaction) { - return new PrivGetPrivateTransactionSuccess( - transactions.getPrivateTransaction(transactionHash), privateTransaction); - } - - public Condition getPrivateTransactionReturnsNull(final Hash transactionHash) { - return new PrivGetPrivateTransactionReturnsNull( - transactions.getPrivateTransaction(transactionHash)); - } - - public Condition createPrivacyGroup( - final List addresses, - final String groupName, - final String groupDescription, - final String groupId) { - return new PrivCreatePrivacyGroupSuccess( - transactions.createPrivacyGroup(addresses, groupName, groupDescription), groupId); - } - - public Condition deletePrivacyGroup(final String groupId) { - return new PrivDeletePrivacyGroupSuccess(transactions.deletePrivacyGroup(groupId), groupId); - } - - public Condition findPrivacyGroup(final int numGroups, final String... groupMembers) { - return new PrivFindPrivacyGroupSuccess(transactions.findPrivacyGroup(groupMembers), numGroups); - } - - public Condition eeaSendRawTransaction(final String transaction) { - return new EeaSendRawTransactionSuccess(transactions.sendRawTransaction(transaction)); - } - - public Condition distributeRawTransaction( - final String transactionRLP, final String enclaveResponseKey) { - return new PrivDistributeRawTransactionSuccess( - transactions.distributeRawTransaction(transactionRLP), enclaveResponseKey); - } - - public Condition getTransactionCount( - final String accountAddress, - final String privacyGroupId, - final int expectedTransactionCount) { - return new PrivGetTransactionCountSuccess( - transactions.getTransactionCount(accountAddress, privacyGroupId), expectedTransactionCount); - } - - public Condition getEeaTransactionCount( - final String accountAddress, - final String privateFrom, - final String[] privateFor, - final int expectedTransactionCount) { - return new PrivGetEeaTransactionCountSuccess( - transactions.getEeaTransactionCount(accountAddress, privateFrom, privateFor), - expectedTransactionCount); - } - - public Condition getSuccessfulTransactionReceipt(final Hash transactionHash) { - return new PrivGetExpectedSuccessfulTransactionReceipt( - transactions.getTransactionReceipt(transactionHash)); - } - - public Condition getFailedTransactionReceipt(final Hash transactionHash) { - return new PrivGetExpectedFailedTransactionReceipt( - transactions.getTransactionReceipt(transactionHash)); - } - - public Condition getInvalidTransactionReceipt(final Hash transactionHash) { - return new PrivGetExpectedInvalidTransactionReceipt( - transactions.getTransactionReceipt(transactionHash)); - } - - public Condition multiTenancyValidationFail( - final Transaction transaction, final RpcErrorType error) { - return new ExpectJsonRpcError(transaction, error); - } - - public PrivateCondition syncingStatus(final boolean isSyncing) { - return new PrivateSyncingStatusCondition(transactions.syncing(), isSyncing); - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivCreatePrivacyGroupSuccess.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivCreatePrivacyGroupSuccess.java deleted file mode 100644 index c507ca4b50f..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivCreatePrivacyGroupSuccess.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.condition.priv; - -import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat; - -import org.hyperledger.besu.tests.acceptance.dsl.condition.Condition; -import org.hyperledger.besu.tests.acceptance.dsl.node.Node; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.PrivCreatePrivacyGroupTransaction; - -public class PrivCreatePrivacyGroupSuccess implements Condition { - - private final PrivCreatePrivacyGroupTransaction transaction; - private final String groupId; - - public PrivCreatePrivacyGroupSuccess( - final PrivCreatePrivacyGroupTransaction transaction, final String groupId) { - this.transaction = transaction; - this.groupId = groupId; - } - - @Override - public void verify(final Node node) { - final String result = node.execute(transaction); - assertThat(result).isEqualTo(groupId); - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivDeletePrivacyGroupSuccess.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivDeletePrivacyGroupSuccess.java deleted file mode 100644 index b2cd4a40ce5..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivDeletePrivacyGroupSuccess.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.condition.priv; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.hyperledger.besu.tests.acceptance.dsl.condition.Condition; -import org.hyperledger.besu.tests.acceptance.dsl.node.Node; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.PrivDeletePrivacyGroupTransaction; - -public class PrivDeletePrivacyGroupSuccess implements Condition { - - private final PrivDeletePrivacyGroupTransaction transaction; - private final String groupId; - - public PrivDeletePrivacyGroupSuccess( - final PrivDeletePrivacyGroupTransaction transaction, final String groupId) { - this.transaction = transaction; - this.groupId = groupId; - } - - @Override - public void verify(final Node node) { - final String result = node.execute(transaction); - assertThat(result).isEqualTo(groupId); - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivDistributeRawTransactionSuccess.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivDistributeRawTransactionSuccess.java deleted file mode 100644 index 4184102cf5a..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivDistributeRawTransactionSuccess.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.condition.priv; - -import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat; - -import org.hyperledger.besu.tests.acceptance.dsl.condition.Condition; -import org.hyperledger.besu.tests.acceptance.dsl.node.Node; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.PrivDistributeRawTransactionTransaction; - -public class PrivDistributeRawTransactionSuccess implements Condition { - - private final PrivDistributeRawTransactionTransaction sendRawTransactionTransaction; - private final String enclaveResponseKey; - - public PrivDistributeRawTransactionSuccess( - final PrivDistributeRawTransactionTransaction sendRawTransactionTransaction, - final String enclaveResponseKey) { - this.sendRawTransactionTransaction = sendRawTransactionTransaction; - this.enclaveResponseKey = enclaveResponseKey; - } - - @Override - public void verify(final Node node) { - final String result = node.execute(sendRawTransactionTransaction); - assertThat(result).isNotNull(); - assertThat(result).isInstanceOf(String.class); - assertThat(result).isEqualTo(enclaveResponseKey); - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivFindPrivacyGroupSuccess.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivFindPrivacyGroupSuccess.java deleted file mode 100644 index f4a069a243f..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivFindPrivacyGroupSuccess.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.condition.priv; - -import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat; - -import org.hyperledger.besu.enclave.types.PrivacyGroup; -import org.hyperledger.besu.tests.acceptance.dsl.condition.Condition; -import org.hyperledger.besu.tests.acceptance.dsl.node.Node; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.PrivFindPrivacyGroupTransaction; - -public class PrivFindPrivacyGroupSuccess implements Condition { - - private final PrivFindPrivacyGroupTransaction transaction; - private final int numGroups; - - public PrivFindPrivacyGroupSuccess( - final PrivFindPrivacyGroupTransaction transaction, final int numGroups) { - this.transaction = transaction; - this.numGroups = numGroups; - } - - @Override - public void verify(final Node node) { - final PrivacyGroup[] privacyGroups = node.execute(transaction); - assertThat(privacyGroups).hasSize(numGroups); - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivGetEeaTransactionCountSuccess.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivGetEeaTransactionCountSuccess.java deleted file mode 100644 index def5502d98c..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivGetEeaTransactionCountSuccess.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.condition.priv; - -import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat; - -import org.hyperledger.besu.tests.acceptance.dsl.condition.Condition; -import org.hyperledger.besu.tests.acceptance.dsl.node.Node; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.PrivGetEeaTransactionCountTransaction; - -public class PrivGetEeaTransactionCountSuccess implements Condition { - - private final PrivGetEeaTransactionCountTransaction privGetEeaTransactionCountTransaction; - private final int expectedTransactionCount; - - public PrivGetEeaTransactionCountSuccess( - final PrivGetEeaTransactionCountTransaction privGetEeaTransactionCountTransaction, - final int expectedTransactionCount) { - this.privGetEeaTransactionCountTransaction = privGetEeaTransactionCountTransaction; - this.expectedTransactionCount = expectedTransactionCount; - } - - @Override - public void verify(final Node node) { - final int result = node.execute(privGetEeaTransactionCountTransaction); - assertThat(result).isNotNull(); - assertThat(result).isInstanceOf(Integer.class); - assertThat(result).isEqualTo(expectedTransactionCount); - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivGetExpectedFailedTransactionReceipt.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivGetExpectedFailedTransactionReceipt.java deleted file mode 100644 index fc3b0818796..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivGetExpectedFailedTransactionReceipt.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.condition.priv; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.hyperledger.besu.tests.acceptance.dsl.WaitUtils; -import org.hyperledger.besu.tests.acceptance.dsl.condition.Condition; -import org.hyperledger.besu.tests.acceptance.dsl.node.Node; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.PrivGetTransactionReceiptTransaction; - -public class PrivGetExpectedFailedTransactionReceipt implements Condition { - - private final PrivGetTransactionReceiptTransaction getTransactionReceiptTransaction; - - public PrivGetExpectedFailedTransactionReceipt( - final PrivGetTransactionReceiptTransaction getTransactionReceiptTransaction) { - this.getTransactionReceiptTransaction = getTransactionReceiptTransaction; - } - - @Override - public void verify(final Node node) { - WaitUtils.waitFor(() -> assertThat(node.execute(getTransactionReceiptTransaction)).isNotNull()); - assertThat(node.execute(getTransactionReceiptTransaction).getStatus()).isEqualTo("0x0"); - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivGetExpectedInvalidTransactionReceipt.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivGetExpectedInvalidTransactionReceipt.java deleted file mode 100644 index 75a344ded77..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivGetExpectedInvalidTransactionReceipt.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.condition.priv; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.hyperledger.besu.tests.acceptance.dsl.WaitUtils; -import org.hyperledger.besu.tests.acceptance.dsl.condition.Condition; -import org.hyperledger.besu.tests.acceptance.dsl.node.Node; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.PrivGetTransactionReceiptTransaction; - -public class PrivGetExpectedInvalidTransactionReceipt implements Condition { - - private final PrivGetTransactionReceiptTransaction getTransactionReceiptTransaction; - - public PrivGetExpectedInvalidTransactionReceipt( - final PrivGetTransactionReceiptTransaction getTransactionReceiptTransaction) { - this.getTransactionReceiptTransaction = getTransactionReceiptTransaction; - } - - @Override - public void verify(final Node node) { - WaitUtils.waitFor(() -> assertThat(node.execute(getTransactionReceiptTransaction)).isNotNull()); - assertThat(node.execute(getTransactionReceiptTransaction).getStatus()).isEqualTo("0x2"); - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivGetExpectedSuccessfulTransactionReceipt.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivGetExpectedSuccessfulTransactionReceipt.java deleted file mode 100644 index cefc110e1b2..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivGetExpectedSuccessfulTransactionReceipt.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.condition.priv; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.hyperledger.besu.tests.acceptance.dsl.WaitUtils; -import org.hyperledger.besu.tests.acceptance.dsl.condition.Condition; -import org.hyperledger.besu.tests.acceptance.dsl.node.Node; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.PrivGetTransactionReceiptTransaction; - -public class PrivGetExpectedSuccessfulTransactionReceipt implements Condition { - - private final PrivGetTransactionReceiptTransaction getTransactionReceiptTransaction; - - public PrivGetExpectedSuccessfulTransactionReceipt( - final PrivGetTransactionReceiptTransaction getTransactionReceiptTransaction) { - this.getTransactionReceiptTransaction = getTransactionReceiptTransaction; - } - - @Override - public void verify(final Node node) { - WaitUtils.waitFor(() -> assertThat(node.execute(getTransactionReceiptTransaction)).isNotNull()); - assertThat(node.execute(getTransactionReceiptTransaction).getStatus()).isEqualTo("0x1"); - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivGetPrivacyPrecompileAddressSuccess.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivGetPrivacyPrecompileAddressSuccess.java deleted file mode 100644 index a3992da4327..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivGetPrivacyPrecompileAddressSuccess.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.condition.priv; - -import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat; - -import org.hyperledger.besu.datatypes.Address; -import org.hyperledger.besu.tests.acceptance.dsl.condition.Condition; -import org.hyperledger.besu.tests.acceptance.dsl.node.Node; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.PrivGetPrivacyPrecompileAddressTransaction; - -public class PrivGetPrivacyPrecompileAddressSuccess implements Condition { - - private final PrivGetPrivacyPrecompileAddressTransaction transaction; - private final Address precompileAddress; - - public PrivGetPrivacyPrecompileAddressSuccess( - final PrivGetPrivacyPrecompileAddressTransaction transaction, - final Address precompileAddress) { - this.transaction = transaction; - this.precompileAddress = precompileAddress; - } - - @Override - public void verify(final Node node) { - final Address result = node.execute(transaction); - assertThat(result).isInstanceOf(Address.class); - assertThat(result).isEqualTo(precompileAddress); - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivGetPrivateTransactionReturnsNull.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivGetPrivateTransactionReturnsNull.java deleted file mode 100644 index da6f7f519bf..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivGetPrivateTransactionReturnsNull.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.condition.priv; - -import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat; - -import org.hyperledger.besu.tests.acceptance.dsl.condition.Condition; -import org.hyperledger.besu.tests.acceptance.dsl.node.Node; -import org.hyperledger.besu.tests.acceptance.dsl.privacy.PrivateTransactionGroupResponse; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.PrivGetPrivateTransactionTransaction; - -public class PrivGetPrivateTransactionReturnsNull implements Condition { - - private final PrivGetPrivateTransactionTransaction transaction; - - public PrivGetPrivateTransactionReturnsNull( - final PrivGetPrivateTransactionTransaction transaction) { - this.transaction = transaction; - } - - @Override - public void verify(final Node node) { - final PrivateTransactionGroupResponse result = node.execute(transaction); - assertThat(result).isNull(); - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivGetPrivateTransactionSuccess.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivGetPrivateTransactionSuccess.java deleted file mode 100644 index b09b1b29bca..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivGetPrivateTransactionSuccess.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.condition.priv; - -import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat; - -import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.privacy.PrivateTransactionGroupResult; -import org.hyperledger.besu.ethereum.privacy.PrivateTransaction; -import org.hyperledger.besu.tests.acceptance.dsl.condition.Condition; -import org.hyperledger.besu.tests.acceptance.dsl.node.Node; -import org.hyperledger.besu.tests.acceptance.dsl.privacy.PrivateTransactionGroupResponse; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.PrivGetPrivateTransactionTransaction; - -public class PrivGetPrivateTransactionSuccess implements Condition { - - private final PrivGetPrivateTransactionTransaction transaction; - private final PrivateTransactionGroupResult privateTransaction; - - public PrivGetPrivateTransactionSuccess( - final PrivGetPrivateTransactionTransaction transaction, - final PrivateTransaction privateTransaction) { - this.transaction = transaction; - this.privateTransaction = new PrivateTransactionGroupResult(privateTransaction); - } - - @Override - public void verify(final Node node) { - final PrivateTransactionGroupResponse result = node.execute(transaction); - assertThat(result).usingRecursiveComparison().isEqualTo(privateTransaction); - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivGetTransactionCountSuccess.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivGetTransactionCountSuccess.java deleted file mode 100644 index 823548effaf..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivGetTransactionCountSuccess.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.condition.priv; - -import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat; - -import org.hyperledger.besu.tests.acceptance.dsl.condition.Condition; -import org.hyperledger.besu.tests.acceptance.dsl.node.Node; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.PrivGetTransactionCountTransaction; - -public class PrivGetTransactionCountSuccess implements Condition { - - private final PrivGetTransactionCountTransaction privGetTransactionCountTransaction; - private final int expectedTransactionCount; - - public PrivGetTransactionCountSuccess( - final PrivGetTransactionCountTransaction privGetTransactionCountTransaction, - final int expectedTransactionCount) { - this.privGetTransactionCountTransaction = privGetTransactionCountTransaction; - this.expectedTransactionCount = expectedTransactionCount; - } - - @Override - public void verify(final Node node) { - final Integer result = node.execute(privGetTransactionCountTransaction); - assertThat(result).isNotNull(); - assertThat(result).isInstanceOf(Integer.class); - assertThat(result).isEqualTo(expectedTransactionCount); - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivateSyncingStatusCondition.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivateSyncingStatusCondition.java deleted file mode 100644 index 067cba268d2..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivateSyncingStatusCondition.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright contributors to Hyperledger Besu. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.condition.priv; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.hyperledger.besu.tests.acceptance.dsl.WaitUtils; -import org.hyperledger.besu.tests.acceptance.dsl.privacy.PrivacyNode; -import org.hyperledger.besu.tests.acceptance.dsl.privacy.condition.PrivateCondition; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.PrivSyncingTransactions; - -public class PrivateSyncingStatusCondition implements PrivateCondition { - - private final PrivSyncingTransactions transaction; - private final boolean syncingMiningStatus; - - public PrivateSyncingStatusCondition( - final PrivSyncingTransactions transaction, final boolean syncingStatus) { - this.transaction = transaction; - this.syncingMiningStatus = syncingStatus; - } - - @Override - public void verify(final PrivacyNode node) { - WaitUtils.waitFor( - 10, () -> assertThat(node.execute(transaction)).isEqualTo(syncingMiningStatus)); - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/BesuNode.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/BesuNode.java index 1ae27d62614..157421531bb 100644 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/BesuNode.java +++ b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/BesuNode.java @@ -49,7 +49,6 @@ import org.hyperledger.besu.tests.acceptance.dsl.transaction.miner.MinerRequestFactory; import org.hyperledger.besu.tests.acceptance.dsl.transaction.net.CustomRequestFactory; import org.hyperledger.besu.tests.acceptance.dsl.transaction.perm.PermissioningJsonRpcRequestFactory; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.PrivacyRequestFactory; import org.hyperledger.besu.tests.acceptance.dsl.transaction.txpool.TxPoolRequestFactory; import java.io.File; @@ -445,7 +444,6 @@ public NodeRequests nodeRequests() { new BftRequestFactory(web3jService, bftType), new PermissioningJsonRpcRequestFactory(web3jService), new AdminRequestFactory(web3jService), - new PrivacyRequestFactory(web3jService), new CustomRequestFactory(web3jService), new MinerRequestFactory(web3jService), new TxPoolRequestFactory(web3jService), diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/configuration/BesuNodeFactory.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/configuration/BesuNodeFactory.java index 9660f6ee9dc..0451d2a7212 100644 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/configuration/BesuNodeFactory.java +++ b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/configuration/BesuNodeFactory.java @@ -20,16 +20,8 @@ import static org.hyperledger.besu.ethereum.api.jsonrpc.RpcApis.IBFT; import org.hyperledger.besu.crypto.KeyPair; -import org.hyperledger.besu.datatypes.Wei; -import org.hyperledger.besu.enclave.EnclaveFactory; import org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcConfiguration; import org.hyperledger.besu.ethereum.api.jsonrpc.websocket.WebSocketConfiguration; -import org.hyperledger.besu.ethereum.core.AddressHelpers; -import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters; -import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters.MutableInitValues; -import org.hyperledger.besu.ethereum.core.InMemoryPrivacyStorageProvider; -import org.hyperledger.besu.ethereum.core.MiningParameters; -import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.permissioning.LocalPermissioningConfiguration; import org.hyperledger.besu.ethereum.permissioning.PermissioningConfiguration; import org.hyperledger.besu.ethereum.worldstate.DataStorageConfiguration; @@ -45,7 +37,6 @@ import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; -import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -53,8 +44,6 @@ import java.util.Set; import java.util.function.UnaryOperator; -import io.vertx.core.Vertx; - public class BesuNodeFactory { private final NodeConfigurationFactory node = new NodeConfigurationFactory(); @@ -288,49 +277,6 @@ public BesuNode createNodeWithP2pDisabled(final String name) throws IOException .build()); } - public BesuNode createNodeWithMultiTenantedPrivacy( - final String name, - final String enclaveUrl, - final String authFile, - final String privTransactionSigningKey, - final boolean enableFlexiblePrivacy, - final boolean enablePrivateNonceAlwaysIncrements) - throws IOException, URISyntaxException { - final PrivacyParameters.Builder privacyParametersBuilder = new PrivacyParameters.Builder(); - final PrivacyParameters privacyParameters = - privacyParametersBuilder - .setMultiTenancyEnabled(true) - .setEnabled(true) - .setFlexiblePrivacyGroupsEnabled(enableFlexiblePrivacy) - .setStorageProvider(new InMemoryPrivacyStorageProvider()) - .setEnclaveFactory(new EnclaveFactory(Vertx.vertx())) - .setEnclaveUrl(URI.create(enclaveUrl)) - .setPrivateNonceAlwaysIncrementsEnabled(enablePrivateNonceAlwaysIncrements) - .setPrivateKeyPath( - Paths.get(ClassLoader.getSystemResource(privTransactionSigningKey).toURI())) - .build(); - - final MiningParameters miningParameters = - ImmutableMiningParameters.builder() - .mutableInitValues( - MutableInitValues.builder() - .isMiningEnabled(true) - .minTransactionGasPrice(Wei.ZERO) - .coinbase(AddressHelpers.ofValue(1)) - .build()) - .build(); - - return create( - new BesuNodeConfigurationBuilder() - .name(name) - .jsonRpcEnabled() - .jsonRpcAuthenticationConfiguration(authFile) - .enablePrivateTransactions() - .privacyParameters(privacyParameters) - .miningConfiguration(miningParameters) - .build()); - } - public BesuNode createArchiveNodeWithRpcDisabled(final String name) throws IOException { return create(new BesuNodeConfigurationBuilder().name(name).build()); } diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/configuration/privacy/PrivacyNodeConfiguration.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/configuration/privacy/PrivacyNodeConfiguration.java deleted file mode 100644 index 05c989e54aa..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/configuration/privacy/PrivacyNodeConfiguration.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.node.configuration.privacy; - -import org.hyperledger.besu.tests.acceptance.dsl.node.configuration.BesuNodeConfiguration; -import org.hyperledger.enclave.testutil.EnclaveKeyConfiguration; - -public class PrivacyNodeConfiguration { - - private final boolean isFlexiblePrivacyGroupEnabled; - private final boolean isMultitenancyEnabled; - private final boolean isPrivacyPluginEnabled; - private final BesuNodeConfiguration besuConfig; - private final EnclaveKeyConfiguration keyConfig; - - PrivacyNodeConfiguration( - final BesuNodeConfiguration besuConfig, final EnclaveKeyConfiguration keyConfig) { - this(false, false, false, besuConfig, keyConfig); - } - - public PrivacyNodeConfiguration( - final boolean isFlexiblePrivacyGroupEnabled, - final boolean isMultitenancyEnabled, - final boolean isPrivacyPluginEnabled, - final BesuNodeConfiguration besuConfig, - final EnclaveKeyConfiguration keyConfig) { - this.isFlexiblePrivacyGroupEnabled = isFlexiblePrivacyGroupEnabled; - this.besuConfig = besuConfig; - this.keyConfig = keyConfig; - this.isMultitenancyEnabled = isMultitenancyEnabled; - this.isPrivacyPluginEnabled = isPrivacyPluginEnabled; - } - - public boolean isFlexiblePrivacyGroupEnabled() { - return isFlexiblePrivacyGroupEnabled; - } - - public boolean isMultitenancyEnabled() { - return isMultitenancyEnabled; - } - - public boolean isPrivacyPluginEnabled() { - return isPrivacyPluginEnabled; - } - - public BesuNodeConfiguration getBesuConfig() { - return besuConfig; - } - - public EnclaveKeyConfiguration getKeyConfig() { - return keyConfig; - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/configuration/privacy/PrivacyNodeFactory.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/configuration/privacy/PrivacyNodeFactory.java deleted file mode 100644 index 03188db8a27..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/configuration/privacy/PrivacyNodeFactory.java +++ /dev/null @@ -1,294 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.node.configuration.privacy; - -import org.hyperledger.besu.tests.acceptance.dsl.node.configuration.BesuNodeConfigurationBuilder; -import org.hyperledger.besu.tests.acceptance.dsl.node.configuration.NodeConfigurationFactory; -import org.hyperledger.besu.tests.acceptance.dsl.node.configuration.genesis.GenesisConfigurationFactory; -import org.hyperledger.besu.tests.acceptance.dsl.privacy.PrivacyNode; -import org.hyperledger.besu.tests.acceptance.dsl.privacy.account.PrivacyAccount; -import org.hyperledger.enclave.testutil.EnclaveEncryptorType; -import org.hyperledger.enclave.testutil.EnclaveKeyConfiguration; -import org.hyperledger.enclave.testutil.EnclaveType; - -import java.io.IOException; -import java.net.URISyntaxException; -import java.util.Collections; -import java.util.List; -import java.util.Optional; - -import io.vertx.core.Vertx; -import org.testcontainers.containers.Network; - -public class PrivacyNodeFactory { - - private final NodeConfigurationFactory node = new NodeConfigurationFactory(); - private final Vertx vertx; - - public PrivacyNodeFactory(final Vertx vertx) { - this.vertx = vertx; - } - - public PrivacyNode create( - final PrivacyNodeConfiguration privacyNodeConfig, - final EnclaveType enclaveType, - final Optional containerNetwork) - throws IOException { - return new PrivacyNode(privacyNodeConfig, vertx, enclaveType, containerNetwork); - } - - public PrivacyNode createPrivateTransactionEnabledMinerNode( - final String name, - final PrivacyAccount privacyAccount, - final EnclaveType enclaveType, - final Optional containerNetwork, - final boolean isFlexiblePrivacyGroupEnabled, - final boolean isMultitenancyEnabled, - final boolean isPrivacyPluginEnabled) - throws IOException { - return create( - new PrivacyNodeConfiguration( - isFlexiblePrivacyGroupEnabled, - isMultitenancyEnabled, - isPrivacyPluginEnabled, - new BesuNodeConfigurationBuilder() - .name(name) - .miningEnabled() - .jsonRpcEnabled() - .webSocketEnabled() - .enablePrivateTransactions() - .keyFilePath(privacyAccount.getPrivateKeyPath()) - .plugins(Collections.singletonList("testPlugins")) - .extraCLIOptions(List.of("--plugin-privacy-service-encryption-prefix=0xAA")) - .build(), - new EnclaveKeyConfiguration( - privacyAccount.getEnclaveKeyPaths(), - privacyAccount.getEnclavePrivateKeyPaths(), - privacyAccount.getEnclaveEncryptorType())), - enclaveType, - containerNetwork); - } - - public PrivacyNode createPrivateTransactionEnabledNode( - final String name, - final PrivacyAccount privacyAccount, - final EnclaveType enclaveType, - final Optional containerNetwork, - final boolean isFlexiblePrivacyGroupEnabled, - final boolean isMultitenancyEnabled, - final boolean isPrivacyPluginEnabled) - throws IOException { - return create( - new PrivacyNodeConfiguration( - isFlexiblePrivacyGroupEnabled, - isMultitenancyEnabled, - isPrivacyPluginEnabled, - new BesuNodeConfigurationBuilder() - .name(name) - .jsonRpcEnabled() - .keyFilePath(privacyAccount.getPrivateKeyPath()) - .enablePrivateTransactions() - .webSocketEnabled() - .plugins(Collections.singletonList("testPlugins")) - .extraCLIOptions(List.of("--plugin-privacy-service-encryption-prefix=0xBB")) - .build(), - new EnclaveKeyConfiguration( - privacyAccount.getEnclaveKeyPaths(), - privacyAccount.getEnclavePrivateKeyPaths(), - privacyAccount.getEnclaveEncryptorType())), - enclaveType, - containerNetwork); - } - - public PrivacyNode createIbft2NodePrivacyEnabled( - final String name, - final PrivacyAccount privacyAccount, - final boolean minerEnabled, - final EnclaveType enclaveType, - final Optional containerNetwork, - final boolean isFlexiblePrivacyGroupEnabled, - final boolean isMultitenancyEnabled, - final boolean isPrivacyPluginEnabled, - final String unrestrictedPrefix) - throws IOException { - return create( - new PrivacyNodeConfiguration( - isFlexiblePrivacyGroupEnabled, - isMultitenancyEnabled, - isPrivacyPluginEnabled, - new BesuNodeConfigurationBuilder() - .name(name) - .miningEnabled() - .jsonRpcConfiguration(node.createJsonRpcWithIbft2EnabledConfig(minerEnabled)) - .webSocketConfiguration(node.createWebSocketEnabledConfig()) - .devMode(false) - .genesisConfigProvider(GenesisConfigurationFactory::createPrivacyIbft2GenesisConfig) - .keyFilePath(privacyAccount.getPrivateKeyPath()) - .enablePrivateTransactions() - .plugins(Collections.singletonList("testPlugins")) - .extraCLIOptions( - List.of("--plugin-privacy-service-encryption-prefix=" + unrestrictedPrefix)) - .build(), - new EnclaveKeyConfiguration( - privacyAccount.getEnclaveKeyPaths(), - privacyAccount.getEnclavePrivateKeyPaths(), - privacyAccount.getEnclaveEncryptorType())), - enclaveType, - containerNetwork); - } - - public PrivacyNode createIbft2NodePrivacyEnabledWithGenesis( - final String name, - final PrivacyAccount privacyAccount, - final boolean minerEnabled, - final EnclaveType enclaveType, - final Optional containerNetwork, - final boolean isFlexiblePrivacyGroupEnabled, - final boolean isMultitenancyEnabled, - final boolean isPrivacyPluginEnabled, - final String unrestrictedPrefix) - throws IOException { - return create( - new PrivacyNodeConfiguration( - isFlexiblePrivacyGroupEnabled, - isMultitenancyEnabled, - isPrivacyPluginEnabled, - new BesuNodeConfigurationBuilder() - .name(name) - .miningEnabled() - .jsonRpcConfiguration(node.createJsonRpcWithIbft2EnabledConfig(minerEnabled)) - .webSocketConfiguration(node.createWebSocketEnabledConfig()) - .devMode(false) - .genesisConfigProvider(GenesisConfigurationFactory::createPrivacyIbft2GenesisConfig) - .keyFilePath(privacyAccount.getPrivateKeyPath()) - .enablePrivateTransactions() - .plugins(Collections.singletonList("testPlugins")) - .extraCLIOptions( - List.of( - "--plugin-privacy-service-encryption-prefix=" + unrestrictedPrefix, - "--plugin-privacy-service-genesis-enabled=true")) - .build(), - new EnclaveKeyConfiguration( - privacyAccount.getEnclaveKeyPaths(), - privacyAccount.getEnclavePrivateKeyPaths(), - privacyAccount.getEnclaveEncryptorType())), - enclaveType, - containerNetwork); - } - - public PrivacyNode createQbftNodePrivacyEnabled( - final String name, - final PrivacyAccount privacyAccount, - final EnclaveType enclaveType, - final Optional containerNetwork, - final boolean isFlexiblePrivacyGroupEnabled, - final boolean isMultitenancyEnabled, - final boolean isPrivacyPluginEnabled, - final String unrestrictedPrefix) - throws IOException { - return create( - new PrivacyNodeConfiguration( - isFlexiblePrivacyGroupEnabled, - isMultitenancyEnabled, - isPrivacyPluginEnabled, - new BesuNodeConfigurationBuilder() - .name(name) - .miningEnabled() - .jsonRpcConfiguration(node.createJsonRpcWithQbftEnabledConfig(false)) - .webSocketConfiguration(node.createWebSocketEnabledConfig()) - .devMode(false) - .genesisConfigProvider(GenesisConfigurationFactory::createQbftGenesisConfig) - .keyFilePath(privacyAccount.getPrivateKeyPath()) - .enablePrivateTransactions() - .plugins(Collections.singletonList("testPlugins")) - .extraCLIOptions( - List.of("--plugin-privacy-service-encryption-prefix=" + unrestrictedPrefix)) - .build(), - new EnclaveKeyConfiguration( - privacyAccount.getEnclaveKeyPaths(), - privacyAccount.getEnclavePrivateKeyPaths(), - privacyAccount.getEnclaveEncryptorType())), - enclaveType, - containerNetwork); - } - - public PrivacyNode createFlexiblePrivacyGroupEnabledMinerNode( - final String name, - final PrivacyAccount privacyAccount, - final boolean multiTenancyEnabled, - final EnclaveType enclaveType, - final Optional containerNetwork) - throws IOException, URISyntaxException { - final BesuNodeConfigurationBuilder besuNodeConfigurationBuilder = - new BesuNodeConfigurationBuilder(); - if (multiTenancyEnabled) { - final String authPrivTomlPath = - EnclaveEncryptorType.EC.equals(privacyAccount.getEnclaveEncryptorType()) - ? "authentication/auth_priv_ec_pubkey.toml" - : "authentication/auth_priv.toml"; - besuNodeConfigurationBuilder.jsonRpcAuthenticationConfiguration(authPrivTomlPath); - } - return create( - new PrivacyNodeConfiguration( - true, - multiTenancyEnabled, - false, - besuNodeConfigurationBuilder - .name(name) - .miningEnabled() - .jsonRpcEnabled() - .webSocketEnabled() - .enablePrivateTransactions() - .plugins(Collections.singletonList("testPlugins")) - .extraCLIOptions(List.of("--plugin-privacy-service-genesis-enabled=true")) - .keyFilePath(privacyAccount.getPrivateKeyPath()) - .build(), - new EnclaveKeyConfiguration( - privacyAccount.getEnclaveKeyPaths(), - privacyAccount.getEnclavePrivateKeyPaths(), - privacyAccount.getEnclaveEncryptorType())), - enclaveType, - containerNetwork); - } - - public PrivacyNode createFlexiblePrivacyGroupEnabledNode( - final String name, - final PrivacyAccount privacyAccount, - final boolean multiTenancyEnabled, - final EnclaveType enclaveType, - final Optional containerNetwork) - throws IOException { - return create( - new PrivacyNodeConfiguration( - true, - multiTenancyEnabled, - false, - new BesuNodeConfigurationBuilder() - .name(name) - .jsonRpcEnabled() - .keyFilePath(privacyAccount.getPrivateKeyPath()) - .enablePrivateTransactions() - .plugins(Collections.singletonList("testPlugins")) - .extraCLIOptions(List.of("--plugin-privacy-service-genesis-enabled=true")) - .webSocketEnabled() - .build(), - new EnclaveKeyConfiguration( - privacyAccount.getEnclaveKeyPaths(), - privacyAccount.getEnclavePrivateKeyPaths(), - privacyAccount.getEnclaveEncryptorType())), - enclaveType, - containerNetwork); - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/PrivacyCluster.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/PrivacyCluster.java deleted file mode 100644 index 3d1fc148059..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/PrivacyCluster.java +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.privacy; - -import static java.util.Collections.emptyList; -import static java.util.function.Predicate.not; - -import org.hyperledger.besu.tests.acceptance.dsl.condition.net.NetConditions; -import org.hyperledger.besu.tests.acceptance.dsl.node.BesuNodeRunner; -import org.hyperledger.besu.tests.acceptance.dsl.node.RunnableNode; -import org.hyperledger.enclave.testutil.EnclaveType; -import org.hyperledger.enclave.testutil.TesseraTestHarness; - -import java.net.URI; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Optional; -import java.util.stream.Collectors; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class PrivacyCluster { - private static final Logger LOG = LoggerFactory.getLogger(PrivacyCluster.class); - private final NetConditions net; - private final BesuNodeRunner besuNodeRunner; - - private List nodes = emptyList(); - private List runnableNodes = emptyList(); - private PrivacyNode bootNode; - - public PrivacyCluster(final NetConditions net) { - this.net = net; - this.besuNodeRunner = BesuNodeRunner.instance(); - } - - public void start(final PrivacyNode... nodes) { - start(Arrays.asList(nodes)); - } - - public void start(final List nodes) { - startNodes(nodes); - awaitPeerCount(nodes); - } - - public void startNodes(final PrivacyNode... nodes) { - startNodes(Arrays.asList(nodes)); - } - - public void startNodes(final List nodes) { - if (nodes.isEmpty()) { - throw new IllegalArgumentException("Can't start a cluster with no nodes"); - } - this.nodes = nodes; - this.runnableNodes = nodes.stream().map(PrivacyNode::getBesu).collect(Collectors.toList()); - - final Optional bootNode = selectAndStartBootnode(nodes); - - nodes.parallelStream() - .filter(node -> bootNode.map(boot -> boot != node).orElse(true)) - .forEach(this::startNode); - } - - public void awaitPeerCount(final PrivacyNode... nodes) { - awaitPeerCount(Arrays.asList(nodes)); - } - - public void awaitPeerCount(final List nodes) { - for (final PrivacyNode node : nodes) { - LOG.info("Awaiting peer discovery for node {}", node.getName()); - node.awaitPeerDiscovery(net.awaitPeerCount(nodes.size() - 1)); - } - - verifyAllEnclaveNetworkConnections(); - } - - public List getNodes() { - return nodes; - } - - /** Verify that each Enclave has connected to every other Enclave */ - public void verifyAllEnclaveNetworkConnections() { - nodes.forEach( - privacyNode -> { - final List otherNodes = - nodes.stream() - .filter(not(privacyNode::equals)) - .collect(Collectors.toUnmodifiableList()); - privacyNode.testEnclaveConnection(otherNodes); - }); - } - - public void stop() { - for (final PrivacyNode node : nodes) { - besuNodeRunner.stopNode(node.getBesu()); - } - } - - public void stopNode(final PrivacyNode node) { - node.getEnclave().stop(); - besuNodeRunner.stopNode(node.getBesu()); - } - - public void close() { - stop(); - for (final PrivacyNode node : nodes) { - node.close(); - } - besuNodeRunner.shutdown(); - } - - private Optional selectAndStartBootnode(final List nodes) { - final Optional bootNode = - nodes.stream() - .filter(node -> node.getConfiguration().isBootnodeEligible()) - .filter(node -> node.getConfiguration().isP2pEnabled()) - .filter(node -> node.getConfiguration().isDiscoveryEnabled()) - .findFirst(); - - bootNode.ifPresent( - b -> { - LOG.info("Selected node {} as bootnode", b.getName()); - startNode(b, true); - this.bootNode = b; - }); - - return bootNode; - } - - private void startNode(final PrivacyNode node) { - startNode(node, false); - } - - private void startNode(final PrivacyNode node, final boolean isBootNode) { - node.getConfiguration() - .setBootnodes(isBootNode ? emptyList() : Collections.singletonList(bootNode.enodeUrl())); - - node.getConfiguration() - .getGenesisConfigProvider() - .create(runnableNodes) - .ifPresent(node.getConfiguration()::setGenesisConfig); - - if (!isBootNode) { - if (bootNode.getEnclave().getEnclaveType() == EnclaveType.TESSERA) { - final URI otherNode = bootNode.getEnclave().nodeUrl(); - try { - // Substitute IP with hostname for test container network - final URI otherNodeHostname = - new URI( - otherNode.getScheme() - + "://" - + bootNode.getName() - + ":" - + TesseraTestHarness.p2pPort); - node.addOtherEnclaveNode(otherNodeHostname); - } catch (Exception ex) { - throw new RuntimeException("Invalid node URI"); - } - } else { - node.addOtherEnclaveNode(bootNode.getEnclave().nodeUrl()); - } - } - - LOG.info( - "Starting node {} (id = {}...{})", - node.getName(), - node.getNodeId().substring(0, 4), - node.getNodeId().substring(124)); - node.start(besuNodeRunner); - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/PrivacyNode.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/PrivacyNode.java deleted file mode 100644 index d54bf908726..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/PrivacyNode.java +++ /dev/null @@ -1,315 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.privacy; - -import static org.hyperledger.besu.controller.BesuController.DATABASE_PATH; -import static org.hyperledger.besu.plugin.services.storage.rocksdb.configuration.RocksDBCLIOptions.DEFAULT_BACKGROUND_THREAD_COUNT; -import static org.hyperledger.besu.plugin.services.storage.rocksdb.configuration.RocksDBCLIOptions.DEFAULT_CACHE_CAPACITY; -import static org.hyperledger.besu.plugin.services.storage.rocksdb.configuration.RocksDBCLIOptions.DEFAULT_IS_HIGH_SPEC; -import static org.hyperledger.besu.plugin.services.storage.rocksdb.configuration.RocksDBCLIOptions.DEFAULT_MAX_OPEN_FILES; - -import org.hyperledger.besu.crypto.KeyPairUtil; -import org.hyperledger.besu.datatypes.Address; -import org.hyperledger.besu.enclave.Enclave; -import org.hyperledger.besu.enclave.EnclaveClientException; -import org.hyperledger.besu.enclave.EnclaveFactory; -import org.hyperledger.besu.enclave.EnclaveIOException; -import org.hyperledger.besu.enclave.EnclaveServerException; -import org.hyperledger.besu.ethereum.core.PrivacyParameters; -import org.hyperledger.besu.ethereum.privacy.storage.PrivacyStorageProvider; -import org.hyperledger.besu.ethereum.privacy.storage.keyvalue.PrivacyKeyValueStorageProviderBuilder; -import org.hyperledger.besu.ethereum.storage.keyvalue.KeyValueSegmentIdentifier; -import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem; -import org.hyperledger.besu.plugin.services.storage.rocksdb.RocksDBKeyValuePrivacyStorageFactory; -import org.hyperledger.besu.plugin.services.storage.rocksdb.RocksDBKeyValueStorageFactory; -import org.hyperledger.besu.plugin.services.storage.rocksdb.RocksDBMetricsFactory; -import org.hyperledger.besu.plugin.services.storage.rocksdb.configuration.RocksDBFactoryConfiguration; -import org.hyperledger.besu.services.BesuConfigurationImpl; -import org.hyperledger.besu.tests.acceptance.dsl.condition.Condition; -import org.hyperledger.besu.tests.acceptance.dsl.node.BesuNode; -import org.hyperledger.besu.tests.acceptance.dsl.node.BesuNodeRunner; -import org.hyperledger.besu.tests.acceptance.dsl.node.configuration.BesuNodeConfiguration; -import org.hyperledger.besu.tests.acceptance.dsl.node.configuration.NodeConfiguration; -import org.hyperledger.besu.tests.acceptance.dsl.node.configuration.privacy.PrivacyNodeConfiguration; -import org.hyperledger.besu.tests.acceptance.dsl.privacy.condition.PrivateCondition; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction; -import org.hyperledger.enclave.testutil.EnclaveTestHarness; -import org.hyperledger.enclave.testutil.EnclaveType; -import org.hyperledger.enclave.testutil.NoopEnclaveTestHarness; -import org.hyperledger.enclave.testutil.TesseraTestHarnessFactory; - -import java.io.IOException; -import java.net.URI; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Optional; -import java.util.stream.Collectors; - -import io.vertx.core.Vertx; -import org.awaitility.Awaitility; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.testcontainers.containers.Network; - -public class PrivacyNode implements AutoCloseable { - - private static final Logger LOG = LoggerFactory.getLogger(PrivacyNode.class); - - private final EnclaveTestHarness enclave; - private final BesuNode besu; - private final Vertx vertx; - private final boolean isFlexiblePrivacyEnabled; - private final boolean isMultitenancyEnabled; - private final boolean isPrivacyPluginEnabled; - private final BesuNodeConfiguration besuConfig; - - public PrivacyNode( - final PrivacyNodeConfiguration privacyConfiguration, - final Vertx vertx, - final EnclaveType enclaveType, - final Optional containerNetwork) - throws IOException { - final Path enclaveDir = Files.createTempDirectory("acctest-orion"); - final BesuNodeConfiguration config = privacyConfiguration.getBesuConfig(); - this.enclave = - selectEnclave(enclaveType, enclaveDir, config, privacyConfiguration, containerNetwork); - this.vertx = vertx; - - this.besuConfig = config; - - isFlexiblePrivacyEnabled = privacyConfiguration.isFlexiblePrivacyGroupEnabled(); - isMultitenancyEnabled = privacyConfiguration.isMultitenancyEnabled(); - isPrivacyPluginEnabled = privacyConfiguration.isPrivacyPluginEnabled(); - - this.besu = - new BesuNode( - besuConfig.getName(), - besuConfig.getDataPath(), - besuConfig.getMiningParameters(), - besuConfig.getTransactionPoolConfiguration(), - besuConfig.getJsonRpcConfiguration(), - besuConfig.getEngineRpcConfiguration(), - besuConfig.getWebSocketConfiguration(), - besuConfig.getJsonRpcIpcConfiguration(), - besuConfig.getInProcessRpcConfiguration(), - besuConfig.getMetricsConfiguration(), - besuConfig.getPermissioningConfiguration(), - besuConfig.getApiConfiguration(), - besuConfig.getDataStorageConfiguration(), - besuConfig.getKeyFilePath(), - besuConfig.isDevMode(), - besuConfig.getNetwork(), - besuConfig.getGenesisConfigProvider(), - besuConfig.isP2pEnabled(), - besuConfig.getP2pPort(), - besuConfig.getTLSConfiguration(), - besuConfig.getNetworkingConfiguration(), - besuConfig.isDiscoveryEnabled(), - besuConfig.isBootnodeEligible(), - besuConfig.isRevertReasonEnabled(), - besuConfig.isSecp256k1Native(), - besuConfig.isAltbn128Native(), - besuConfig.getPlugins(), - besuConfig.getExtraCLIOptions(), - Collections.emptyList(), - besuConfig.isDnsEnabled(), - besuConfig.getPrivacyParameters(), - List.of(), - Optional.empty(), - besuConfig.isStrictTxReplayProtectionEnabled(), - besuConfig.getEnvironment()); - } - - public void testEnclaveConnection(final List otherNodes) { - if (this.isPrivacyPluginEnabled) { - LOG.info("Skipping test as node has no enclave (isPrivacyPluginEnabled=true)"); - return; - } - - if (!otherNodes.isEmpty()) { - LOG.debug( - String.format( - "Testing Enclave connectivity between %s (%s) and %s (%s)", - besu.getName(), - enclave.nodeUrl(), - Arrays.toString(otherNodes.stream().map(node -> node.besu.getName()).toArray()), - Arrays.toString(otherNodes.stream().map(node -> node.enclave.nodeUrl()).toArray()))); - final EnclaveFactory factory = new EnclaveFactory(vertx); - final Enclave enclaveClient = factory.createVertxEnclave(enclave.clientUrl()); - final String payload = "SGVsbG8sIFdvcmxkIQ=="; - final List to = - otherNodes.stream() - .map(node -> node.enclave.getDefaultPublicKey()) - .collect(Collectors.toList()); - - Awaitility.await() - .until( - () -> { - try { - enclaveClient.send(payload, enclave.getDefaultPublicKey(), to); - return true; - } catch (final EnclaveClientException - | EnclaveIOException - | EnclaveServerException e) { - LOG.warn( - "Waiting for enclave connectivity between {} and {}: " + e.getMessage(), - enclave.getDefaultPublicKey(), - to.get(0)); - return false; - } - }); - } - } - - public EnclaveTestHarness getEnclave() { - return enclave; - } - - public BesuNode getBesu() { - return besu; - } - - public void stop() { - besu.stop(); - enclave.stop(); - } - - @Override - public void close() { - besu.close(); - enclave.close(); - } - - public void start(final BesuNodeRunner runner) { - enclave.start(); - - final PrivacyParameters privacyParameters; - - try { - final Path dataDir = Files.createTempDirectory("acctest-privacy"); - final Path dbDir = dataDir.resolve(DATABASE_PATH); - - var builder = - new PrivacyParameters.Builder() - .setEnabled(true) - .setEnclaveUrl(enclave.clientUrl()) - .setStorageProvider(createKeyValueStorageProvider(dataDir, dbDir)) - .setPrivateKeyPath(KeyPairUtil.getDefaultKeyFile(besu.homeDirectory()).toPath()) - .setEnclaveFactory(new EnclaveFactory(vertx)) - .setFlexiblePrivacyGroupsEnabled(isFlexiblePrivacyEnabled) - .setMultiTenancyEnabled(isMultitenancyEnabled) - .setPrivacyPluginEnabled(isPrivacyPluginEnabled); - - if (enclave.getPublicKeyPaths().size() > 0) { - builder.setPrivacyUserIdUsingFile(enclave.getPublicKeyPaths().get(0).toFile()); - } - - privacyParameters = builder.build(); - - } catch (final IOException e) { - throw new RuntimeException(e); - } - besu.setPrivacyParameters(privacyParameters); - besu.start(runner); - } - - public void awaitPeerDiscovery(final Condition condition) { - besu.awaitPeerDiscovery(condition); - } - - public String getName() { - return besu.getName(); - } - - public Address getAddress() { - return besu.getAddress(); - } - - public URI enodeUrl() { - return besu.enodeUrl(); - } - - public String getNodeId() { - return besu.getNodeId(); - } - - public T execute(final Transaction transaction) { - return besu.execute(transaction); - } - - public void verify(final PrivateCondition expected) { - expected.verify(this); - } - - public String getEnclaveKey() { - return enclave.getDefaultPublicKey(); - } - - public String getTransactionSigningKey() { - return besu.getPrivacyParameters().getSigningKeyPair().orElseThrow().getPrivateKey().toString(); - } - - public void addOtherEnclaveNode(final URI otherNode) { - enclave.addOtherNode(otherNode); - } - - public NodeConfiguration getConfiguration() { - return besu.getConfiguration(); - } - - private PrivacyStorageProvider createKeyValueStorageProvider( - final Path dataLocation, final Path dbLocation) { - final var besuConfiguration = new BesuConfigurationImpl(); - besuConfiguration - .init(dataLocation, dbLocation, besuConfig.getDataStorageConfiguration()) - .withMiningParameters(besuConfig.getMiningParameters()); - return new PrivacyKeyValueStorageProviderBuilder() - .withStorageFactory( - new RocksDBKeyValuePrivacyStorageFactory( - new RocksDBKeyValueStorageFactory( - () -> - new RocksDBFactoryConfiguration( - DEFAULT_MAX_OPEN_FILES, - DEFAULT_BACKGROUND_THREAD_COUNT, - DEFAULT_CACHE_CAPACITY, - DEFAULT_IS_HIGH_SPEC), - Arrays.asList(KeyValueSegmentIdentifier.values()), - RocksDBMetricsFactory.PRIVATE_ROCKS_DB_METRICS))) - .withCommonConfiguration(besuConfiguration) - .withMetricsSystem(new NoOpMetricsSystem()) - .build(); - } - - private EnclaveTestHarness selectEnclave( - final EnclaveType enclaveType, - final Path tempDir, - final BesuNodeConfiguration config, - final PrivacyNodeConfiguration privacyConfiguration, - final Optional containerNetwork) { - - switch (enclaveType) { - case ORION: - throw new UnsupportedOperationException("The Orion tests are getting deprecated"); - case TESSERA: - return TesseraTestHarnessFactory.create( - config.getName(), tempDir, privacyConfiguration.getKeyConfig(), containerNetwork); - default: - return new NoopEnclaveTestHarness(tempDir, privacyConfiguration.getKeyConfig()); - } - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/PrivateTransactionGroupResponse.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/PrivateTransactionGroupResponse.java deleted file mode 100644 index 3cd7ca49a49..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/PrivateTransactionGroupResponse.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.privacy; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; - -public class PrivateTransactionGroupResponse { - private final String from; - private final String gas; - private final String gasPrice; - private final String input; - private final String nonce; - private final String to; - private final String value; - private final String v; - private final String r; - private final String s; - private final String privateFrom; - private final String restriction; - private final String privacyGroupId; - - @JsonCreator - public PrivateTransactionGroupResponse( - @JsonProperty("from") final String from, - @JsonProperty("gas") final String gas, - @JsonProperty("gasPrice") final String gasPrice, - @JsonProperty("hash") final String hash, - @JsonProperty("input") final String input, - @JsonProperty("nonce") final String nonce, - @JsonProperty("to") final String to, - @JsonProperty("value") final String value, - @JsonProperty("v") final String v, - @JsonProperty("r") final String r, - @JsonProperty("s") final String s, - @JsonProperty("privateFrom") final String privateFrom, - @JsonProperty("restriction") final String restriction, - @JsonProperty("privacyGroupId") final String privacyGroupId) { - this.from = from; - this.gas = gas; - this.gasPrice = gasPrice; - this.input = input; - this.nonce = nonce; - this.to = to; - this.value = value; - this.v = v; - this.r = r; - this.s = s; - this.privateFrom = privateFrom; - this.restriction = restriction; - this.privacyGroupId = privacyGroupId; - } - - public String getFrom() { - return from; - } - - public String getGas() { - return gas; - } - - public String getGasPrice() { - return gasPrice; - } - - public String getInput() { - return input; - } - - public String getNonce() { - return nonce; - } - - public String getTo() { - return to; - } - - public String getValue() { - return value; - } - - public String getV() { - return v; - } - - public String getR() { - return r; - } - - public String getS() { - return s; - } - - public String getPrivateFrom() { - return privateFrom; - } - - public String getRestriction() { - return restriction; - } - - public String getPrivacyGroupId() { - return privacyGroupId; - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/account/PrivacyAccount.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/account/PrivacyAccount.java deleted file mode 100644 index c246dd585a5..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/account/PrivacyAccount.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.privacy.account; - -import org.hyperledger.enclave.testutil.EnclaveEncryptorType; - -import java.io.File; -import java.net.URL; -import java.util.Arrays; - -public class PrivacyAccount { - - private final URL privateKeyPath; - private final URL[] enclaveKeyPaths; - private final URL[] enclavePrivateKeyPaths; - private final EnclaveEncryptorType enclaveEncryptorType; - - private PrivacyAccount( - final URL privateKeyPath, - final URL[] enclavePublicKeyPaths, - final URL[] enclavePrivateKeyPaths, - final EnclaveEncryptorType enclaveEncryptorType) { - this.privateKeyPath = privateKeyPath; - this.enclaveKeyPaths = enclavePublicKeyPaths; - this.enclavePrivateKeyPaths = enclavePrivateKeyPaths; - this.enclaveEncryptorType = enclaveEncryptorType; - } - - public static PrivacyAccount create( - final URL privateKeyPath, - final URL enclavePublicKeyPath, - final URL enclavePrivateKeyPath, - final EnclaveEncryptorType enclaveEncryptorType) { - return new PrivacyAccount( - privateKeyPath, - new URL[] {enclavePublicKeyPath}, - new URL[] {enclavePrivateKeyPath}, - enclaveEncryptorType); - } - - public static PrivacyAccount create( - final URL privateKeyPath, - final URL[] enclavePublicKeyPath, - final URL[] enclavePrivateKeyPath, - final EnclaveEncryptorType enclaveEncryptorType) { - return new PrivacyAccount( - privateKeyPath, enclavePublicKeyPath, enclavePrivateKeyPath, enclaveEncryptorType); - } - - public String getPrivateKeyPath() { - return toStringResource(privateKeyPath); - } - - public String[] getEnclaveKeyPaths() { - return Arrays.stream(enclaveKeyPaths) - .map(path -> toStringResource(path)) - .toArray(String[]::new); - } - - public String[] getEnclavePrivateKeyPaths() { - return Arrays.stream(enclavePrivateKeyPaths) - .map(path -> toStringResource(path)) - .toArray(String[]::new); - } - - public EnclaveEncryptorType getEnclaveEncryptorType() { - return enclaveEncryptorType; - } - - private String toStringResource(final URL path) { - return path.getPath().substring(path.getPath().lastIndexOf(File.separator) + 1); - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/account/PrivacyAccountResolver.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/account/PrivacyAccountResolver.java deleted file mode 100644 index 7a6e26f7bce..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/account/PrivacyAccountResolver.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.privacy.account; - -import org.hyperledger.enclave.testutil.EnclaveEncryptorType; - -import java.net.URL; - -/** Supplier of known funded accounts defined in dev.json */ -public enum PrivacyAccountResolver { - ALICE { - @Override - public PrivacyAccount resolve(final EnclaveEncryptorType enclaveEncryptorType) { - return PrivacyAccount.create( - resolveResource("key"), - enclaveEncryptorType.equals(EnclaveEncryptorType.EC) - ? resolveResource("enclave_ec_key_0.pub") - : resolveResource("enclave_key_0.pub"), - enclaveEncryptorType.equals(EnclaveEncryptorType.EC) - ? resolveResource("enclave_ec_key_0.key") - : resolveResource("enclave_key_0.key"), - enclaveEncryptorType); - } - }, - BOB { - @Override - public PrivacyAccount resolve(final EnclaveEncryptorType enclaveEncryptorType) { - return PrivacyAccount.create( - resolveResource("key1"), - enclaveEncryptorType.equals(EnclaveEncryptorType.EC) - ? resolveResource("enclave_ec_key_1.pub") - : resolveResource("enclave_key_1.pub"), - enclaveEncryptorType.equals(EnclaveEncryptorType.EC) - ? resolveResource("enclave_ec_key_1.key") - : resolveResource("enclave_key_1.key"), - enclaveEncryptorType); - } - }, - CHARLIE { - @Override - public PrivacyAccount resolve(final EnclaveEncryptorType enclaveEncryptorType) { - return PrivacyAccount.create( - resolveResource("key2"), - enclaveEncryptorType.equals(EnclaveEncryptorType.EC) - ? resolveResource("enclave_ec_key_2.pub") - : resolveResource("enclave_key_2.pub"), - enclaveEncryptorType.equals(EnclaveEncryptorType.EC) - ? resolveResource("enclave_ec_key_2.key") - : resolveResource("enclave_key_2.key"), - enclaveEncryptorType); - } - }, - MULTI_TENANCY { - @Override - public PrivacyAccount resolve(final EnclaveEncryptorType enclaveEncryptorType) { - return PrivacyAccount.create( - resolveResource("key"), - new URL[] { - enclaveEncryptorType.equals(EnclaveEncryptorType.EC) - ? resolveResource("enclave_ec_key_0.pub") - : resolveResource("enclave_key_0.pub"), - enclaveEncryptorType.equals(EnclaveEncryptorType.EC) - ? resolveResource("enclave_ec_key_1.pub") - : resolveResource("enclave_key_1.pub"), - enclaveEncryptorType.equals(EnclaveEncryptorType.EC) - ? resolveResource("enclave_ec_key_2.pub") - : resolveResource("enclave_key_2.pub") - }, - new URL[] { - enclaveEncryptorType.equals(EnclaveEncryptorType.EC) - ? resolveResource("enclave_ec_key_0.key") - : resolveResource("enclave_key_0.key"), - enclaveEncryptorType.equals(EnclaveEncryptorType.EC) - ? resolveResource("enclave_ec_key_1.key") - : resolveResource("enclave_key_1.key"), - enclaveEncryptorType.equals(EnclaveEncryptorType.EC) - ? resolveResource("enclave_ec_key_2.key") - : resolveResource("enclave_key_2.key") - }, - enclaveEncryptorType); - } - }; - - public abstract PrivacyAccount resolve(final EnclaveEncryptorType enclaveEncryptorType); - - URL resolveResource(final String resource) { - return PrivacyAccountResolver.class.getClassLoader().getResource(resource); - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/ExpectExistingPrivateTransactionReceipt.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/ExpectExistingPrivateTransactionReceipt.java deleted file mode 100644 index 7d1c97c13d7..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/ExpectExistingPrivateTransactionReceipt.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.privacy.condition; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.hyperledger.besu.tests.acceptance.dsl.privacy.PrivacyNode; -import org.hyperledger.besu.tests.acceptance.dsl.privacy.transaction.PrivacyTransactions; - -import org.web3j.protocol.besu.response.privacy.PrivateTransactionReceipt; - -public class ExpectExistingPrivateTransactionReceipt implements PrivateCondition { - private final PrivacyTransactions transactions; - private final String transactionHash; - - public ExpectExistingPrivateTransactionReceipt( - final PrivacyTransactions transactions, final String transactionHash) { - - this.transactions = transactions; - this.transactionHash = transactionHash; - } - - @Override - public void verify(final PrivacyNode node) { - final PrivateTransactionReceipt privateTransactionReceipt = - node.execute(transactions.getPrivateTransactionReceipt(transactionHash)); - assertThat(privateTransactionReceipt).isNotNull(); - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/ExpectInternalErrorPrivateTransactionReceipt.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/ExpectInternalErrorPrivateTransactionReceipt.java deleted file mode 100644 index 450be72d427..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/ExpectInternalErrorPrivateTransactionReceipt.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.privacy.condition; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.hyperledger.besu.tests.acceptance.dsl.privacy.PrivacyNode; -import org.hyperledger.besu.tests.acceptance.dsl.privacy.transaction.PrivacyTransactions; - -public class ExpectInternalErrorPrivateTransactionReceipt implements PrivateCondition { - private final PrivacyTransactions transactions; - private final String transactionHash; - - public ExpectInternalErrorPrivateTransactionReceipt( - final PrivacyTransactions transactions, final String transactionHash) { - this.transactions = transactions; - this.transactionHash = transactionHash; - } - - @Override - public void verify(final PrivacyNode node) { - try { - node.execute(transactions.getPrivateTransactionReceipt(transactionHash)); - } catch (final RuntimeException e) { - assertThat(e.getMessage()).contains("Internal error"); - } - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/ExpectNoPrivateTransactionReceipt.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/ExpectNoPrivateTransactionReceipt.java deleted file mode 100644 index d14d0dde736..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/ExpectNoPrivateTransactionReceipt.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.privacy.condition; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.catchThrowable; - -import org.hyperledger.besu.tests.acceptance.dsl.privacy.PrivacyNode; -import org.hyperledger.besu.tests.acceptance.dsl.privacy.transaction.PrivacyTransactions; - -public class ExpectNoPrivateTransactionReceipt implements PrivateCondition { - private final PrivacyTransactions transactions; - private final String transactionHash; - - public ExpectNoPrivateTransactionReceipt( - final PrivacyTransactions transactions, final String transactionHash) { - this.transactions = transactions; - this.transactionHash = transactionHash; - } - - @Override - public void verify(final PrivacyNode node) { - final Throwable t = - catchThrowable( - () -> node.execute(transactions.getPrivateTransactionReceipt(transactionHash))); - - assertThat(t).hasMessageContaining("TransactionException"); - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/ExpectValidContractCode.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/ExpectValidContractCode.java deleted file mode 100644 index 574ace120da..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/ExpectValidContractCode.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.privacy.condition; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.io.IOException; - -import org.web3j.tx.Contract; - -public class ExpectValidContractCode implements PrivateContractCondition { - @Override - public void verify(final Contract contract) throws IOException { - assertThat(contract).isNotNull(); - assertThat(contract.isValid()).isEqualTo(true); - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/ExpectValidFlexiblePrivacyGroupCreated.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/ExpectValidFlexiblePrivacyGroupCreated.java deleted file mode 100644 index ce9c93d23d6..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/ExpectValidFlexiblePrivacyGroupCreated.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.privacy.condition; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.hyperledger.besu.tests.acceptance.dsl.privacy.PrivacyNode; -import org.hyperledger.besu.tests.acceptance.dsl.privacy.transaction.PrivacyTransactions; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.PrivacyRequestFactory; - -import java.util.List; -import java.util.concurrent.TimeUnit; - -import org.awaitility.Awaitility; -import org.web3j.utils.Base64String; - -public class ExpectValidFlexiblePrivacyGroupCreated implements PrivateCondition { - - private final PrivacyTransactions transactions; - private final PrivacyRequestFactory.FlexiblePrivacyGroup expected; - - public ExpectValidFlexiblePrivacyGroupCreated( - final PrivacyTransactions transactions, - final PrivacyRequestFactory.FlexiblePrivacyGroup expected) { - this.transactions = transactions; - this.expected = expected; - } - - @Override - public void verify(final PrivacyNode node) { - Awaitility.waitAtMost(20, TimeUnit.SECONDS) - .untilAsserted( - () -> { - final List groups = - node.execute( - transactions.findFlexiblePrivacyGroup( - Base64String.unwrapList(expected.getMembers()))); - assertThat(groups).contains(expected); - }); - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/ExpectValidPrivacyGroupCreated.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/ExpectValidPrivacyGroupCreated.java deleted file mode 100644 index 813050cc588..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/ExpectValidPrivacyGroupCreated.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.privacy.condition; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.hyperledger.besu.tests.acceptance.dsl.privacy.PrivacyNode; -import org.hyperledger.besu.tests.acceptance.dsl.privacy.transaction.PrivacyTransactions; - -import java.util.List; - -import org.awaitility.Awaitility; -import org.web3j.protocol.besu.response.privacy.PrivacyGroup; -import org.web3j.utils.Base64String; - -public class ExpectValidPrivacyGroupCreated implements PrivateCondition { - - private final PrivacyTransactions transactions; - private final PrivacyGroup expected; - - public ExpectValidPrivacyGroupCreated( - final PrivacyTransactions transactions, final PrivacyGroup expected) { - this.transactions = transactions; - this.expected = expected; - } - - @Override - public void verify(final PrivacyNode node) { - Awaitility.await() - .untilAsserted( - () -> { - final List groups = - node.execute( - transactions.findPrivacyGroup( - Base64String.unwrapList(expected.getMembers()))); - assertThat(groups).contains(expected); - }); - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/ExpectValidPrivateContractDeployedReceipt.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/ExpectValidPrivateContractDeployedReceipt.java deleted file mode 100644 index 687d6360c2d..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/ExpectValidPrivateContractDeployedReceipt.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.privacy.condition; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.Optional; - -import org.web3j.protocol.core.methods.response.TransactionReceipt; -import org.web3j.tx.Contract; - -public class ExpectValidPrivateContractDeployedReceipt implements PrivateContractCondition { - - private final String contractAddress; - private final String senderAddress; - - public ExpectValidPrivateContractDeployedReceipt( - final String contractAddress, final String senderAddress) { - this.contractAddress = contractAddress; - this.senderAddress = senderAddress; - } - - @Override - public void verify(final Contract contract) { - - assertThat(contract).isNotNull(); - final Optional receipt = contract.getTransactionReceipt(); - - // We're expecting a receipt - assertThat(receipt).isNotNull(); - assertThat(receipt.isPresent()).isTrue(); - final TransactionReceipt transactionReceipt = receipt.get(); - - assertThat(transactionReceipt.isStatusOK()).isTrue(); - - // Contract transaction has no 'to' address or contract address - assertThat(transactionReceipt.getTo()).isNull(); - - // Address generation is deterministic, based on the sender address and the transaction nonce - assertThat(transactionReceipt.getContractAddress()).isEqualTo(contractAddress); - - // Address for the account that signed (and paid) for the contract deployment transaction - assertThat(transactionReceipt.getFrom()).isEqualTo(senderAddress); - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/ExpectValidPrivateTransactionReceipt.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/ExpectValidPrivateTransactionReceipt.java deleted file mode 100644 index ff8e0c2c5f4..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/ExpectValidPrivateTransactionReceipt.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.privacy.condition; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.hyperledger.besu.tests.acceptance.dsl.privacy.PrivacyNode; -import org.hyperledger.besu.tests.acceptance.dsl.privacy.transaction.PrivacyTransactions; - -import org.web3j.protocol.besu.response.privacy.PrivateTransactionReceipt; - -public class ExpectValidPrivateTransactionReceipt implements PrivateCondition { - private final PrivacyTransactions transactions; - private final String transactionHash; - private final PrivateTransactionReceipt expectedReceipt; - private final boolean ignoreOutput; - - public ExpectValidPrivateTransactionReceipt( - final PrivacyTransactions transactions, - final String transactionHash, - final PrivateTransactionReceipt expectedReceipt) { - this(transactions, transactionHash, expectedReceipt, false); - } - - public ExpectValidPrivateTransactionReceipt( - final PrivacyTransactions transactions, - final String transactionHash, - final PrivateTransactionReceipt expectedReceipt, - final boolean ignoreOutput) { - - this.transactions = transactions; - this.transactionHash = transactionHash; - this.expectedReceipt = expectedReceipt; - this.ignoreOutput = ignoreOutput; - } - - @Override - public void verify(final PrivacyNode node) { - final PrivateTransactionReceipt actualReceipt = - node.execute(transactions.getPrivateTransactionReceipt(transactionHash)); - if (ignoreOutput) { - // output can be ignored if it is checked separately - assertThat(actualReceipt) - .usingRecursiveComparison() - .ignoringFields( - "commitmentHash", - "logs", - "blockHash", - "blockNumber", - "logsBloom", - "transactionIndex", - "output") - // TODO: The fields blockHash, blockNumber, logsBloom, transactionIndex and output have to - // be ignored as - // the class org.web3j.protocol.besu.response.privacy.PrivateTransactionReceipt does not - // contain - // these fields. Once web3j has been updated these ignores can be removed. - .isEqualTo(expectedReceipt); - } else { - assertThat(actualReceipt) - .usingRecursiveComparison() - .ignoringFields( - "commitmentHash", "logs", "blockHash", "blockNumber", "logsBloom", "transactionIndex") - // TODO: The fields blockHash, blockNumber, logsBloom and transactionIndex have to be - // ignored as the class - // org.web3j.protocol.besu.response.privacy.PrivateTransactionReceipt does not contain - // these fields. Once web3j has been updated these ignores can be removed. - .isEqualTo(expectedReceipt); - } - assertThat(actualReceipt.getLogs().size()).isEqualTo(expectedReceipt.getLogs().size()); - - for (int i = 0; i < expectedReceipt.getLogs().size(); i++) { - assertThat(actualReceipt.getLogs().get(i)) - .usingRecursiveComparison() - .ignoringFields("blockHash", "blockNumber") - .isEqualTo(expectedReceipt.getLogs().get(i)); - } - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/PrivGetTransactionReceiptTransaction.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/PrivGetTransactionReceiptTransaction.java deleted file mode 100644 index b5922b25b0f..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/PrivGetTransactionReceiptTransaction.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.privacy.condition; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.hyperledger.besu.tests.acceptance.dsl.transaction.NodeRequests; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction; - -import java.io.IOException; - -import org.web3j.protocol.besu.Besu; -import org.web3j.protocol.besu.response.privacy.PrivateTransactionReceipt; -import org.web3j.protocol.exceptions.TransactionException; -import org.web3j.tx.response.PollingPrivateTransactionReceiptProcessor; - -public class PrivGetTransactionReceiptTransaction - implements Transaction { - - private final String transactionHash; - - public PrivGetTransactionReceiptTransaction(final String transactionHash) { - this.transactionHash = transactionHash; - } - - @Override - public PrivateTransactionReceipt execute(final NodeRequests node) { - final Besu besu = node.privacy().getBesuClient(); - final PollingPrivateTransactionReceiptProcessor receiptProcessor = - new PollingPrivateTransactionReceiptProcessor(besu, 1000, 15); - try { - final PrivateTransactionReceipt result = - receiptProcessor.waitForTransactionReceipt(transactionHash); - assertThat(result).isNotNull(); - return result; - } catch (final IOException | TransactionException e) { - throw new RuntimeException(e); - } - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/PrivateCondition.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/PrivateCondition.java deleted file mode 100644 index 873f015a499..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/PrivateCondition.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.privacy.condition; - -import org.hyperledger.besu.tests.acceptance.dsl.privacy.PrivacyNode; - -public interface PrivateCondition { - void verify(PrivacyNode node); -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/PrivateContractCondition.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/PrivateContractCondition.java deleted file mode 100644 index 7969e2d3576..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/PrivateContractCondition.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.privacy.condition; - -import java.io.IOException; - -import org.web3j.tx.Contract; - -public interface PrivateContractCondition { - void verify(final Contract contract) throws IOException; -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/PrivateContractVerifier.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/PrivateContractVerifier.java deleted file mode 100644 index de9f36d08d7..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/PrivateContractVerifier.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.privacy.condition; - -public class PrivateContractVerifier { - - public PrivateContractVerifier() {} - - public ExpectValidPrivateContractDeployedReceipt validPrivateContractDeployed( - final String contractAddress, final String senderAddress) { - return new ExpectValidPrivateContractDeployedReceipt(contractAddress, senderAddress); - } - - public ExpectValidContractCode validContractCodeProvided() { - return new ExpectValidContractCode(); - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/PrivateTransactionVerifier.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/PrivateTransactionVerifier.java deleted file mode 100644 index cfd83b65821..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/PrivateTransactionVerifier.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.privacy.condition; - -import org.hyperledger.besu.tests.acceptance.dsl.privacy.PrivacyNode; -import org.hyperledger.besu.tests.acceptance.dsl.privacy.transaction.PrivacyTransactions; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.PrivacyRequestFactory.FlexiblePrivacyGroup; - -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; - -import org.web3j.protocol.besu.response.privacy.PrivacyGroup; -import org.web3j.protocol.besu.response.privacy.PrivateTransactionReceipt; -import org.web3j.utils.Base64String; - -public class PrivateTransactionVerifier { - - private final PrivacyTransactions transactions; - - public PrivateTransactionVerifier(final PrivacyTransactions transactions) { - this.transactions = transactions; - } - - public ExpectValidPrivateTransactionReceipt validPrivateTransactionReceipt( - final String transactionHash, final PrivateTransactionReceipt receipt) { - return new ExpectValidPrivateTransactionReceipt(transactions, transactionHash, receipt); - } - - public ExpectValidPrivateTransactionReceipt validPrivateTransactionReceipt( - final String transactionHash, - final PrivateTransactionReceipt receipt, - final boolean ignoreOutput) { - return new ExpectValidPrivateTransactionReceipt( - transactions, transactionHash, receipt, ignoreOutput); - } - - public ExpectExistingPrivateTransactionReceipt existingPrivateTransactionReceipt( - final String transactionHash) { - return new ExpectExistingPrivateTransactionReceipt(transactions, transactionHash); - } - - public ExpectNoPrivateTransactionReceipt noPrivateTransactionReceipt( - final String transactionHash) { - return new ExpectNoPrivateTransactionReceipt(transactions, transactionHash); - } - - public ExpectValidPrivacyGroupCreated validPrivacyGroupCreated(final PrivacyGroup expected) { - return new ExpectValidPrivacyGroupCreated(transactions, expected); - } - - public ExpectValidFlexiblePrivacyGroupCreated flexiblePrivacyGroupExists( - final String privacyGroupId, final PrivacyNode... members) { - - final List membersEnclaveKeys = - Arrays.stream(members) - .map(PrivacyNode::getEnclaveKey) - .map(Base64String::wrap) - .collect(Collectors.toList()); - return flexiblePrivacyGroupExists(privacyGroupId, membersEnclaveKeys); - } - - public ExpectValidFlexiblePrivacyGroupCreated flexiblePrivacyGroupExists( - final String privacyGroupId, final List membersEnclaveKeys) { - - final FlexiblePrivacyGroup expectedGroup = - new FlexiblePrivacyGroup(privacyGroupId, membersEnclaveKeys); - - return new ExpectValidFlexiblePrivacyGroupCreated(transactions, expectedGroup); - } - - public ExpectInternalErrorPrivateTransactionReceipt internalErrorPrivateTransactionReceipt( - final String transactionHash) { - return new ExpectInternalErrorPrivateTransactionReceipt(transactions, transactionHash); - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/contract/CallOnchainPermissioningPrivateSmartContractFunction.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/contract/CallOnchainPermissioningPrivateSmartContractFunction.java deleted file mode 100644 index 0820d65d1d5..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/contract/CallOnchainPermissioningPrivateSmartContractFunction.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.privacy.contract; - -import org.hyperledger.besu.tests.acceptance.dsl.transaction.NodeRequests; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction; - -import java.io.IOException; -import java.math.BigInteger; - -import org.web3j.crypto.Credentials; -import org.web3j.tx.PrivateTransactionManager; -import org.web3j.tx.gas.BesuPrivacyGasProvider; -import org.web3j.utils.Base64String; -import org.web3j.utils.Restriction; - -public class CallOnchainPermissioningPrivateSmartContractFunction implements Transaction { - - private static final BesuPrivacyGasProvider GAS_PROVIDER = - new BesuPrivacyGasProvider(BigInteger.valueOf(1000)); - private final String contractAddress; - private final String encodedFunction; - private final Credentials senderCredentials; - private final Base64String privateFrom; - private final Base64String privacyGroupId; - - public CallOnchainPermissioningPrivateSmartContractFunction( - final String contractAddress, - final String encodedFunction, - final String transactionSigningKey, - final String privateFrom, - final String privacyGroupId) { - - this.contractAddress = contractAddress; - this.encodedFunction = encodedFunction; - this.senderCredentials = Credentials.create(transactionSigningKey); - this.privateFrom = Base64String.wrap(privateFrom); - this.privacyGroupId = Base64String.wrap(privacyGroupId); - } - - @Override - public String execute(final NodeRequests node) { - final PrivateTransactionManager privateTransactionManager = - node.privacy() - .getTransactionManager( - senderCredentials, privateFrom, privacyGroupId, Restriction.RESTRICTED); - - try { - return privateTransactionManager - .sendTransaction( - GAS_PROVIDER.getGasPrice(), - GAS_PROVIDER.getGasLimit(), - contractAddress, - encodedFunction, - null) - .getTransactionHash(); - } catch (final IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/contract/CallPrivateSmartContractFunction.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/contract/CallPrivateSmartContractFunction.java deleted file mode 100644 index d3ec7989e5e..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/contract/CallPrivateSmartContractFunction.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.privacy.contract; - -import org.hyperledger.besu.tests.acceptance.dsl.transaction.NodeRequests; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction; - -import java.io.IOException; -import java.math.BigInteger; -import java.util.List; - -import org.web3j.crypto.Credentials; -import org.web3j.tx.PrivateTransactionManager; -import org.web3j.tx.gas.BesuPrivacyGasProvider; -import org.web3j.utils.Base64String; -import org.web3j.utils.Restriction; - -public class CallPrivateSmartContractFunction implements Transaction { - - private static final BesuPrivacyGasProvider GAS_PROVIDER = - new BesuPrivacyGasProvider(BigInteger.valueOf(1000)); - private final String contractAddress; - private final String encodedFunction; - private final Credentials senderCredentials; - private final Restriction restriction; - private final Base64String privateFrom; - private final List privateFor; - private final Base64String privacyGroupId; - - public CallPrivateSmartContractFunction( - final String contractAddress, - final String encodedFunction, - final String transactionSigningKey, - final Restriction restriction, - final String privateFrom, - final List privateFor) { - this( - contractAddress, - encodedFunction, - transactionSigningKey, - restriction, - privateFrom, - privateFor, - null); - } - - public CallPrivateSmartContractFunction( - final String contractAddress, - final String encodedFunction, - final String transactionSigningKey, - final Restriction restriction, - final String privateFrom, - final String privacyGroupId) { - this( - contractAddress, - encodedFunction, - transactionSigningKey, - restriction, - privateFrom, - null, - privacyGroupId); - } - - private CallPrivateSmartContractFunction( - final String contractAddress, - final String encodedFunction, - final String transactionSigningKey, - final Restriction restriction, - final String privateFrom, - final List privateFor, - final String privacyGroupId) { - - this.contractAddress = contractAddress; - this.encodedFunction = encodedFunction; - this.senderCredentials = Credentials.create(transactionSigningKey); - this.restriction = restriction; - this.privateFrom = Base64String.wrap(privateFrom); - this.privateFor = privateFor != null ? Base64String.wrapList(privateFor) : null; - this.privacyGroupId = privacyGroupId != null ? Base64String.wrap(privacyGroupId) : null; - } - - @Override - public String execute(final NodeRequests node) { - final PrivateTransactionManager privateTransactionManager; - - if (privateFor != null) { - privateTransactionManager = - node.privacy() - .getTransactionManager(senderCredentials, privateFrom, privateFor, restriction); - } else { - privateTransactionManager = - node.privacy() - .getTransactionManager(senderCredentials, privateFrom, privacyGroupId, restriction); - } - - try { - return privateTransactionManager - .sendTransaction( - GAS_PROVIDER.getGasPrice(), - GAS_PROVIDER.getGasLimit(), - contractAddress, - encodedFunction, - null) - .getTransactionHash(); - } catch (final IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/contract/DeployPrivateSmartContractTransaction.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/contract/DeployPrivateSmartContractTransaction.java deleted file mode 100644 index ed7ca9cd9af..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/contract/DeployPrivateSmartContractTransaction.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.privacy.contract; - -import org.hyperledger.besu.tests.acceptance.dsl.transaction.NodeRequests; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction; - -import java.lang.reflect.Method; -import java.math.BigInteger; -import java.util.List; - -import org.web3j.crypto.Credentials; -import org.web3j.protocol.Web3j; -import org.web3j.protocol.core.RemoteCall; -import org.web3j.tx.Contract; -import org.web3j.tx.PrivateTransactionManager; -import org.web3j.tx.TransactionManager; -import org.web3j.tx.gas.BesuPrivacyGasProvider; -import org.web3j.tx.gas.ContractGasProvider; -import org.web3j.utils.Base64String; -import org.web3j.utils.Restriction; - -public class DeployPrivateSmartContractTransaction implements Transaction { - - private static final BesuPrivacyGasProvider GAS_PROVIDER = - new BesuPrivacyGasProvider(BigInteger.valueOf(1000)); - private static final Object METHOD_IS_STATIC = null; - - private final Class clazz; - private final Credentials senderCredentials; - private final Base64String privateFrom; - private final List privateFor; - - public DeployPrivateSmartContractTransaction( - final Class clazz, - final String transactionSigningKey, - final String privateFrom, - final List privateFor) { - this.clazz = clazz; - this.senderCredentials = Credentials.create(transactionSigningKey); - this.privateFrom = Base64String.wrap(privateFrom); - this.privateFor = Base64String.wrapList(privateFor); - } - - @Override - public T execute(final NodeRequests node) { - - final PrivateTransactionManager privateTransactionManager = - node.privacy() - .getTransactionManager( - senderCredentials, privateFrom, privateFor, Restriction.RESTRICTED); - - try { - final Method method = - clazz.getMethod( - "deploy", Web3j.class, TransactionManager.class, ContractGasProvider.class); - - final Object invoked = - method.invoke( - METHOD_IS_STATIC, - node.privacy().getBesuClient(), - privateTransactionManager, - GAS_PROVIDER); - - return cast(invoked).send(); - } catch (final Exception e) { - throw new RuntimeException(e); - } - } - - @SuppressWarnings("unchecked") - private RemoteCall cast(final Object invokedMethod) { - return (RemoteCall) invokedMethod; - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/contract/DeployPrivateSmartContractWithPrivacyGroupIdTransaction.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/contract/DeployPrivateSmartContractWithPrivacyGroupIdTransaction.java deleted file mode 100644 index c5d0116431a..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/contract/DeployPrivateSmartContractWithPrivacyGroupIdTransaction.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.privacy.contract; - -import org.hyperledger.besu.tests.acceptance.dsl.transaction.NodeRequests; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction; - -import java.lang.reflect.Method; -import java.math.BigInteger; - -import org.web3j.crypto.Credentials; -import org.web3j.protocol.Web3j; -import org.web3j.protocol.core.RemoteCall; -import org.web3j.tx.Contract; -import org.web3j.tx.PrivateTransactionManager; -import org.web3j.tx.TransactionManager; -import org.web3j.tx.gas.BesuPrivacyGasProvider; -import org.web3j.tx.gas.ContractGasProvider; -import org.web3j.utils.Base64String; -import org.web3j.utils.Restriction; - -public class DeployPrivateSmartContractWithPrivacyGroupIdTransaction - implements Transaction { - - private static final BesuPrivacyGasProvider GAS_PROVIDER = - new BesuPrivacyGasProvider(BigInteger.valueOf(1000)); - private static final Object METHOD_IS_STATIC = null; - - private final Class clazz; - private final Credentials senderCredentials; - private final Restriction restriction; - private final Base64String privateFrom; - private final Base64String privacyGroupId; - - public DeployPrivateSmartContractWithPrivacyGroupIdTransaction( - final Class clazz, - final String transactionSigningKey, - final Restriction restriction, - final String privateFrom, - final String privacyGroupId) { - this.clazz = clazz; - this.senderCredentials = Credentials.create(transactionSigningKey); - this.restriction = restriction; - this.privateFrom = Base64String.wrap(privateFrom); - this.privacyGroupId = Base64String.wrap(privacyGroupId); - } - - @Override - public T execute(final NodeRequests node) { - - final PrivateTransactionManager privateTransactionManager = - node.privacy() - .getTransactionManager(senderCredentials, privateFrom, privacyGroupId, restriction); - - try { - final Method method = - clazz.getMethod( - "deploy", Web3j.class, TransactionManager.class, ContractGasProvider.class); - - final Object invoked = - method.invoke( - METHOD_IS_STATIC, - node.privacy().getBesuClient(), - privateTransactionManager, - GAS_PROVIDER); - - return cast(invoked).send(); - } catch (final Exception e) { - throw new RuntimeException(e); - } - } - - @SuppressWarnings("unchecked") - private RemoteCall cast(final Object invokedMethod) { - return (RemoteCall) invokedMethod; - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/contract/LoadPrivateSmartContractTransaction.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/contract/LoadPrivateSmartContractTransaction.java deleted file mode 100644 index aac5f293f9b..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/contract/LoadPrivateSmartContractTransaction.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.privacy.contract; - -import org.hyperledger.besu.tests.acceptance.dsl.transaction.NodeRequests; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction; - -import java.lang.reflect.Method; -import java.math.BigInteger; -import java.util.List; - -import org.web3j.crypto.Credentials; -import org.web3j.protocol.Web3j; -import org.web3j.tx.Contract; -import org.web3j.tx.PrivateTransactionManager; -import org.web3j.tx.TransactionManager; -import org.web3j.tx.gas.BesuPrivacyGasProvider; -import org.web3j.tx.gas.ContractGasProvider; -import org.web3j.utils.Base64String; -import org.web3j.utils.Restriction; - -public class LoadPrivateSmartContractTransaction implements Transaction { - private static final BesuPrivacyGasProvider GAS_PROVIDER = - new BesuPrivacyGasProvider(BigInteger.valueOf(1000)); - private static final Object METHOD_IS_STATIC = null; - - private final Class clazz; - private final Credentials senderCredentials; - private final Base64String privateFrom; - private final List privateFor; - private final String contractAddress; - - public LoadPrivateSmartContractTransaction( - final String contractAddress, - final Class clazz, - final String transactionSigningKey, - final String privateFrom, - final List privateFor) { - - this.contractAddress = contractAddress; - this.clazz = clazz; - this.senderCredentials = Credentials.create(transactionSigningKey); - this.privateFrom = Base64String.wrap(privateFrom); - this.privateFor = Base64String.wrapList(privateFor); - } - - @SuppressWarnings("unchecked") - @Override - public T execute(final NodeRequests node) { - final PrivateTransactionManager privateTransactionManager = - node.privacy() - .getTransactionManager( - senderCredentials, privateFrom, privateFor, Restriction.RESTRICTED); - - try { - final Method method = - clazz.getMethod( - "load", - String.class, - Web3j.class, - TransactionManager.class, - ContractGasProvider.class); - - return (T) - method.invoke( - METHOD_IS_STATIC, - contractAddress, - node.privacy().getBesuClient(), - privateTransactionManager, - GAS_PROVIDER); - } catch (final Exception e) { - throw new RuntimeException(e); - } - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/contract/LoadPrivateSmartContractTransactionWithPrivacyGroupId.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/contract/LoadPrivateSmartContractTransactionWithPrivacyGroupId.java deleted file mode 100644 index 11a5045752c..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/contract/LoadPrivateSmartContractTransactionWithPrivacyGroupId.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.privacy.contract; - -import org.hyperledger.besu.tests.acceptance.dsl.transaction.NodeRequests; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction; - -import java.lang.reflect.Method; -import java.math.BigInteger; - -import org.web3j.crypto.Credentials; -import org.web3j.protocol.Web3j; -import org.web3j.tx.Contract; -import org.web3j.tx.PrivateTransactionManager; -import org.web3j.tx.TransactionManager; -import org.web3j.tx.gas.BesuPrivacyGasProvider; -import org.web3j.tx.gas.ContractGasProvider; -import org.web3j.utils.Base64String; -import org.web3j.utils.Restriction; - -public class LoadPrivateSmartContractTransactionWithPrivacyGroupId - implements Transaction { - - private static final BesuPrivacyGasProvider GAS_PROVIDER = - new BesuPrivacyGasProvider(BigInteger.valueOf(1000)); - private static final Object METHOD_IS_STATIC = null; - - private final Class clazz; - private final Credentials senderCredentials; - private final Base64String privateFrom; - private final Base64String privacyGroupId; - private final String contractAddress; - - public LoadPrivateSmartContractTransactionWithPrivacyGroupId( - final String contractAddress, - final Class clazz, - final String transactionSigningKey, - final String privateFrom, - final String privacyGroupId) { - - this.contractAddress = contractAddress; - this.clazz = clazz; - this.senderCredentials = Credentials.create(transactionSigningKey); - this.privateFrom = Base64String.wrap(privateFrom); - this.privacyGroupId = Base64String.wrap(privacyGroupId); - } - - @SuppressWarnings("unchecked") - @Override - public T execute(final NodeRequests node) { - final PrivateTransactionManager privateTransactionManager = - node.privacy() - .getTransactionManager( - senderCredentials, privateFrom, privacyGroupId, Restriction.RESTRICTED); - - try { - final Method method = - clazz.getMethod( - "load", - String.class, - Web3j.class, - TransactionManager.class, - ContractGasProvider.class); - - return (T) - method.invoke( - METHOD_IS_STATIC, - contractAddress, - node.privacy().getBesuClient(), - privateTransactionManager, - GAS_PROVIDER); - } catch (final Exception e) { - throw new RuntimeException(e); - } - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/contract/PrivateContractTransactions.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/contract/PrivateContractTransactions.java deleted file mode 100644 index 97e7e654018..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/contract/PrivateContractTransactions.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.privacy.contract; - -import java.util.Arrays; -import java.util.List; - -import org.web3j.tx.Contract; -import org.web3j.utils.Restriction; - -public class PrivateContractTransactions { - - public - DeployPrivateSmartContractWithPrivacyGroupIdTransaction - createSmartContractWithPrivacyGroupId( - final Class clazz, - final String transactionSigningKey, - final Restriction restriction, - final String privateFrom, - final String privacyGroupId) { - return new DeployPrivateSmartContractWithPrivacyGroupIdTransaction<>( - clazz, transactionSigningKey, restriction, privateFrom, privacyGroupId); - } - - public - DeployPrivateSmartContractWithPrivacyGroupIdTransaction - createSmartContractWithPrivacyGroupId( - final Class clazz, - final String transactionSigningKey, - final String privateFrom, - final String privacyGroupId) { - return new DeployPrivateSmartContractWithPrivacyGroupIdTransaction<>( - clazz, transactionSigningKey, Restriction.RESTRICTED, privateFrom, privacyGroupId); - } - - public DeployPrivateSmartContractTransaction createSmartContract( - final Class clazz, - final String transactionSigningKey, - final String privateFrom, - final String... privateFor) { - return createSmartContract( - clazz, transactionSigningKey, privateFrom, Arrays.asList(privateFor)); - } - - public DeployPrivateSmartContractTransaction createSmartContract( - final Class clazz, - final String transactionSigningKey, - final String privateFrom, - final List privateFor) { - return new DeployPrivateSmartContractTransaction<>( - clazz, transactionSigningKey, privateFrom, privateFor); - } - - public CallPrivateSmartContractFunction callSmartContract( - final String contractAddress, - final String encodedFunction, - final String transactionSigningKey, - final Restriction restriction, - final String privateFrom, - final String... privateFor) { - return callSmartContract( - contractAddress, - encodedFunction, - transactionSigningKey, - restriction, - privateFrom, - Arrays.asList(privateFor)); - } - - public CallPrivateSmartContractFunction callSmartContract( - final String contractAddress, - final String encodedFunction, - final String transactionSigningKey, - final Restriction restriction, - final String privateFrom, - final List privateFor) { - return new CallPrivateSmartContractFunction( - contractAddress, - encodedFunction, - transactionSigningKey, - restriction, - privateFrom, - privateFor); - } - - public CallPrivateSmartContractFunction callSmartContractWithPrivacyGroupId( - final String contractAddress, - final String encodedFunction, - final String transactionSigningKey, - final Restriction restriction, - final String privateFrom, - final String privacyGroupId) { - return new CallPrivateSmartContractFunction( - contractAddress, - encodedFunction, - transactionSigningKey, - restriction, - privateFrom, - privacyGroupId); - } - - public LoadPrivateSmartContractTransaction loadSmartContract( - final String contractAddress, - final Class clazz, - final String transactionSigningKey, - final String privateFrom, - final String... privateFor) { - return loadSmartContract( - contractAddress, clazz, transactionSigningKey, privateFrom, Arrays.asList(privateFor)); - } - - public LoadPrivateSmartContractTransaction loadSmartContract( - final String contractAddress, - final Class clazz, - final String transactionSigningKey, - final String privateFrom, - final List privateFor) { - return new LoadPrivateSmartContractTransaction<>( - contractAddress, clazz, transactionSigningKey, privateFrom, privateFor); - } - - public - LoadPrivateSmartContractTransactionWithPrivacyGroupId loadSmartContractWithPrivacyGroupId( - final String contractAddress, - final Class clazz, - final String transactionSigningKey, - final String privateFrom, - final String privacyGroupId) { - return new LoadPrivateSmartContractTransactionWithPrivacyGroupId<>( - contractAddress, clazz, transactionSigningKey, privateFrom, privacyGroupId); - } - - public CallOnchainPermissioningPrivateSmartContractFunction callOnchainPermissioningSmartContract( - final String contractAddress, - final String encodedFunction, - final String transactionSigningKey, - final String privateFrom, - final String privacyGroupId) { - return new CallOnchainPermissioningPrivateSmartContractFunction( - contractAddress, encodedFunction, transactionSigningKey, privateFrom, privacyGroupId); - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/AddToFlexiblePrivacyGroupTransaction.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/AddToFlexiblePrivacyGroupTransaction.java deleted file mode 100644 index 9c879bc421c..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/AddToFlexiblePrivacyGroupTransaction.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.privacy.transaction; - -import org.hyperledger.besu.tests.acceptance.dsl.privacy.PrivacyNode; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.NodeRequests; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; - -import org.web3j.crypto.Credentials; -import org.web3j.utils.Base64String; - -public class AddToFlexiblePrivacyGroupTransaction implements Transaction { - private final Base64String privacyGroupId; - private final PrivacyNode adder; - private final List addresses; - private final Credentials signer; - - public AddToFlexiblePrivacyGroupTransaction( - final String privacyGroupId, - final PrivacyNode adder, - final Credentials signer, - final PrivacyNode... nodes) { - this.privacyGroupId = Base64String.wrap(privacyGroupId); - this.adder = adder; - this.signer = signer; - this.addresses = - Arrays.stream(nodes) - .map(n -> n.getEnclave().getDefaultPublicKey()) - .collect(Collectors.toList()); - } - - @Override - public String execute(final NodeRequests node) { - try { - return node.privacy().privxAddToPrivacyGroup(privacyGroupId, adder, signer, addresses); - } catch (final IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/CreateFlexiblePrivacyGroupTransaction.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/CreateFlexiblePrivacyGroupTransaction.java deleted file mode 100644 index bf2814a4b15..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/CreateFlexiblePrivacyGroupTransaction.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.privacy.transaction; - -import org.hyperledger.besu.tests.acceptance.dsl.privacy.PrivacyNode; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.NodeRequests; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.PrivacyRequestFactory.PrivxCreatePrivacyGroupResponse; - -import java.io.IOException; -import java.util.List; - -public class CreateFlexiblePrivacyGroupTransaction - implements Transaction { - private final PrivacyNode creator; - private final List addresses; - private final String privateFrom; - - CreateFlexiblePrivacyGroupTransaction( - final PrivacyNode creator, final String privateFrom, final List addresses) { - this.creator = creator; - this.addresses = addresses; - this.privateFrom = privateFrom; - } - - @Override - public PrivxCreatePrivacyGroupResponse execute(final NodeRequests node) { - try { - return node.privacy().privxCreatePrivacyGroup(creator, privateFrom, addresses); - } catch (final IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/FindFlexiblePrivacyGroupTransaction.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/FindFlexiblePrivacyGroupTransaction.java deleted file mode 100644 index 0e8ac95b4f6..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/FindFlexiblePrivacyGroupTransaction.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.privacy.transaction; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.hyperledger.besu.tests.acceptance.dsl.transaction.NodeRequests; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.PrivacyRequestFactory; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.PrivacyRequestFactory.PrivxFindPrivacyGroupResponse; - -import java.io.IOException; -import java.util.List; -import java.util.stream.Collectors; - -import org.web3j.utils.Base64String; - -public class FindFlexiblePrivacyGroupTransaction - implements Transaction> { - private final List nodes; - - public FindFlexiblePrivacyGroupTransaction(final List nodeEnclaveKeys) { - this.nodes = nodeEnclaveKeys.stream().map(Base64String::wrap).collect(Collectors.toList()); - } - - @Override - public List execute(final NodeRequests node) { - try { - PrivxFindPrivacyGroupResponse result = - node.privacy().privxFindFlexiblePrivacyGroup(nodes).send(); - assertThat(result).isNotNull(); - if (result.hasError()) { - throw new RuntimeException(result.getError().getMessage()); - } - return result.getGroups(); - } catch (final IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/FindPrivacyGroupTransaction.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/FindPrivacyGroupTransaction.java deleted file mode 100644 index 0b15b4c0c80..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/FindPrivacyGroupTransaction.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.privacy.transaction; - -import org.hyperledger.besu.tests.acceptance.dsl.transaction.NodeRequests; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction; - -import java.io.IOException; -import java.util.List; -import java.util.stream.Collectors; - -import org.web3j.protocol.besu.Besu; -import org.web3j.protocol.besu.response.privacy.PrivacyGroup; -import org.web3j.utils.Base64String; - -public class FindPrivacyGroupTransaction implements Transaction> { - private final List nodes; - - public FindPrivacyGroupTransaction(final List nodeEnclaveKeys) { - - this.nodes = nodeEnclaveKeys.stream().map(Base64String::wrap).collect(Collectors.toList()); - } - - @Override - public List execute(final NodeRequests node) { - final Besu besu = node.privacy().getBesuClient(); - try { - return besu.privFindPrivacyGroup(nodes).send().getGroups(); - } catch (IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/GetAllPrivateMarkerTransactionHashes.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/GetAllPrivateMarkerTransactionHashes.java deleted file mode 100644 index d0056f50b43..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/GetAllPrivateMarkerTransactionHashes.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.privacy.transaction; - -import static org.hyperledger.besu.ethereum.core.PrivacyParameters.DEFAULT_PRIVACY; - -import org.hyperledger.besu.tests.acceptance.dsl.transaction.NodeRequests; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction; - -import java.io.IOException; -import java.math.BigInteger; -import java.util.ArrayList; -import java.util.List; - -import org.web3j.protocol.besu.Besu; -import org.web3j.protocol.core.DefaultBlockParameter; -import org.web3j.protocol.core.methods.response.EthBlock; - -public class GetAllPrivateMarkerTransactionHashes implements Transaction> { - @Override - public List execute(final NodeRequests node) { - final Besu besu = node.privacy().getBesuClient(); - final List toReturn = new ArrayList<>(); - try { - final long blockchainHeight = besu.ethBlockNumber().send().getBlockNumber().longValueExact(); - for (long i = 0; i <= blockchainHeight; i++) { - besu.ethGetBlockByNumber(DefaultBlockParameter.valueOf(BigInteger.valueOf(i)), true) - .send() - .getBlock() - .getTransactions() - .forEach( - t -> { - if (((EthBlock.TransactionObject) t).getTo().equals(DEFAULT_PRIVACY.toString())) { - toReturn.add(((EthBlock.TransactionObject) t).getHash()); - } - }); - } - } catch (IOException e) { - throw new RuntimeException(e); - } - - return toReturn; - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/LockFlexiblePrivacyGroupTransaction.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/LockFlexiblePrivacyGroupTransaction.java deleted file mode 100644 index 92ed003ad43..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/LockFlexiblePrivacyGroupTransaction.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.privacy.transaction; - -import org.hyperledger.besu.tests.acceptance.dsl.privacy.PrivacyNode; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.NodeRequests; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction; - -import java.io.IOException; - -import org.web3j.crypto.Credentials; -import org.web3j.protocol.exceptions.TransactionException; -import org.web3j.utils.Base64String; - -public class LockFlexiblePrivacyGroupTransaction implements Transaction { - private final Base64String privacyGroupId; - private final PrivacyNode locker; - private final Credentials signer; - - public LockFlexiblePrivacyGroupTransaction( - final String privacyGroupId, final PrivacyNode locker, final Credentials signer) { - this.privacyGroupId = Base64String.wrap(privacyGroupId); - this.locker = locker; - this.signer = signer; - } - - @Override - public String execute(final NodeRequests node) { - try { - return node.privacy().privxLockPrivacyGroup(locker, privacyGroupId, signer); - } catch (final IOException | TransactionException e) { - throw new RuntimeException(e); - } - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/PluginCreateRandomPrivacyGroupIdTransaction.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/PluginCreateRandomPrivacyGroupIdTransaction.java deleted file mode 100644 index 180764449f7..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/PluginCreateRandomPrivacyGroupIdTransaction.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.privacy.transaction; - -import org.hyperledger.besu.crypto.SecureRandomProvider; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.NodeRequests; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction; - -import org.apache.tuweni.bytes.Bytes; - -public class PluginCreateRandomPrivacyGroupIdTransaction implements Transaction { - - @Override - public String execute(final NodeRequests node) { - final byte[] bytes = new byte[32]; - SecureRandomProvider.createSecureRandom().nextBytes(bytes); - return Bytes.wrap(bytes).toBase64String(); - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/PrivDistributeTransactionTransaction.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/PrivDistributeTransactionTransaction.java deleted file mode 100644 index 60f0a746a99..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/PrivDistributeTransactionTransaction.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.privacy.transaction; - -import org.hyperledger.besu.tests.acceptance.dsl.transaction.NodeRequests; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction; - -import java.io.IOException; - -public class PrivDistributeTransactionTransaction implements Transaction { - private final String signedPrivateTransaction; - - public PrivDistributeTransactionTransaction(final String signedPrivateTransaction) { - this.signedPrivateTransaction = signedPrivateTransaction; - } - - @Override - public String execute(final NodeRequests node) { - try { - return node.privacy() - .privDistributeTransaction(signedPrivateTransaction) - .send() - .getTransactionKey(); - } catch (final IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/PrivacyTransactions.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/PrivacyTransactions.java deleted file mode 100644 index d168108c975..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/PrivacyTransactions.java +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.privacy.transaction; - -import org.hyperledger.besu.datatypes.Address; -import org.hyperledger.besu.datatypes.Hash; -import org.hyperledger.besu.ethereum.privacy.PrivacyGroupUtil; -import org.hyperledger.besu.tests.acceptance.dsl.privacy.PrivacyNode; -import org.hyperledger.besu.tests.acceptance.dsl.privacy.condition.PrivGetTransactionReceiptTransaction; -import org.hyperledger.besu.tests.acceptance.dsl.privacy.util.LogFilterJsonParameter; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.EeaSendRawTransactionTransaction; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.PrivCallTransaction; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.PrivDebugGetStateRoot; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.PrivGetCodeTransaction; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.PrivGetLogsTransaction; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.PrivGetTransaction; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.PrivTraceTransaction; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.filter.PrivGetFilterChangesTransaction; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.filter.PrivGetFilterLogsTransaction; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.filter.PrivNewFilterTransaction; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.filter.PrivUninstallFilterTransaction; - -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; - -import org.apache.tuweni.bytes.Bytes; -import org.apache.tuweni.bytes.Bytes32; -import org.web3j.crypto.Credentials; -import org.web3j.tx.Contract; - -public class PrivacyTransactions { - - public PrivGetTransactionReceiptTransaction getPrivateTransactionReceipt( - final String transactionHash) { - return new PrivGetTransactionReceiptTransaction(transactionHash); - } - - public RestrictedCreatePrivacyGroupTransaction createPrivacyGroup( - final String name, final String description, final PrivacyNode... nodes) { - return new RestrictedCreatePrivacyGroupTransaction(name, description, nodes); - } - - public CreateFlexiblePrivacyGroupTransaction createFlexiblePrivacyGroup( - final PrivacyNode creator, - final String privateFrom, - final List addresses, - final String token) { - creator.getBesu().useAuthenticationTokenInHeaderForJsonRpc(token); - return new CreateFlexiblePrivacyGroupTransaction(creator, privateFrom, addresses); - } - - public CreateFlexiblePrivacyGroupTransaction createFlexiblePrivacyGroup( - final PrivacyNode creator, final String privateFrom, final List addresses) { - return new CreateFlexiblePrivacyGroupTransaction(creator, privateFrom, addresses); - } - - public AddToFlexiblePrivacyGroupTransaction addToPrivacyGroup( - final String privacyGroupId, - final PrivacyNode adder, - final Credentials signer, - final PrivacyNode... nodes) { - return new AddToFlexiblePrivacyGroupTransaction(privacyGroupId, adder, signer, nodes); - } - - public LockFlexiblePrivacyGroupTransaction privxLockPrivacyGroupAndCheck( - final String privacyGroupId, final PrivacyNode locker, final Credentials signer) { - return new LockFlexiblePrivacyGroupTransaction(privacyGroupId, locker, signer); - } - - public UnlockFlexiblePrivacyGroupTransaction privxUnlockPrivacyGroupAndCheck( - final String privacyGroupId, final PrivacyNode locker, final Credentials signer) { - return new UnlockFlexiblePrivacyGroupTransaction(privacyGroupId, locker, signer); - } - - public FindPrivacyGroupTransaction findPrivacyGroup(final List nodes) { - return new FindPrivacyGroupTransaction(nodes); - } - - public FindFlexiblePrivacyGroupTransaction findFlexiblePrivacyGroup(final List nodes) { - return new FindFlexiblePrivacyGroupTransaction(nodes); - } - - public PrivDistributeTransactionTransaction privDistributeTransaction( - final String signedPrivateTransaction) { - return new PrivDistributeTransactionTransaction(signedPrivateTransaction); - } - - public PrivCallTransaction privCall( - final String privacyGroupId, final Contract contract, final String encoded) { - return new PrivCallTransaction(privacyGroupId, contract, encoded); - } - - public PrivGetTransaction privGetTransaction(final String transactionHash) { - return new PrivGetTransaction(transactionHash); - } - - public PrivGetCodeTransaction privGetCode( - final String privacyGroupId, final Address contractAddress, final String blockParameter) { - return new PrivGetCodeTransaction(privacyGroupId, contractAddress, blockParameter); - } - - public PrivGetLogsTransaction privGetLogs( - final String privacyGroupId, final LogFilterJsonParameter filterParameter) { - return new PrivGetLogsTransaction(privacyGroupId, filterParameter); - } - - public PrivTraceTransaction privTraceTransaction( - final String privacyGroupId, final Hash transactionHash) { - return new PrivTraceTransaction(privacyGroupId, transactionHash); - } - - public RemoveFromFlexiblePrivacyGroupTransaction removeFromPrivacyGroup( - final String privacyGroupId, - final String remover, - final Credentials signer, - final String memberToRemove) { - return new RemoveFromFlexiblePrivacyGroupTransaction( - privacyGroupId, remover, signer, memberToRemove); - } - - public EeaSendRawTransactionTransaction sendRawTransaction(final String transaction) { - return new EeaSendRawTransactionTransaction(transaction); - } - - public PrivNewFilterTransaction newFilter( - final String privacyGroupId, final LogFilterJsonParameter filterParameter) { - return new PrivNewFilterTransaction(privacyGroupId, filterParameter); - } - - public PrivUninstallFilterTransaction uninstallFilter( - final String privacyGroupId, final String filterId) { - return new PrivUninstallFilterTransaction(privacyGroupId, filterId); - } - - public PrivGetFilterLogsTransaction getFilterLogs( - final String privacyGroupId, final String filterId) { - return new PrivGetFilterLogsTransaction(privacyGroupId, filterId); - } - - public PrivGetFilterChangesTransaction getFilterChanges( - final String privacyGroupId, final String filterId) { - return new PrivGetFilterChangesTransaction(privacyGroupId, filterId); - } - - public PrivDebugGetStateRoot debugGetStateRoot( - final String privacyGroupId, final String blockParam) { - return new PrivDebugGetStateRoot(privacyGroupId, blockParam); - } - - public String getLegacyPrivacyGroupId(final String privateFrom, final String... privateFor) { - - final Bytes32 privacyGroupId = - PrivacyGroupUtil.calculateEeaPrivacyGroupId( - Bytes.fromBase64String(privateFrom), - Arrays.stream(privateFor).map(Bytes::fromBase64String).collect(Collectors.toList())); - - return privacyGroupId.toBase64String(); - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/RemoveFromFlexiblePrivacyGroupTransaction.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/RemoveFromFlexiblePrivacyGroupTransaction.java deleted file mode 100644 index 7f2712c81dc..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/RemoveFromFlexiblePrivacyGroupTransaction.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.privacy.transaction; - -import org.hyperledger.besu.tests.acceptance.dsl.transaction.NodeRequests; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction; - -import java.io.IOException; - -import org.web3j.crypto.Credentials; -import org.web3j.utils.Base64String; - -public class RemoveFromFlexiblePrivacyGroupTransaction implements Transaction { - private final Base64String privacyGroupId; - private final String remover; - private final String toRemove; - private final Credentials signer; - - public RemoveFromFlexiblePrivacyGroupTransaction( - final String privacyGroupId, - final String remover, - final Credentials signer, - final String toRemove) { - this.privacyGroupId = Base64String.wrap(privacyGroupId); - this.remover = remover; - this.signer = signer; - this.toRemove = toRemove; - } - - @Override - public String execute(final NodeRequests node) { - try { - return node.privacy().privxRemoveFromPrivacyGroup(privacyGroupId, remover, signer, toRemove); - } catch (final IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/RestrictedCreatePrivacyGroupTransaction.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/RestrictedCreatePrivacyGroupTransaction.java deleted file mode 100644 index a455076f9fb..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/RestrictedCreatePrivacyGroupTransaction.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.privacy.transaction; - -import org.hyperledger.besu.tests.acceptance.dsl.privacy.PrivacyNode; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.NodeRequests; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; - -import org.web3j.protocol.besu.Besu; -import org.web3j.protocol.besu.response.privacy.PrivCreatePrivacyGroup; -import org.web3j.utils.Base64String; - -public class RestrictedCreatePrivacyGroupTransaction implements Transaction { - private final String name; - private final String description; - private final List addresses; - - public RestrictedCreatePrivacyGroupTransaction( - final String name, final String description, final PrivacyNode... nodes) { - this.name = name; - this.description = description; - this.addresses = - Arrays.stream(nodes) - .map(n -> Base64String.wrap(n.getEnclave().getDefaultPublicKey())) - .collect(Collectors.toList()); - } - - @Override - public String execute(final NodeRequests node) { - final Besu besu = node.privacy().getBesuClient(); - try { - final PrivCreatePrivacyGroup result = - besu.privCreatePrivacyGroup(addresses, name, description).send(); - if (result.hasError()) { - throw new RuntimeException(result.getError().getMessage()); - } else { - return result.getPrivacyGroupId().toString(); - } - } catch (final IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/UnlockFlexiblePrivacyGroupTransaction.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/UnlockFlexiblePrivacyGroupTransaction.java deleted file mode 100644 index 98b0236c32d..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/UnlockFlexiblePrivacyGroupTransaction.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.privacy.transaction; - -import org.hyperledger.besu.tests.acceptance.dsl.privacy.PrivacyNode; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.NodeRequests; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction; - -import java.io.IOException; - -import org.web3j.crypto.Credentials; -import org.web3j.protocol.exceptions.TransactionException; -import org.web3j.utils.Base64String; - -public class UnlockFlexiblePrivacyGroupTransaction implements Transaction { - private final Base64String privacyGroupId; - private final PrivacyNode locker; - private final Credentials signer; - - public UnlockFlexiblePrivacyGroupTransaction( - final String privacyGroupId, final PrivacyNode locker, final Credentials signer) { - this.privacyGroupId = Base64String.wrap(privacyGroupId); - this.locker = locker; - this.signer = signer; - } - - @Override - public String execute(final NodeRequests node) { - try { - return node.privacy().privxUnlockPrivacyGroup(locker, privacyGroupId, signer); - } catch (final IOException | TransactionException e) { - throw new RuntimeException(e); - } - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/util/LogFilterJsonParameter.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/util/LogFilterJsonParameter.java deleted file mode 100644 index 0ef7c51dc00..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/util/LogFilterJsonParameter.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.privacy.util; - -import java.util.List; - -public class LogFilterJsonParameter { - - private final String fromBlock; - private final String toBlock; - private final List addresses; - private final List> topics; - private final String blockhash; - - public LogFilterJsonParameter( - final String fromBlock, - final String toBlock, - final List addresses, - final List> topics, - final String blockhash) { - this.fromBlock = fromBlock; - this.toBlock = toBlock; - this.addresses = addresses; - this.topics = topics; - this.blockhash = blockhash; - } - - public String getFromBlock() { - return fromBlock; - } - - public String getToBlock() { - return toBlock; - } - - public List getAddresses() { - return addresses; - } - - public List> getTopics() { - return topics; - } - - public String getBlockhash() { - return blockhash; - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/NodeRequests.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/NodeRequests.java index 1151100065b..fea5dba3ff0 100644 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/NodeRequests.java +++ b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/NodeRequests.java @@ -21,7 +21,6 @@ import org.hyperledger.besu.tests.acceptance.dsl.transaction.miner.MinerRequestFactory; import org.hyperledger.besu.tests.acceptance.dsl.transaction.net.CustomRequestFactory; import org.hyperledger.besu.tests.acceptance.dsl.transaction.perm.PermissioningJsonRpcRequestFactory; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.PrivacyRequestFactory; import org.hyperledger.besu.tests.acceptance.dsl.transaction.txpool.TxPoolRequestFactory; import java.util.Optional; @@ -37,7 +36,6 @@ public class NodeRequests { private final BftRequestFactory bft; private final PermissioningJsonRpcRequestFactory perm; private final AdminRequestFactory admin; - private final PrivacyRequestFactory privacy; private final CustomRequestFactory custom; private final Optional websocketService; private final LoginRequestFactory login; @@ -51,7 +49,6 @@ public NodeRequests( final BftRequestFactory bft, final PermissioningJsonRpcRequestFactory perm, final AdminRequestFactory admin, - final PrivacyRequestFactory privacy, final CustomRequestFactory custom, final MinerRequestFactory miner, final TxPoolRequestFactory txPool, @@ -63,7 +60,6 @@ public NodeRequests( this.bft = bft; this.perm = perm; this.admin = admin; - this.privacy = privacy; this.custom = custom; this.miner = miner; this.txPool = txPool; @@ -99,10 +95,6 @@ public CustomRequestFactory custom() { return custom; } - public PrivacyRequestFactory privacy() { - return privacy; - } - public LoginRequestFactory login() { return login; } diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/EeaSendRawTransactionTransaction.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/EeaSendRawTransactionTransaction.java deleted file mode 100644 index 5d2786ae8a6..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/EeaSendRawTransactionTransaction.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.hyperledger.besu.datatypes.Hash; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.NodeRequests; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction; - -import java.io.IOException; - -public class EeaSendRawTransactionTransaction implements Transaction { - - final String transaction; - - public EeaSendRawTransactionTransaction(final String transaction) { - this.transaction = transaction; - } - - @Override - public Hash execute(final NodeRequests node) { - try { - final PrivacyRequestFactory.SendRawTransactionResponse result = - node.privacy().eeaSendRawTransaction(transaction).send(); - assertThat(result).isNotNull(); - if (result.hasError()) { - throw new RuntimeException(result.getError().getMessage()); - } - return result.getResult(); - } catch (final IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivCallTransaction.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivCallTransaction.java deleted file mode 100644 index 7520ada4838..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivCallTransaction.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.hyperledger.besu.tests.acceptance.dsl.transaction.NodeRequests; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction; - -import java.io.IOException; - -import org.web3j.protocol.core.methods.response.EthCall; -import org.web3j.tx.Contract; - -public class PrivCallTransaction implements Transaction { - - private final String privacyGroupId; - private final Contract contract; - private final String encoded; - private final String blockNumberLatestPending; - - public PrivCallTransaction( - final String privacyGroupId, final Contract contract, final String encoded) { - this(privacyGroupId, contract, encoded, "latest"); - } - - public PrivCallTransaction( - final String privacyGroupId, - final Contract contract, - final String encoded, - final String blockNumberLatestPending) { - this.privacyGroupId = privacyGroupId; - this.contract = contract; - this.encoded = encoded; - this.blockNumberLatestPending = blockNumberLatestPending; - } - - @Override - public EthCall execute(final NodeRequests node) { - try { - final EthCall response = - node.privacy() - .privCall(privacyGroupId, contract, encoded, blockNumberLatestPending) - .send(); - assertThat(response).as("check response is not null").isNotNull(); - assertThat(response.getResult()).as("check result in response isn't null").isNotNull(); - return response; - } catch (final IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivCreatePrivacyGroupTransaction.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivCreatePrivacyGroupTransaction.java deleted file mode 100644 index eaddb84fc52..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivCreatePrivacyGroupTransaction.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.hyperledger.besu.ethereum.api.jsonrpc.internal.privacy.parameters.CreatePrivacyGroupParameter; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.NodeRequests; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction; - -import java.io.IOException; -import java.util.List; - -public class PrivCreatePrivacyGroupTransaction implements Transaction { - - final CreatePrivacyGroupParameter params; - - public PrivCreatePrivacyGroupTransaction( - final List addresses, final String groupName, final String groupDescription) { - this.params = new CreatePrivacyGroupParameter(addresses, groupName, groupDescription); - } - - @Override - public String execute(final NodeRequests node) { - try { - final PrivacyRequestFactory.CreatePrivacyGroupResponse result = - node.privacy().privCreatePrivacyGroup(params).send(); - assertThat(result).isNotNull(); - return result.getResult(); - } catch (final IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivDebugGetStateRoot.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivDebugGetStateRoot.java deleted file mode 100644 index 59e9dd36a6d..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivDebugGetStateRoot.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.hyperledger.besu.tests.acceptance.dsl.transaction.NodeRequests; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction; - -import java.io.IOException; - -public class PrivDebugGetStateRoot implements Transaction { - - private final String privacyGroupId; - private final String blockParam; - - public PrivDebugGetStateRoot(final String privacyGroupId, final String blockParam) { - this.privacyGroupId = privacyGroupId; - this.blockParam = blockParam; - } - - @Override - public PrivacyRequestFactory.DebugGetStateRoot execute(final NodeRequests node) { - try { - final PrivacyRequestFactory.DebugGetStateRoot response = - node.privacy().privDebugGetStateRoot(privacyGroupId, blockParam).send(); - assertThat(response).as("check response is not null").isNotNull(); - return response; - } catch (final IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivDeletePrivacyGroupTransaction.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivDeletePrivacyGroupTransaction.java deleted file mode 100644 index caf755839d8..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivDeletePrivacyGroupTransaction.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.hyperledger.besu.tests.acceptance.dsl.transaction.NodeRequests; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction; - -import java.io.IOException; - -public class PrivDeletePrivacyGroupTransaction implements Transaction { - - final String transactionHash; - - public PrivDeletePrivacyGroupTransaction(final String transactionHash) { - this.transactionHash = transactionHash; - } - - @Override - public String execute(final NodeRequests node) { - try { - final PrivacyRequestFactory.DeletePrivacyGroupResponse result = - node.privacy().privDeletePrivacyGroup(transactionHash).send(); - assertThat(result).isNotNull(); - if (result.hasError()) { - throw new RuntimeException(result.getError().getMessage()); - } - return result.getResult(); - } catch (final IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivDistributeRawTransactionTransaction.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivDistributeRawTransactionTransaction.java deleted file mode 100644 index 8a9c70f8736..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivDistributeRawTransactionTransaction.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.hyperledger.besu.tests.acceptance.dsl.transaction.NodeRequests; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction; - -import java.io.IOException; - -public class PrivDistributeRawTransactionTransaction implements Transaction { - - final String transaction; - - public PrivDistributeRawTransactionTransaction(final String transaction) { - this.transaction = transaction; - } - - @Override - public String execute(final NodeRequests node) { - try { - final PrivacyRequestFactory.PrivDistributeTransactionResponse result = - node.privacy().privDistributeTransaction(transaction).send(); - assertThat(result).isNotNull(); - if (result.hasError()) { - throw new RuntimeException(result.getError().getMessage()); - } - return result.getTransactionKey(); - } catch (final IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivFindPrivacyGroupTransaction.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivFindPrivacyGroupTransaction.java deleted file mode 100644 index 47fad9455c6..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivFindPrivacyGroupTransaction.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.hyperledger.besu.enclave.types.PrivacyGroup; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.NodeRequests; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction; - -import java.io.IOException; - -public class PrivFindPrivacyGroupTransaction implements Transaction { - - final String[] groupMembers; - - public PrivFindPrivacyGroupTransaction(final String[] groupMembers) { - this.groupMembers = groupMembers; - } - - @Override - public PrivacyGroup[] execute(final NodeRequests node) { - try { - final PrivacyRequestFactory.FindPrivacyGroupResponse result = - node.privacy().privFindPrivacyGroup(groupMembers).send(); - assertThat(result).isNotNull(); - if (result.hasError()) { - throw new RuntimeException(result.getError().getMessage()); - } - return result.getResult(); - } catch (final IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivGetCodeTransaction.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivGetCodeTransaction.java deleted file mode 100644 index dbe708f53b5..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivGetCodeTransaction.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.hyperledger.besu.datatypes.Address; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.NodeRequests; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction; - -import java.io.IOException; - -import org.apache.tuweni.bytes.Bytes; - -public class PrivGetCodeTransaction implements Transaction { - - private final String privacyGroupId; - private final Address contractAddress; - private final String blockParameter; - - public PrivGetCodeTransaction( - final String privacyGroupId, final Address contractAddress, final String blockParameter) { - this.privacyGroupId = privacyGroupId; - this.contractAddress = contractAddress; - this.blockParameter = blockParameter; - } - - @Override - public Bytes execute(final NodeRequests node) { - try { - final PrivacyRequestFactory.GetCodeResponse response = - node.privacy() - .privGetCode(privacyGroupId, contractAddress.toHexString(), blockParameter) - .send(); - assertThat(response).as("check response is not null").isNotNull(); - assertThat(response.getResult()).as("check code in response isn't null").isNotNull(); - return Bytes.fromHexString(response.getResult()); - } catch (final IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivGetEeaTransactionCountTransaction.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivGetEeaTransactionCountTransaction.java deleted file mode 100644 index b27240d1bc8..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivGetEeaTransactionCountTransaction.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.hyperledger.besu.tests.acceptance.dsl.transaction.NodeRequests; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction; - -import java.io.IOException; - -public class PrivGetEeaTransactionCountTransaction implements Transaction { - - private final Object[] params; - - public PrivGetEeaTransactionCountTransaction( - final String accountAddress, final String privateFrom, final String[] privateFor) { - this.params = new Object[] {accountAddress, privateFrom, privateFor}; - } - - @Override - public Integer execute(final NodeRequests node) { - try { - final PrivacyRequestFactory.GetTransactionCountResponse result = - node.privacy().privGetEeaTransactionCount(params).send(); - assertThat(result).isNotNull(); - if (result.hasError()) { - throw new RuntimeException(result.getError().getMessage()); - } - return result.getCount(); - } catch (final IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivGetLogsTransaction.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivGetLogsTransaction.java deleted file mode 100644 index 562a247b5fd..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivGetLogsTransaction.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.hyperledger.besu.tests.acceptance.dsl.privacy.util.LogFilterJsonParameter; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.NodeRequests; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction; - -import java.io.IOException; -import java.util.List; - -import org.web3j.protocol.core.methods.response.EthLog; -import org.web3j.protocol.core.methods.response.EthLog.LogResult; - -@SuppressWarnings("rawtypes") -public class PrivGetLogsTransaction implements Transaction> { - - private final String privacyGroupId; - private final LogFilterJsonParameter filterParameter; - - public PrivGetLogsTransaction( - final String privacyGroupId, final LogFilterJsonParameter filterParameter) { - this.privacyGroupId = privacyGroupId; - this.filterParameter = filterParameter; - } - - @Override - public List execute(final NodeRequests node) { - try { - final EthLog response = node.privacy().privGetLogs(privacyGroupId, filterParameter).send(); - - assertThat(response).as("check response is not null").isNotNull(); - assertThat(response.getResult()).as("check result in response isn't null").isNotNull(); - - return response.getLogs(); - } catch (final IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivGetPrivacyPrecompileAddressTransaction.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivGetPrivacyPrecompileAddressTransaction.java deleted file mode 100644 index cf8cd3f0656..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivGetPrivacyPrecompileAddressTransaction.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.hyperledger.besu.datatypes.Address; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.NodeRequests; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction; - -import java.io.IOException; - -public class PrivGetPrivacyPrecompileAddressTransaction implements Transaction
{ - - @Override - public Address execute(final NodeRequests node) { - try { - final PrivacyRequestFactory.GetPrivacyPrecompileAddressResponse result = - node.privacy().privGetPrivacyPrecompileAddress().send(); - assertThat(result).isNotNull(); - return result.getResult(); - } catch (final IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivGetPrivateTransactionTransaction.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivGetPrivateTransactionTransaction.java deleted file mode 100644 index e91a83f314b..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivGetPrivateTransactionTransaction.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.hyperledger.besu.datatypes.Hash; -import org.hyperledger.besu.tests.acceptance.dsl.privacy.PrivateTransactionGroupResponse; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.NodeRequests; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction; - -import java.io.IOException; - -public class PrivGetPrivateTransactionTransaction - implements Transaction { - - private final Hash transactionHash; - - public PrivGetPrivateTransactionTransaction(final Hash transactionHash) { - this.transactionHash = transactionHash; - } - - @Override - public PrivateTransactionGroupResponse execute(final NodeRequests node) { - try { - final PrivacyRequestFactory.GetPrivateTransactionResponse result = - node.privacy().privGetPrivateTransaction(transactionHash).send(); - assertThat(result).isNotNull(); - return result.getResult(); - } catch (final IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivGetTransaction.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivGetTransaction.java deleted file mode 100644 index 0d6e599a1e2..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivGetTransaction.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.hyperledger.besu.datatypes.Hash; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.NodeRequests; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction; - -import java.io.IOException; - -public class PrivGetTransaction - implements Transaction { - - private final String transactionHash; - - public PrivGetTransaction(final String transactionHash) { - this.transactionHash = transactionHash; - } - - @Override - public PrivacyRequestFactory.GetPrivateTransactionResponse execute(final NodeRequests node) { - try { - final PrivacyRequestFactory.GetPrivateTransactionResponse response = - node.privacy().privGetPrivateTransaction(Hash.fromHexString(transactionHash)).send(); - assertThat(response).as("check response is not null").isNotNull(); - assertThat(response.getResult()).as("check result in response isn't null").isNotNull(); - return response; - } catch (final IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivGetTransactionCountTransaction.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivGetTransactionCountTransaction.java deleted file mode 100644 index e222516beeb..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivGetTransactionCountTransaction.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.hyperledger.besu.tests.acceptance.dsl.transaction.NodeRequests; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction; - -import java.io.IOException; - -public class PrivGetTransactionCountTransaction implements Transaction { - - private final Object[] params; - - public PrivGetTransactionCountTransaction( - final String accountAddress, final String privacyGroupId) { - this.params = new String[] {accountAddress, privacyGroupId}; - } - - @Override - public Integer execute(final NodeRequests node) { - try { - final PrivacyRequestFactory.GetTransactionCountResponse result = - node.privacy().privGetTransactionCount(params).send(); - assertThat(result).isNotNull(); - if (result.hasError()) { - throw new RuntimeException(result.getError().getMessage()); - } - return result.getCount(); - } catch (final IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivGetTransactionReceiptTransaction.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivGetTransactionReceiptTransaction.java deleted file mode 100644 index da2f6b310c6..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivGetTransactionReceiptTransaction.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.hyperledger.besu.datatypes.Hash; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.NodeRequests; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction; - -import java.io.IOException; - -import org.web3j.protocol.besu.response.privacy.PrivateTransactionReceipt; - -public class PrivGetTransactionReceiptTransaction - implements Transaction { - - private final Hash transaction; - - public PrivGetTransactionReceiptTransaction(final Hash transaction) { - this.transaction = transaction; - } - - @Override - public PrivateTransactionReceipt execute(final NodeRequests node) { - try { - final PrivacyRequestFactory.GetTransactionReceiptResponse result = - node.privacy().privGetTransactionReceipt(transaction).send(); - assertThat(result).isNotNull(); - return result.getResult(); - } catch (final IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivSyncingTransactions.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivSyncingTransactions.java deleted file mode 100644 index 361d2c556a0..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivSyncingTransactions.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright contributors to Hyperledger Besu. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.hyperledger.besu.tests.acceptance.dsl.transaction.NodeRequests; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction; - -import java.io.IOException; - -import org.web3j.protocol.core.methods.response.EthSyncing; - -public class PrivSyncingTransactions implements Transaction { - - PrivSyncingTransactions() {} - - @Override - public Boolean execute(final NodeRequests node) { - try { - EthSyncing response = node.eth().ethSyncing().send(); - assertThat(response).isNotNull(); - return response.isSyncing(); - } catch (final IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivTraceTransaction.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivTraceTransaction.java deleted file mode 100644 index b971c4afde7..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivTraceTransaction.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright contributors to Hyperledger Besu. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.hyperledger.besu.datatypes.Hash; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.NodeRequests; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction; - -import java.io.IOException; - -public class PrivTraceTransaction implements Transaction { - - private final String privacyGroupId; - private final Hash transactionHash; - - public PrivTraceTransaction(final String privacyGroupId, final Hash transactionHash) { - this.privacyGroupId = privacyGroupId; - this.transactionHash = transactionHash; - } - - @Override - public String execute(final NodeRequests node) { - try { - final PrivacyRequestFactory.PrivTraceTransaction response = - node.privacy().privTraceTransaction(privacyGroupId, transactionHash).send(); - - assertThat(response).as("check response is not null").isNotNull(); - assertThat(response.getResult()).as("check result in response is not null").isNotNull(); - - return response.getResult(); - } catch (final IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivacyRequestFactory.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivacyRequestFactory.java deleted file mode 100644 index 7c01c02c48e..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivacyRequestFactory.java +++ /dev/null @@ -1,629 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy; - -import static java.util.Collections.singletonList; -import static org.assertj.core.api.Assertions.assertThat; -import static org.hyperledger.besu.ethereum.core.PrivacyParameters.FLEXIBLE_PRIVACY_PROXY; - -import org.hyperledger.besu.crypto.SecureRandomProvider; -import org.hyperledger.besu.datatypes.Address; -import org.hyperledger.besu.datatypes.Hash; -import org.hyperledger.besu.enclave.types.PrivacyGroup; -import org.hyperledger.besu.ethereum.api.jsonrpc.internal.privacy.parameters.CreatePrivacyGroupParameter; -import org.hyperledger.besu.ethereum.privacy.group.FlexibleGroupManagement; -import org.hyperledger.besu.tests.acceptance.dsl.privacy.PrivacyNode; -import org.hyperledger.besu.tests.acceptance.dsl.privacy.PrivateTransactionGroupResponse; -import org.hyperledger.besu.tests.acceptance.dsl.privacy.util.LogFilterJsonParameter; - -import java.io.IOException; -import java.math.BigInteger; -import java.security.SecureRandom; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import org.apache.tuweni.bytes.Bytes; -import org.web3j.abi.FunctionEncoder; -import org.web3j.abi.TypeReference; -import org.web3j.abi.Utils; -import org.web3j.abi.datatypes.Bool; -import org.web3j.abi.datatypes.DynamicArray; -import org.web3j.abi.datatypes.DynamicBytes; -import org.web3j.abi.datatypes.Function; -import org.web3j.abi.datatypes.Type; -import org.web3j.crypto.Credentials; -import org.web3j.protocol.Web3jService; -import org.web3j.protocol.besu.Besu; -import org.web3j.protocol.besu.response.privacy.PrivateTransactionReceipt; -import org.web3j.protocol.core.Request; -import org.web3j.protocol.core.Response; -import org.web3j.protocol.core.methods.response.EthCall; -import org.web3j.protocol.core.methods.response.EthFilter; -import org.web3j.protocol.core.methods.response.EthLog; -import org.web3j.protocol.core.methods.response.EthSendTransaction; -import org.web3j.protocol.core.methods.response.EthUninstallFilter; -import org.web3j.protocol.eea.crypto.PrivateTransactionEncoder; -import org.web3j.protocol.eea.crypto.RawPrivateTransaction; -import org.web3j.protocol.exceptions.TransactionException; -import org.web3j.tx.ChainIdLong; -import org.web3j.tx.Contract; -import org.web3j.tx.PrivateTransactionManager; -import org.web3j.tx.response.PollingPrivateTransactionReceiptProcessor; -import org.web3j.utils.Base64String; -import org.web3j.utils.Numeric; -import org.web3j.utils.Restriction; - -public class PrivacyRequestFactory { - - private final SecureRandom secureRandom; - - public PrivateTransactionManager getTransactionManager( - final Credentials credentials, - final Base64String privateFrom, - final List privateFor, - final Restriction restriction) { - return new PrivateTransactionManager( - getBesuClient(), - credentials, - new PollingPrivateTransactionReceiptProcessor(getBesuClient(), 1000, 60), - ChainIdLong.NONE, - privateFrom, - privateFor, - restriction); - } - - public PrivateTransactionManager getTransactionManager( - final Credentials credentials, - final Base64String privateFrom, - final Base64String privacyGroupId, - final Restriction restriction) { - return new PrivateTransactionManager( - getBesuClient(), - credentials, - new PollingPrivateTransactionReceiptProcessor(getBesuClient(), 1000, 60), - ChainIdLong.NONE, - privateFrom, - privacyGroupId, - restriction); - } - - public static class GetPrivacyPrecompileAddressResponse extends Response
{} - - public static class GetPrivateTransactionResponse - extends Response {} - - public static class PrivTraceTransaction extends Response {} - - public static class CreatePrivacyGroupResponse extends Response {} - - public static class DeletePrivacyGroupResponse extends Response {} - - public static class FindPrivacyGroupResponse extends Response {} - - public static class SendRawTransactionResponse extends Response {} - - public static class GetTransactionReceiptResponse extends Response {} - - public static class GetTransactionCountResponse extends Response { - - final Integer count; - - @JsonCreator - public GetTransactionCountResponse(@JsonProperty("result") final String result) { - this.count = result == null ? null : Integer.decode(result); - } - - public Integer getCount() { - return count; - } - } - - public static class GetCodeResponse extends Response {} - - public static class DebugGetStateRoot extends Response {} - - public Request privDistributeTransaction( - final String signedPrivateTransaction) { - return new Request<>( - "priv_distributeRawTransaction", - singletonList(signedPrivateTransaction), - web3jService, - PrivDistributeTransactionResponse.class); - } - - private final Besu besuClient; - private final Web3jService web3jService; - - public PrivacyRequestFactory(final Web3jService web3jService) { - this.web3jService = web3jService; - this.besuClient = Besu.build(web3jService); - this.secureRandom = SecureRandomProvider.createSecureRandom(); - } - - public Besu getBesuClient() { - return besuClient; - } - - public static class PrivDistributeTransactionResponse extends Response { - - public PrivDistributeTransactionResponse() {} - - public String getTransactionKey() { - return getResult(); - } - } - - public String privxAddToPrivacyGroup( - final Base64String privacyGroupId, - final PrivacyNode adder, - final Credentials signer, - final List addresses) - throws IOException { - - final BigInteger nonce = - besuClient - .privGetTransactionCount(signer.getAddress(), privacyGroupId) - .send() - .getTransactionCount(); - - final Bytes payload = - encodeAddToGroupFunctionCall( - addresses.stream().map(Bytes::fromBase64String).collect(Collectors.toList())); - - final RawPrivateTransaction privateTransaction = - RawPrivateTransaction.createTransaction( - nonce, - BigInteger.valueOf(1000), - BigInteger.valueOf(3000000), - FLEXIBLE_PRIVACY_PROXY.toHexString(), - payload.toHexString(), - Base64String.wrap(adder.getEnclaveKey()), - privacyGroupId, - org.web3j.utils.Restriction.RESTRICTED); - - return besuClient - .eeaSendRawTransaction( - Numeric.toHexString(PrivateTransactionEncoder.signMessage(privateTransaction, signer))) - .send() - .getTransactionHash(); - } - - public String privxRemoveFromPrivacyGroup( - final Base64String privacyGroupId, - final String removerTenant, - final Credentials signer, - final String toRemove) - throws IOException { - - final BigInteger nonce = - besuClient - .privGetTransactionCount(signer.getAddress(), privacyGroupId) - .send() - .getTransactionCount(); - - final Bytes payload = encodeRemoveFromGroupFunctionCall(Bytes.fromBase64String(toRemove)); - - final RawPrivateTransaction privateTransaction = - RawPrivateTransaction.createTransaction( - nonce, - BigInteger.valueOf(1000), - BigInteger.valueOf(3000000), - FLEXIBLE_PRIVACY_PROXY.toHexString(), - payload.toHexString(), - Base64String.wrap(removerTenant), - privacyGroupId, - org.web3j.utils.Restriction.RESTRICTED); - - return besuClient - .eeaSendRawTransaction( - Numeric.toHexString(PrivateTransactionEncoder.signMessage(privateTransaction, signer))) - .send() - .getTransactionHash(); - } - - private Bytes encodeRemoveFromGroupFunctionCall(final Bytes toRemove) { - final Function function = - new Function( - "removeParticipant", - Arrays.asList(new DynamicBytes(toRemove.toArrayUnsafe())), - Arrays.asList(new TypeReference() {})); - - return Bytes.fromHexString(FunctionEncoder.encode(function)); - } - - public String privxLockPrivacyGroup( - final PrivacyNode locker, final Base64String privacyGroupId, final Credentials signer) - throws IOException, TransactionException { - return privxLockOrUnlockPrivacyGroup( - locker, - privacyGroupId, - signer, - FlexibleGroupManagement.LOCK_GROUP_METHOD_SIGNATURE.toHexString()); - } - - public String privxUnlockPrivacyGroup( - final PrivacyNode locker, final Base64String privacyGroupId, final Credentials signer) - throws IOException, TransactionException { - return privxLockOrUnlockPrivacyGroup( - locker, - privacyGroupId, - signer, - FlexibleGroupManagement.UNLOCK_GROUP_METHOD_SIGNATURE.toHexString()); - } - - private String privxLockOrUnlockPrivacyGroup( - final PrivacyNode locker, - final Base64String privacyGroupId, - final Credentials signer, - final String callData) - throws IOException, TransactionException { - final BigInteger nonce = - besuClient - .privGetTransactionCount(signer.getAddress(), privacyGroupId) - .send() - .getTransactionCount(); - - final RawPrivateTransaction privateTransaction = - RawPrivateTransaction.createTransaction( - nonce, - BigInteger.valueOf(1000), - BigInteger.valueOf(3000000), - FLEXIBLE_PRIVACY_PROXY.toHexString(), - callData, - Base64String.wrap(locker.getEnclaveKey()), - privacyGroupId, - org.web3j.utils.Restriction.RESTRICTED); - - final String transactionHash = - besuClient - .eeaSendRawTransaction( - Numeric.toHexString( - PrivateTransactionEncoder.signMessage(privateTransaction, signer))) - .send() - .getTransactionHash(); - - final PrivateTransactionReceipt privateTransactionReceipt = - new PollingPrivateTransactionReceiptProcessor(besuClient, 3000, 10) - .waitForTransactionReceipt(transactionHash); - - assertThat(privateTransactionReceipt.getStatus()).isEqualTo("0x1"); - - return privateTransactionReceipt.getcommitmentHash(); - } - - public PrivxCreatePrivacyGroupResponse privxCreatePrivacyGroup( - final PrivacyNode creator, final String privateFrom, final List addresses) - throws IOException { - - final byte[] bytes = new byte[32]; - secureRandom.nextBytes(bytes); - final Bytes privacyGroupId = Bytes.wrap(bytes); - - final Bytes payload = - encodeAddToGroupFunctionCall( - addresses.stream().map(Bytes::fromBase64String).collect(Collectors.toList())); - - final RawPrivateTransaction privateTransaction = - RawPrivateTransaction.createTransaction( - BigInteger.ZERO, - BigInteger.valueOf(1000), - BigInteger.valueOf(3000000), - FLEXIBLE_PRIVACY_PROXY.toHexString(), - payload.toHexString(), - Base64String.wrap(privateFrom), - Base64String.wrap(privacyGroupId.toArrayUnsafe()), - org.web3j.utils.Restriction.RESTRICTED); - - final Request ethSendTransactionRequest = - besuClient.eeaSendRawTransaction( - Numeric.toHexString( - PrivateTransactionEncoder.signMessage( - privateTransaction, Credentials.create(creator.getTransactionSigningKey())))); - final String transactionHash = ethSendTransactionRequest.send().getTransactionHash(); - return new PrivxCreatePrivacyGroupResponse(privacyGroupId.toBase64String(), transactionHash); - } - - public Request privxFindFlexiblePrivacyGroup( - final List nodes) { - return new Request<>( - "privx_findFlexiblePrivacyGroup", - singletonList(nodes), - web3jService, - PrivxFindPrivacyGroupResponse.class); - } - - public Request privGetPrivacyPrecompileAddress() { - return new Request<>( - "priv_getPrivacyPrecompileAddress", - Collections.emptyList(), - web3jService, - GetPrivacyPrecompileAddressResponse.class); - } - - public Request privGetPrivateTransaction( - final Hash transactionHash) { - return new Request<>( - "priv_getPrivateTransaction", - singletonList(transactionHash.toHexString()), - web3jService, - GetPrivateTransactionResponse.class); - } - - public Request privCreatePrivacyGroup( - final CreatePrivacyGroupParameter params) { - return new Request<>( - "priv_createPrivacyGroup", - singletonList(params), - web3jService, - CreatePrivacyGroupResponse.class); - } - - public Request privDeletePrivacyGroup(final String groupId) { - return new Request<>( - "priv_deletePrivacyGroup", - singletonList(groupId), - web3jService, - DeletePrivacyGroupResponse.class); - } - - public Request privFindPrivacyGroup(final String[] groupMembers) { - return new Request<>( - "priv_findPrivacyGroup", - singletonList(groupMembers), - web3jService, - FindPrivacyGroupResponse.class); - } - - public Request eeaSendRawTransaction(final String transaction) { - return new Request<>( - "eea_sendRawTransaction", - singletonList(transaction), - web3jService, - SendRawTransactionResponse.class); - } - - public Request privGetTransactionReceipt( - final Hash transactionHash) { - return new Request<>( - "priv_getTransactionReceipt", - singletonList(transactionHash.toHexString()), - web3jService, - GetTransactionReceiptResponse.class); - } - - public Request privGetTransactionCount(final Object[] params) { - return new Request<>( - "priv_getTransactionCount", - List.of(params), - web3jService, - GetTransactionCountResponse.class); - } - - public Request privGetEeaTransactionCount(final Object[] params) { - return new Request<>( - "priv_getEeaTransactionCount", - List.of(params), - web3jService, - GetTransactionCountResponse.class); - } - - public Request privGetCode( - final String privacyGroupId, final String contractAddress, final String blockParameter) { - return new Request<>( - "priv_getCode", - List.of(privacyGroupId, contractAddress, blockParameter), - web3jService, - GetCodeResponse.class); - } - - public Request privCall( - final String privacyGroupId, - final Contract contract, - final String encoded, - final String blockNumberLatestPending) { - - final org.web3j.protocol.core.methods.request.Transaction transaction = - org.web3j.protocol.core.methods.request.Transaction.createEthCallTransaction( - null, contract.getContractAddress(), encoded); - - return new Request<>( - "priv_call", - Arrays.asList(privacyGroupId, transaction, blockNumberLatestPending), - web3jService, - EthCall.class); - } - - public Request privGetLogs( - final String privacyGroupId, final LogFilterJsonParameter filterParameter) { - - return new Request<>( - "priv_getLogs", Arrays.asList(privacyGroupId, filterParameter), web3jService, EthLog.class); - } - - public Request privTraceTransaction( - final String privacyGroupId, final Hash transactionHash) { - - return new Request<>( - "priv_traceTransaction", - Arrays.asList(privacyGroupId, transactionHash), - web3jService, - PrivTraceTransaction.class); - } - - public Request privNewFilter( - final String privacyGroupId, final LogFilterJsonParameter filterParameter) { - return new Request<>( - "priv_newFilter", - Arrays.asList(privacyGroupId, filterParameter), - web3jService, - EthFilter.class); - } - - public Request privUninstallFilter( - final String privacyGroupId, final String filterId) { - return new Request<>( - "priv_uninstallFilter", - Arrays.asList(privacyGroupId, filterId), - web3jService, - EthUninstallFilter.class); - } - - public Request privGetFilterLogs(final String privacyGroupId, final String filterId) { - - return new Request<>( - "priv_getFilterLogs", Arrays.asList(privacyGroupId, filterId), web3jService, EthLog.class); - } - - public Request privGetFilterChanges( - final String privacyGroupId, final String filterId) { - - return new Request<>( - "priv_getFilterChanges", - Arrays.asList(privacyGroupId, filterId), - web3jService, - EthLog.class); - } - - public Request privDebugGetStateRoot( - final String privacyGroupId, final String blockParam) { - return new Request<>( - "priv_debugGetStateRoot", - Arrays.asList(privacyGroupId, blockParam), - web3jService, - DebugGetStateRoot.class); - } - - public static class PrivxFindPrivacyGroupResponse extends Response> { - - public List getGroups() { - return getResult(); - } - } - - public static class FlexiblePrivacyGroup { - - private final Base64String privacyGroupId; - private final List members; - private final String name; - private final String description; - - public enum Type { - FLEXIBLE - } - - @JsonCreator - public FlexiblePrivacyGroup( - @JsonProperty(value = "privacyGroupId") final String privacyGroupId, - @JsonProperty(value = "type") final Type type, - @JsonProperty(value = "name") final String name, - @JsonProperty(value = "description") final String description, - @JsonProperty(value = "members") final List members) { - this(privacyGroupId, members); - } - - public FlexiblePrivacyGroup(final String privacyGroupId, final List members) { - this.privacyGroupId = Base64String.wrap(privacyGroupId); - this.name = ""; - this.description = ""; - this.members = members; - } - - public Base64String getPrivacyGroupId() { - return privacyGroupId; - } - - public String getName() { - return name; - } - - public String getDescription() { - return description; - } - - public Type getType() { - return Type.FLEXIBLE; - } - - public List getMembers() { - return members; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - final FlexiblePrivacyGroup that = (FlexiblePrivacyGroup) o; - return getPrivacyGroupId().equals(that.getPrivacyGroupId()) - && getName().equals(that.getName()) - && getDescription().equals(that.getDescription()) - && getType() == that.getType() - && getMembers().equals(that.getMembers()); - } - - @Override - public int hashCode() { - return Objects.hash( - getPrivacyGroupId(), getName(), getDescription(), getType(), getMembers()); - } - } - - public static class PrivxCreatePrivacyGroupResponse { - - final String privacyGroupId; - final String transactionHash; - - @JsonCreator - public PrivxCreatePrivacyGroupResponse( - @JsonProperty("privacyGroupId") final String privacyGroupId, - @JsonProperty("transactionHash") final String transactionHash) { - this.privacyGroupId = privacyGroupId; - this.transactionHash = transactionHash; - } - - public String getPrivacyGroupId() { - return privacyGroupId; - } - - public String getTransactionHash() { - return transactionHash; - } - } - - private Bytes encodeAddToGroupFunctionCall(final List participants) { - final Function function = - new Function( - "addParticipants", - Arrays.asList( - new DynamicArray<>( - DynamicBytes.class, - Utils.typeMap( - participants.stream() - .map(Bytes::toArrayUnsafe) - .collect(Collectors.toList()), - DynamicBytes.class))), - Collections.emptyList()); - - return Bytes.fromHexString(FunctionEncoder.encode(function)); - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivacyTransactions.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivacyTransactions.java deleted file mode 100644 index db51fc2742d..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivacyTransactions.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy; - -import org.hyperledger.besu.datatypes.Hash; - -import java.util.List; - -public class PrivacyTransactions { - public PrivGetPrivacyPrecompileAddressTransaction getPrivacyPrecompileAddress() { - return new PrivGetPrivacyPrecompileAddressTransaction(); - } - - public PrivGetPrivateTransactionTransaction getPrivateTransaction(final Hash transactionHash) { - return new PrivGetPrivateTransactionTransaction(transactionHash); - } - - public PrivCreatePrivacyGroupTransaction createPrivacyGroup( - final List addresses, final String groupName, final String groupDescription) { - return new PrivCreatePrivacyGroupTransaction(addresses, groupName, groupDescription); - } - - public PrivDeletePrivacyGroupTransaction deletePrivacyGroup(final String transactionHash) { - return new PrivDeletePrivacyGroupTransaction(transactionHash); - } - - public PrivFindPrivacyGroupTransaction findPrivacyGroup(final String[] groupMembers) { - return new PrivFindPrivacyGroupTransaction(groupMembers); - } - - public EeaSendRawTransactionTransaction sendRawTransaction(final String transaction) { - return new EeaSendRawTransactionTransaction(transaction); - } - - public PrivDistributeRawTransactionTransaction distributeRawTransaction( - final String transaction) { - return new PrivDistributeRawTransactionTransaction(transaction); - } - - public PrivGetTransactionCountTransaction getTransactionCount( - final String accountAddress, final String privacyGroupId) { - return new PrivGetTransactionCountTransaction(accountAddress, privacyGroupId); - } - - public PrivGetEeaTransactionCountTransaction getEeaTransactionCount( - final String accountAddress, final String privateFrom, final String[] privateFor) { - return new PrivGetEeaTransactionCountTransaction(accountAddress, privateFrom, privateFor); - } - - public PrivGetTransactionReceiptTransaction getTransactionReceipt(final Hash transactionHash) { - return new PrivGetTransactionReceiptTransaction(transactionHash); - } - - public PrivSyncingTransactions syncing() { - return new PrivSyncingTransactions(); - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/filter/PrivGetFilterChangesTransaction.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/filter/PrivGetFilterChangesTransaction.java deleted file mode 100644 index de8f2390c86..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/filter/PrivGetFilterChangesTransaction.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.filter; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.hyperledger.besu.tests.acceptance.dsl.transaction.NodeRequests; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction; - -import java.io.IOException; -import java.util.List; - -import org.web3j.protocol.core.methods.response.EthLog; -import org.web3j.protocol.core.methods.response.EthLog.LogResult; - -@SuppressWarnings("rawtypes") -public class PrivGetFilterChangesTransaction implements Transaction> { - - private final String privacyGroupId; - private final String filterId; - - public PrivGetFilterChangesTransaction(final String privacyGroupId, final String filterId) { - this.privacyGroupId = privacyGroupId; - this.filterId = filterId; - } - - @Override - public List execute(final NodeRequests node) { - try { - final EthLog response = node.privacy().privGetFilterChanges(privacyGroupId, filterId).send(); - - assertThat(response).as("check response is not null").isNotNull(); - assertThat(response.getResult()).as("check result in response isn't null").isNotNull(); - assertThat(response.getLogs()).isNotNull(); - - return response.getLogs(); - } catch (final IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/filter/PrivGetFilterLogsTransaction.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/filter/PrivGetFilterLogsTransaction.java deleted file mode 100644 index 4362062d8f2..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/filter/PrivGetFilterLogsTransaction.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.filter; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.hyperledger.besu.tests.acceptance.dsl.transaction.NodeRequests; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction; - -import java.io.IOException; -import java.util.List; - -import org.web3j.protocol.core.methods.response.EthLog; -import org.web3j.protocol.core.methods.response.EthLog.LogResult; - -@SuppressWarnings("rawtypes") -public class PrivGetFilterLogsTransaction implements Transaction> { - - private final String privacyGroupId; - private final String filterId; - - public PrivGetFilterLogsTransaction(final String privacyGroupId, final String filterId) { - this.privacyGroupId = privacyGroupId; - this.filterId = filterId; - } - - @Override - public List execute(final NodeRequests node) { - try { - final EthLog response = node.privacy().privGetFilterLogs(privacyGroupId, filterId).send(); - - assertThat(response).as("check response is not null").isNotNull(); - assertThat(response.getResult()).as("check result in response isn't null").isNotNull(); - assertThat(response.getLogs()).isNotNull(); - - return response.getLogs(); - } catch (final IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/filter/PrivNewFilterTransaction.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/filter/PrivNewFilterTransaction.java deleted file mode 100644 index fd2d76f4323..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/filter/PrivNewFilterTransaction.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.filter; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.hyperledger.besu.tests.acceptance.dsl.privacy.util.LogFilterJsonParameter; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.NodeRequests; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction; - -import java.io.IOException; - -import org.web3j.protocol.core.methods.response.EthFilter; - -public class PrivNewFilterTransaction implements Transaction { - - private final String privacyGroupId; - private final LogFilterJsonParameter filterParameter; - - public PrivNewFilterTransaction( - final String privacyGroupId, final LogFilterJsonParameter filterParameter) { - this.privacyGroupId = privacyGroupId; - this.filterParameter = filterParameter; - } - - @Override - public String execute(final NodeRequests node) { - try { - final EthFilter response = - node.privacy().privNewFilter(privacyGroupId, filterParameter).send(); - - assertThat(response).as("check response is not null").isNotNull(); - assertThat(response.getResult()).as("check result in response isn't null").isNotNull(); - - return response.getResult(); - } catch (final IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/filter/PrivUninstallFilterTransaction.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/filter/PrivUninstallFilterTransaction.java deleted file mode 100644 index b628d99cd41..00000000000 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/filter/PrivUninstallFilterTransaction.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.filter; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.hyperledger.besu.tests.acceptance.dsl.transaction.NodeRequests; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction; - -import java.io.IOException; - -import org.web3j.protocol.core.methods.response.EthUninstallFilter; - -public class PrivUninstallFilterTransaction implements Transaction { - - private final String privacyGroupId; - private final String filterId; - - public PrivUninstallFilterTransaction(final String privacyGroupId, final String filterId) { - this.privacyGroupId = privacyGroupId; - this.filterId = filterId; - } - - @Override - public Boolean execute(final NodeRequests node) { - try { - final EthUninstallFilter response = - node.privacy().privUninstallFilter(privacyGroupId, filterId).send(); - - assertThat(response).as("check response is not null").isNotNull(); - assertThat(response.getResult()).as("check result in response isn't null").isNotNull(); - - return response.isUninstalled(); - } catch (final IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/acceptance-tests/tests/build.gradle b/acceptance-tests/tests/build.gradle index 953d1859e8e..8bb8fb2f2f7 100644 --- a/acceptance-tests/tests/build.gradle +++ b/acceptance-tests/tests/build.gradle @@ -209,33 +209,6 @@ task acceptanceTestBftSoak(type: Test) { doFirst { mkdir "${buildDir}/jvmErrorLogs" } } -task acceptanceTestPrivacy(type: Test) { - inputs.property "integration.date", LocalTime.now() // so it runs at every invocation - include '**/privacy/**' - - useJUnitPlatform {} - - dependsOn(rootProject.installDist) - setSystemProperties(test.getSystemProperties()) - systemProperty 'acctests.runBesuAsProcess', 'true' - systemProperty 'java.security.properties', "${buildDir}/resources/test/acceptanceTesting.security" - mustRunAfter rootProject.subprojects*.test - description = 'Runs Privacy Besu acceptance tests.' - group = 'verification' - - jvmArgs "-XX:ErrorFile=${buildDir}/jvmErrorLogs/java_err_pid%p.log" - - testLogging { - exceptionFormat = 'full' - showStackTraces = true - showStandardStreams = Boolean.getBoolean('acctests.showStandardStreams') - showExceptions = true - showCauses = true - } - - doFirst { mkdir "${buildDir}/jvmErrorLogs" } -} - task acceptanceTestPermissioning(type: Test) { inputs.property "integration.date", LocalTime.now() // so it runs at every invocation include '**/permissioning/**' diff --git a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/contracts/PrivacyGroupTest.java b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/contracts/PrivacyGroupTest.java deleted file mode 100644 index b805fa43c4e..00000000000 --- a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/contracts/PrivacyGroupTest.java +++ /dev/null @@ -1,195 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.privacy.contracts; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -import org.hyperledger.besu.privacy.contracts.generated.DefaultFlexiblePrivacyGroupManagementContract; -import org.hyperledger.besu.tests.acceptance.dsl.AcceptanceTestBase; -import org.hyperledger.besu.tests.acceptance.dsl.node.BesuNode; - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.web3j.protocol.core.RemoteFunctionCall; -import org.web3j.protocol.core.methods.response.TransactionReceipt; -import org.web3j.protocol.exceptions.TransactionException; -import org.web3j.utils.Base64String; - -@SuppressWarnings("unchecked") -public class PrivacyGroupTest extends AcceptanceTestBase { - - private final Base64String firstParticipant = - Base64String.wrap("A1aVtMxLCUHmBVHXoZzzBgPbW/wj5axDpW9X8l91SGo="); - private final Base64String secondParticipant = - Base64String.wrap("Ko2bVqD+nNlNYL5EE7y3IdOnviftjiizpjRt+HTuFBs="); - private final Base64String thirdParticipant = - Base64String.wrap("Jo2bVqD+nNlNYL5EE7y3IdOnviftjiizpjRt+HTuFBs="); - private DefaultFlexiblePrivacyGroupManagementContract defaultPrivacyGroupManagementContract; - - private static final String RAW_FIRST_PARTICIPANT = "0x5aa68ac0"; - private static final String RAW_ADD_PARTICIPANT = - "0x965a25ef00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000202a8d9b56a0fe9cd94d60be4413bcb721d3a7be27ed8e28b3a6346df874ee141b"; - private static final String RAW_REMOVE_PARTICIPANT = - "0x1f52a8ee000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000202a8d9b56a0fe9cd94d60be4413bcb721d3a7be27ed8e28b3a6346df874ee141b"; - private static final String RAW_LOCK = "0xf83d08ba"; - private static final String RAW_UNLOCK = "0xa69df4b5"; - private static final String RAW_CAN_EXECUTE = "0x78b90337"; - private static final String RAW_GET_VERSION = "0x0d8e6e2c"; - - private BesuNode minerNode; - - @BeforeEach - public void setUp() throws Exception { - minerNode = besu.createMinerNode("node"); - cluster.start(minerNode); - defaultPrivacyGroupManagementContract = - minerNode.execute( - contractTransactions.createSmartContract( - DefaultFlexiblePrivacyGroupManagementContract.class)); - } - - @Test - public void rlp() throws Exception { - final String contractAddress = "0x42699a7612a82f1d9c36148af9c77354759b210b"; - assertThat(defaultPrivacyGroupManagementContract.isValid()).isEqualTo(true); - contractVerifier - .validTransactionReceipt(contractAddress) - .verify(defaultPrivacyGroupManagementContract); - // 0x0b0235be - assertThat(defaultPrivacyGroupManagementContract.getParticipants().encodeFunctionCall()) - .isEqualTo(RAW_FIRST_PARTICIPANT); - // 0xf744b089 - assertThat( - defaultPrivacyGroupManagementContract - .addParticipants(Collections.singletonList(secondParticipant.raw())) - .encodeFunctionCall()) - .isEqualTo(RAW_ADD_PARTICIPANT); - // 0xf744b089 - assertThat( - defaultPrivacyGroupManagementContract - .removeParticipant(secondParticipant.raw()) - .encodeFunctionCall()) - .isEqualTo(RAW_REMOVE_PARTICIPANT); - assertThat(defaultPrivacyGroupManagementContract.lock().encodeFunctionCall()) - .isEqualTo(RAW_LOCK); - assertThat(defaultPrivacyGroupManagementContract.unlock().encodeFunctionCall()) - .isEqualTo(RAW_UNLOCK); - assertThat(defaultPrivacyGroupManagementContract.canExecute().encodeFunctionCall()) - .isEqualTo(RAW_CAN_EXECUTE); - assertThat(defaultPrivacyGroupManagementContract.getVersion().encodeFunctionCall()) - .isEqualTo(RAW_GET_VERSION); - } - - @Test - public void canInitiallyAddParticipants() throws Exception { - final RemoteFunctionCall transactionReceiptRemoteFunctionCall = - defaultPrivacyGroupManagementContract.addParticipants( - Arrays.asList(firstParticipant.raw(), secondParticipant.raw())); - transactionReceiptRemoteFunctionCall.send(); - final List participants = - defaultPrivacyGroupManagementContract.getParticipants().send(); - assertThat(participants.size()).isEqualTo(2); - assertThat(firstParticipant.raw()).isEqualTo(participants.get(0)); - assertThat(secondParticipant.raw()).isEqualTo(participants.get(1)); - } - - @Test - public void canRemoveParticipant() throws Exception { - defaultPrivacyGroupManagementContract - .addParticipants(Arrays.asList(firstParticipant.raw(), secondParticipant.raw())) - .send(); - final List participants = - defaultPrivacyGroupManagementContract.getParticipants().send(); - assertThat(participants.size()).isEqualTo(2); - assertThat(firstParticipant.raw()).isEqualTo(participants.get(0)); - assertThat(secondParticipant.raw()).isEqualTo(participants.get(1)); - defaultPrivacyGroupManagementContract.removeParticipant(secondParticipant.raw()).send(); - final List participantsAfterRemove = - defaultPrivacyGroupManagementContract.getParticipants().send(); - assertThat(participantsAfterRemove.size()).isEqualTo(1); - assertThat(firstParticipant.raw()).isEqualTo(participantsAfterRemove.get(0)); - } - - @Test - public void cannotAddToContractWhenNotLocked() throws Exception { - defaultPrivacyGroupManagementContract - .addParticipants(Collections.singletonList(thirdParticipant.raw())) - .send(); - - assertThatThrownBy( - () -> - defaultPrivacyGroupManagementContract - .addParticipants(Collections.singletonList(secondParticipant.raw())) - .send()) - .isInstanceOf(TransactionException.class); - } - - @Test - public void ensureContractIsLockedAfterDeploy() throws Exception { - assertThat(defaultPrivacyGroupManagementContract.canExecute().send()).isFalse(); - } - - @Test - public void ensurePrivacyGroupVersionIsAlwaysDifferent() throws Exception { - defaultPrivacyGroupManagementContract - .addParticipants(Collections.singletonList(secondParticipant.raw())) - .send(); - final byte[] version1 = defaultPrivacyGroupManagementContract.getVersion().send(); - defaultPrivacyGroupManagementContract.lock().send(); - defaultPrivacyGroupManagementContract - .addParticipants(Collections.singletonList(thirdParticipant.raw())) - .send(); - final byte[] version2 = defaultPrivacyGroupManagementContract.getVersion().send(); - defaultPrivacyGroupManagementContract.removeParticipant(secondParticipant.raw()).send(); - final byte[] version3 = defaultPrivacyGroupManagementContract.getVersion().send(); - - assertThat(version1).isNotEqualTo(version2); - assertThat(version1).isNotEqualTo(version3); - assertThat(version2).isNotEqualTo(version3); - } - - @Test - public void canAddTwiceToContractWhenCallLock() throws Exception { - defaultPrivacyGroupManagementContract - .addParticipants(Arrays.asList(firstParticipant.raw(), thirdParticipant.raw())) - .send(); - defaultPrivacyGroupManagementContract.lock().send(); - defaultPrivacyGroupManagementContract - .addParticipants(Collections.singletonList(secondParticipant.raw())) - .send(); - - final List participants = - defaultPrivacyGroupManagementContract.getParticipants().send(); - assertThat(participants.size()).isEqualTo(3); - assertThat(firstParticipant.raw()).isEqualTo(participants.get(0)); - assertThat(thirdParticipant.raw()).isEqualTo(participants.get(1)); - assertThat(secondParticipant.raw()).isEqualTo(participants.get(2)); - } - - @Test - public void cannotLockTwice() throws Exception { - defaultPrivacyGroupManagementContract - .addParticipants(Collections.singletonList(thirdParticipant.raw())) - .send(); - defaultPrivacyGroupManagementContract.lock().send(); - assertThatThrownBy(() -> defaultPrivacyGroupManagementContract.lock().send()) - .isInstanceOf(TransactionException.class); - } -} diff --git a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/contracts/PrivacyProxyTest.java b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/contracts/PrivacyProxyTest.java deleted file mode 100644 index 931770ee321..00000000000 --- a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/contracts/PrivacyProxyTest.java +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.privacy.contracts; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -import org.hyperledger.besu.privacy.contracts.generated.DefaultFlexiblePrivacyGroupManagementContract; -import org.hyperledger.besu.privacy.contracts.generated.FlexiblePrivacyGroupManagementProxy; -import org.hyperledger.besu.tests.acceptance.dsl.AcceptanceTestBase; -import org.hyperledger.besu.tests.acceptance.dsl.account.Accounts; -import org.hyperledger.besu.tests.acceptance.dsl.node.BesuNode; - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.web3j.crypto.Credentials; -import org.web3j.protocol.Web3j; -import org.web3j.protocol.exceptions.TransactionException; -import org.web3j.protocol.http.HttpService; -import org.web3j.tx.gas.DefaultGasProvider; -import org.web3j.utils.Base64String; - -@SuppressWarnings("unchecked") -public class PrivacyProxyTest extends AcceptanceTestBase { - - private final Base64String firstParticipant = - Base64String.wrap("93Ky7lXwFkMc7+ckoFgUMku5bpr9tz4zhmWmk9RlNng="); - private final Base64String secondParticipant = - Base64String.wrap("9iaJ6OObl6TUWYjXAOyZsL0VaDPwF+tRFkMwwYSeqqw="); - private final Base64String thirdParticipant = - Base64String.wrap("Jo2bVqD+nNlNYL5EE7y3IdOnviftjiizpjRt+HTuFBs="); - private FlexiblePrivacyGroupManagementProxy flexiblePrivacyGroupManagementProxy; - - private static final String RAW_GET_PARTICIPANTS = "0x5aa68ac0"; - private static final String RAW_ADD_PARTICIPANT = - "0x965a25ef0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020f772b2ee55f016431cefe724a05814324bb96e9afdb73e338665a693d4653678"; - - private BesuNode minerNode; - private DefaultFlexiblePrivacyGroupManagementContract - defaultFlexiblePrivacyGroupManagementContract; - - @BeforeEach - public void setUp() throws Exception { - minerNode = besu.createMinerNode("node"); - cluster.start(minerNode); - defaultFlexiblePrivacyGroupManagementContract = - minerNode.execute( - contractTransactions.createSmartContract( - DefaultFlexiblePrivacyGroupManagementContract.class)); - flexiblePrivacyGroupManagementProxy = - minerNode.execute( - contractTransactions.createSmartContract( - FlexiblePrivacyGroupManagementProxy.class, - defaultFlexiblePrivacyGroupManagementContract.getContractAddress())); - } - - @Test - public void rlp() throws Exception { - assertThat(flexiblePrivacyGroupManagementProxy.isValid()).isEqualTo(true); - contractVerifier - .validTransactionReceipt(flexiblePrivacyGroupManagementProxy.getContractAddress()) - .verify(flexiblePrivacyGroupManagementProxy); - assertThat(flexiblePrivacyGroupManagementProxy.getParticipants().encodeFunctionCall()) - .isEqualTo(RAW_GET_PARTICIPANTS); - - assertThat( - flexiblePrivacyGroupManagementProxy - .addParticipants(List.of(firstParticipant.raw())) - .encodeFunctionCall()) - .isEqualTo(RAW_ADD_PARTICIPANT); - } - - @Test - public void deploysWithNoParticipant() throws Exception { - final List participants = flexiblePrivacyGroupManagementProxy.getParticipants().send(); - assertThat(participants.size()).isEqualTo(0); - } - - @Test - public void canAddParticipants() throws Exception { - flexiblePrivacyGroupManagementProxy - .addParticipants(Arrays.asList(firstParticipant.raw(), secondParticipant.raw())) - .send(); - final List participants = flexiblePrivacyGroupManagementProxy.getParticipants().send(); - assertThat(participants.size()).isEqualTo(2); - assertThat(firstParticipant.raw()).isEqualTo(participants.get(0)); - assertThat(secondParticipant.raw()).isEqualTo(participants.get(1)); - } - - @Test - public void nonOwnerCannotUpgrade() throws Exception { - flexiblePrivacyGroupManagementProxy - .addParticipants(Arrays.asList(firstParticipant.raw(), secondParticipant.raw())) - .send(); - final List participants = flexiblePrivacyGroupManagementProxy.getParticipants().send(); - assertThat(participants.size()).isEqualTo(2); - assertThat(firstParticipant.raw()).isEqualTo(participants.get(0)); - assertThat(secondParticipant.raw()).isEqualTo(participants.get(1)); - - final DefaultFlexiblePrivacyGroupManagementContract upgradedContract = - minerNode.execute( - contractTransactions.createSmartContract( - DefaultFlexiblePrivacyGroupManagementContract.class)); - - final HttpService httpService = - new HttpService( - "http://" + minerNode.getHostName() + ":" + minerNode.getJsonRpcPort().get()); - final Web3j web3j = Web3j.build(httpService); - - // load the proxy contract, use it with another signer - final FlexiblePrivacyGroupManagementProxy proxyContractAccount2 = - FlexiblePrivacyGroupManagementProxy.load( - flexiblePrivacyGroupManagementProxy.getContractAddress(), - web3j, - Credentials.create(Accounts.GENESIS_ACCOUNT_TWO_PRIVATE_KEY), - new DefaultGasProvider()); - // contract is the proxy contract and uses genesis account 2. It should not be able to upgrade - // the contract, because it is not the owner of "upgradedContract" - assertThatThrownBy( - () -> proxyContractAccount2.upgradeTo(upgradedContract.getContractAddress()).send()) - .isInstanceOf(TransactionException.class); - } - - @Test - public void ownerCanUpgrade() throws Exception { - flexiblePrivacyGroupManagementProxy - .addParticipants(Arrays.asList(firstParticipant.raw(), secondParticipant.raw())) - .send(); - final List participants = flexiblePrivacyGroupManagementProxy.getParticipants().send(); - assertThat(participants.size()).isEqualTo(2); - assertThat(firstParticipant.raw()).isEqualTo(participants.get(0)); - assertThat(secondParticipant.raw()).isEqualTo(participants.get(1)); - - final DefaultFlexiblePrivacyGroupManagementContract upgradedContract = - minerNode.execute( - contractTransactions.createSmartContract( - DefaultFlexiblePrivacyGroupManagementContract.class)); - - flexiblePrivacyGroupManagementProxy.upgradeTo(upgradedContract.getContractAddress()).send(); - final List participantsAfterUpgrade = - flexiblePrivacyGroupManagementProxy.getParticipants().send(); - assertThat(participantsAfterUpgrade.size()).isEqualTo(2); - assertThat(firstParticipant.raw()).isEqualTo(participantsAfterUpgrade.get(0)); - assertThat(secondParticipant.raw()).isEqualTo(participantsAfterUpgrade.get(1)); - } - - @Test - public void canAddTwiceToContractWhenCallLock() throws Exception { - flexiblePrivacyGroupManagementProxy - .addParticipants(Arrays.asList(firstParticipant.raw(), thirdParticipant.raw())) - .send(); - flexiblePrivacyGroupManagementProxy.lock().send(); - flexiblePrivacyGroupManagementProxy - .addParticipants(Collections.singletonList(secondParticipant.raw())) - .send(); - final List participants = flexiblePrivacyGroupManagementProxy.getParticipants().send(); - assertThat(participants.size()).isEqualTo(3); - assertThat(firstParticipant.raw()).isEqualTo(participants.get(0)); - assertThat(thirdParticipant.raw()).isEqualTo(participants.get(1)); - assertThat(secondParticipant.raw()).isEqualTo(participants.get(2)); - } -} diff --git a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/multitenancy/MultiTenancyAcceptanceTest.java b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/multitenancy/MultiTenancyAcceptanceTest.java deleted file mode 100644 index b1c175f6461..00000000000 --- a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/multitenancy/MultiTenancyAcceptanceTest.java +++ /dev/null @@ -1,408 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.privacy.multitenancy; - -import static com.github.tomakehurst.wiremock.client.WireMock.ok; -import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options; -import static java.nio.charset.StandardCharsets.UTF_8; -import static java.util.Collections.emptyList; -import static java.util.Collections.singletonList; -import static org.hyperledger.besu.ethereum.core.PrivacyParameters.DEFAULT_PRIVACY; - -import org.hyperledger.besu.crypto.KeyPair; -import org.hyperledger.besu.crypto.SignatureAlgorithm; -import org.hyperledger.besu.crypto.SignatureAlgorithmFactory; -import org.hyperledger.besu.datatypes.Address; -import org.hyperledger.besu.datatypes.Hash; -import org.hyperledger.besu.datatypes.Wei; -import org.hyperledger.besu.enclave.types.PrivacyGroup; -import org.hyperledger.besu.enclave.types.ReceiveResponse; -import org.hyperledger.besu.enclave.types.SendResponse; -import org.hyperledger.besu.ethereum.privacy.PrivacyGroupUtil; -import org.hyperledger.besu.ethereum.privacy.PrivateTransaction; -import org.hyperledger.besu.ethereum.rlp.BytesValueRLPOutput; -import org.hyperledger.besu.plugin.data.Restriction; -import org.hyperledger.besu.tests.acceptance.dsl.AcceptanceTestBase; -import org.hyperledger.besu.tests.acceptance.dsl.node.BesuNode; -import org.hyperledger.besu.tests.acceptance.dsl.node.cluster.Cluster; -import org.hyperledger.besu.tests.acceptance.dsl.node.cluster.ClusterConfiguration; -import org.hyperledger.besu.tests.acceptance.dsl.node.cluster.ClusterConfigurationBuilder; - -import java.math.BigInteger; -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; -import javax.annotation.Nonnull; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.github.tomakehurst.wiremock.junit.WireMockRule; -import com.google.common.base.Supplier; -import com.google.common.base.Suppliers; -import org.apache.tuweni.bytes.Bytes; -import org.apache.tuweni.bytes.Bytes32; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; - -public class MultiTenancyAcceptanceTest extends AcceptanceTestBase { - private BesuNode node; - private final ObjectMapper mapper = new ObjectMapper(); - private Cluster multiTenancyCluster; - - private static final Supplier SIGNATURE_ALGORITHM = - Suppliers.memoize(SignatureAlgorithmFactory::getInstance); - private static final KeyPair TEST_KEY = - SIGNATURE_ALGORITHM - .get() - .createKeyPair( - SIGNATURE_ALGORITHM - .get() - .createPrivateKey( - new BigInteger( - "853d7f0010fd86d0d7811c1f9d968ea89a24484a8127b4a483ddf5d2cfec766d", 16))); - private static final String PRIVACY_GROUP_ID = "B1aVtMxLCUHmBVHXoZzzBgPbW/wj5axDpW9X8l91SGo="; - private static final String PARTICIPANT_ENCLAVE_KEY0 = - "A1aVtMxLCUHmBVHXoZzzBgPbW/wj5axDpW9X8l91SGo="; - private static final Bytes LEAGCY_PRIVATE_FROM = Bytes.fromBase64String(PARTICIPANT_ENCLAVE_KEY0); - private static final String PARTICIPANT_ENCLAVE_KEY1 = - "sgFkVOyFndZe/5SAZJO5UYbrl7pezHetveriBBWWnE8="; - private static final List LEGACY_PRIVATE_FOR = - List.of(Bytes.fromBase64String(PARTICIPANT_ENCLAVE_KEY1)); - private static final String PARTICIPANT_ENCLAVE_KEY2 = - "R1kW75NQC9XX3kwNpyPjCBFflM29+XvnKKS9VLrUkzo="; - private static final String PARTICIPANT_ENCLAVE_KEY3 = - "A1aVtMxLCUHmBVHXoZzzBgPbW/wj5axDpW9X8l91SGo="; - private final Address senderAddress = - Address.wrap(Bytes.fromHexString(accounts.getPrimaryBenefactor().getAddress())); - - @Rule public WireMockRule wireMockRule = new WireMockRule(options().dynamicPort()); - - @Before - public void setUp() throws Exception { - final ClusterConfiguration clusterConfiguration = - new ClusterConfigurationBuilder().awaitPeerDiscovery(false).build(); - multiTenancyCluster = new Cluster(clusterConfiguration, net); - node = - besu.createNodeWithMultiTenantedPrivacy( - "node1", - "http://127.0.0.1:" + wireMockRule.port(), - "authentication/auth_priv.toml", - "authentication/auth_priv_key", - false, - false); - multiTenancyCluster.start(node); - final String token = - node.execute(permissioningTransactions.createSuccessfulLogin("user", "pegasys")); - node.useAuthenticationTokenInHeaderForJsonRpc(token); - } - - @After - public void tearDown() { - multiTenancyCluster.close(); - } - - @Test - public void privGetPrivacyPrecompileAddressShouldReturnExpectedAddress() { - node.verify(priv.getPrivacyPrecompileAddress(DEFAULT_PRIVACY)); - } - - @Test - public void privGetPrivateTransactionSuccessShouldReturnExpectedPrivateTransaction() - throws JsonProcessingException { - final PrivateTransaction validSignedPrivateTransaction = - getValidSignedPrivateTransaction(senderAddress); - - receiveEnclaveStub(validSignedPrivateTransaction); - retrievePrivacyGroupEnclaveStub(); - sendEnclaveStub(PARTICIPANT_ENCLAVE_KEY1); - - final Hash transactionHash = - node.execute( - privacyTransactions.sendRawTransaction( - getRLPOutput(validSignedPrivateTransaction).encoded().toHexString())); - node.verify(priv.getSuccessfulTransactionReceipt(transactionHash)); - node.verify(priv.getPrivateTransaction(transactionHash, validSignedPrivateTransaction)); - } - - @Test - public void privCreatePrivacyGroupSuccessShouldReturnNewId() throws JsonProcessingException { - createPrivacyGroupEnclaveStub(); - - node.verify( - priv.createPrivacyGroup( - List.of(PARTICIPANT_ENCLAVE_KEY1, PARTICIPANT_ENCLAVE_KEY2, PARTICIPANT_ENCLAVE_KEY3), - "GroupName", - "Group description.", - PRIVACY_GROUP_ID)); - } - - @Test - public void privDeletePrivacyGroupSuccessShouldReturnId() throws JsonProcessingException { - retrievePrivacyGroupEnclaveStub(); - deletePrivacyGroupEnclaveStub(); - - node.verify(priv.deletePrivacyGroup(PRIVACY_GROUP_ID)); - } - - @Test - public void privFindPrivacyGroupSuccessShouldReturnExpectedGroupMembership() - throws JsonProcessingException { - final List groupMembership = - List.of( - testPrivacyGroup(singletonList(PARTICIPANT_ENCLAVE_KEY0), PrivacyGroup.Type.PANTHEON), - testPrivacyGroup(singletonList(PARTICIPANT_ENCLAVE_KEY0), PrivacyGroup.Type.PANTHEON), - testPrivacyGroup(singletonList(PARTICIPANT_ENCLAVE_KEY0), PrivacyGroup.Type.PANTHEON)); - - findPrivacyGroupEnclaveStub(groupMembership); - - node.verify(priv.findPrivacyGroup(groupMembership.size(), PARTICIPANT_ENCLAVE_KEY0)); - } - - @Test - public void eeaSendRawTransactionSuccessShouldReturnPrivateTransactionHash() - throws JsonProcessingException { - final PrivateTransaction validSignedPrivateTransaction = - getValidSignedPrivateTransaction(senderAddress); - - retrievePrivacyGroupEnclaveStub(); - sendEnclaveStub(PARTICIPANT_ENCLAVE_KEY1); - receiveEnclaveStub(validSignedPrivateTransaction); - - node.verify( - priv.eeaSendRawTransaction( - getRLPOutput(validSignedPrivateTransaction).encoded().toHexString())); - } - - @Test - public void privGetTransactionCountSuccessShouldReturnExpectedTransactionCount() - throws JsonProcessingException { - final PrivateTransaction validSignedPrivateTransaction = - getValidSignedPrivateTransaction(senderAddress); - final String accountAddress = validSignedPrivateTransaction.getSender().toHexString(); - final BytesValueRLPOutput rlpOutput = getRLPOutput(validSignedPrivateTransaction); - - retrievePrivacyGroupEnclaveStub(); - sendEnclaveStub(PARTICIPANT_ENCLAVE_KEY1); - receiveEnclaveStub(validSignedPrivateTransaction); - - node.verify(priv.getTransactionCount(accountAddress, PRIVACY_GROUP_ID, 0)); - final Hash transactionReceipt = - node.execute(privacyTransactions.sendRawTransaction(rlpOutput.encoded().toHexString())); - - node.verify(priv.getSuccessfulTransactionReceipt(transactionReceipt)); - node.verify(priv.getTransactionCount(accountAddress, PRIVACY_GROUP_ID, 1)); - } - - @Test - public void privDistributeRawTransactionSuccessShouldReturnEnclaveKey() - throws JsonProcessingException { - final String enclaveResponseKeyBytes = - Bytes.wrap(Bytes.fromBase64String(PARTICIPANT_ENCLAVE_KEY1)).toString(); - - retrievePrivacyGroupEnclaveStub(); - sendEnclaveStub(PARTICIPANT_ENCLAVE_KEY1); - - node.verify( - priv.distributeRawTransaction( - getRLPOutput(getValidSignedPrivateTransaction(senderAddress)).encoded().toHexString(), - enclaveResponseKeyBytes)); - } - - @Test - public void privGetTransactionReceiptSuccessShouldReturnTransactionReceiptAfterMined() - throws JsonProcessingException { - final PrivateTransaction validSignedPrivateTransaction = - getValidSignedPrivateTransaction(senderAddress); - final BytesValueRLPOutput rlpOutput = getRLPOutput(validSignedPrivateTransaction); - - retrievePrivacyGroupEnclaveStub(); - sendEnclaveStub(PARTICIPANT_ENCLAVE_KEY1); - receiveEnclaveStub(validSignedPrivateTransaction); - - final Hash transactionReceipt = - node.execute(privacyTransactions.sendRawTransaction(rlpOutput.encoded().toHexString())); - - node.verify(priv.getSuccessfulTransactionReceipt(transactionReceipt)); - } - - @Test - public void privGetEeaTransactionCountSuccessShouldReturnExpectedTransactionCount() - throws JsonProcessingException { - final PrivateTransaction validSignedPrivateTransaction = - getValidLegacySignedPrivateTransaction(senderAddress); - final String accountAddress = validSignedPrivateTransaction.getSender().toHexString(); - final String privateTxRlp = getRLPOutput(validSignedPrivateTransaction).encoded().toHexString(); - - retrieveEeaPrivacyGroupEnclaveStub(validSignedPrivateTransaction); - sendEnclaveStub( - Bytes32.ZERO.toBase64String()); // can be any value, as we are stubbing the enclave - receiveEnclaveStubEea(validSignedPrivateTransaction); - - final String privateFrom = validSignedPrivateTransaction.getPrivateFrom().toBase64String(); - final String[] privateFor = - validSignedPrivateTransaction.getPrivateFor().orElseThrow().stream() - .map(Bytes::toBase64String) - .toArray(String[]::new); - node.verify(priv.getEeaTransactionCount(accountAddress, privateFrom, privateFor, 0)); - - final Hash transactionHash = node.execute(privacyTransactions.sendRawTransaction(privateTxRlp)); - - node.verify(priv.getSuccessfulTransactionReceipt(transactionHash)); - - node.verify(priv.getEeaTransactionCount(accountAddress, privateFrom, privateFor, 1)); - } - - @Nonnull - private Bytes32 getPrivacyGroupIdFromEeaTransaction( - final PrivateTransaction validSignedPrivateTransaction) { - return PrivacyGroupUtil.calculateEeaPrivacyGroupId( - validSignedPrivateTransaction.getPrivateFrom(), - validSignedPrivateTransaction.getPrivateFor().get()); - } - - private void findPrivacyGroupEnclaveStub(final List groupMembership) - throws JsonProcessingException { - final String findGroupResponse = mapper.writeValueAsString(groupMembership); - stubFor(post("/findPrivacyGroup").willReturn(ok(findGroupResponse))); - } - - private void createPrivacyGroupEnclaveStub() throws JsonProcessingException { - final String createGroupResponse = - mapper.writeValueAsString(testPrivacyGroup(emptyList(), PrivacyGroup.Type.PANTHEON)); - stubFor(post("/createPrivacyGroup").willReturn(ok(createGroupResponse))); - } - - private void deletePrivacyGroupEnclaveStub() throws JsonProcessingException { - final String deleteGroupResponse = mapper.writeValueAsString(PRIVACY_GROUP_ID); - stubFor(post("/deletePrivacyGroup").willReturn(ok(deleteGroupResponse))); - } - - private void retrievePrivacyGroupEnclaveStub() throws JsonProcessingException { - final String retrieveGroupResponse = - mapper.writeValueAsString( - testPrivacyGroup( - List.of(PARTICIPANT_ENCLAVE_KEY0, PARTICIPANT_ENCLAVE_KEY1), - PrivacyGroup.Type.PANTHEON)); - stubFor(post("/retrievePrivacyGroup").willReturn(ok(retrieveGroupResponse))); - } - - private void retrieveEeaPrivacyGroupEnclaveStub(final PrivateTransaction tx) - throws JsonProcessingException { - final ArrayList members = new ArrayList<>(); - members.add(tx.getPrivateFrom().toBase64String()); - members.addAll( - tx.getPrivateFor().orElseThrow().stream() - .map(Bytes::toBase64String) - .collect(Collectors.toList())); - final String retrieveGroupResponse = - mapper.writeValueAsString(testPrivacyGroupEea(members, PrivacyGroup.Type.LEGACY)); - stubFor(post("/retrievePrivacyGroup").willReturn(ok(retrieveGroupResponse))); - } - - private void sendEnclaveStub(final String testKey) throws JsonProcessingException { - final String sendResponse = mapper.writeValueAsString(new SendResponse(testKey)); - stubFor(post("/send").willReturn(ok(sendResponse))); - } - - private void receiveEnclaveStub(final PrivateTransaction privTx) throws JsonProcessingException { - final BytesValueRLPOutput rlpOutput = getRLPOutputForReceiveResponse(privTx); - final String senderKey = privTx.getPrivateFrom().toBase64String(); - final String receiveResponse = - mapper.writeValueAsString( - new ReceiveResponse( - rlpOutput.encoded().toBase64String().getBytes(UTF_8), PRIVACY_GROUP_ID, senderKey)); - stubFor(post("/receive").willReturn(ok(receiveResponse))); - } - - private void receiveEnclaveStubEea(final PrivateTransaction privTx) - throws JsonProcessingException { - final BytesValueRLPOutput rlpOutput = getRLPOutputForReceiveResponse(privTx); - final String senderKey = privTx.getPrivateFrom().toBase64String(); - final String receiveResponse = - mapper.writeValueAsString( - new ReceiveResponse( - rlpOutput.encoded().toBase64String().getBytes(UTF_8), - getPrivacyGroupIdFromEeaTransaction(privTx).toBase64String(), - senderKey)); - stubFor(post("/receive").willReturn(ok(receiveResponse))); - } - - private BytesValueRLPOutput getRLPOutputForReceiveResponse( - final PrivateTransaction privateTransaction) { - final BytesValueRLPOutput bvrlpo = new BytesValueRLPOutput(); - privateTransaction.writeTo(bvrlpo); - return bvrlpo; - } - - private BytesValueRLPOutput getRLPOutput(final PrivateTransaction privateTransaction) { - final BytesValueRLPOutput bvrlpo = new BytesValueRLPOutput(); - privateTransaction.writeTo(bvrlpo); - return bvrlpo; - } - - private PrivacyGroup testPrivacyGroup( - final List groupMembers, final PrivacyGroup.Type groupType) { - return new PrivacyGroup(PRIVACY_GROUP_ID, groupType, "test", "testGroup", groupMembers); - } - - private PrivacyGroup testPrivacyGroupEea( - final List groupMembers, final PrivacyGroup.Type groupType) { - final Bytes32 privacyGroupId = - PrivacyGroupUtil.calculateEeaPrivacyGroupId( - Bytes.fromBase64String(groupMembers.get(0)), - groupMembers.stream() - .map(gm -> Bytes.fromBase64String(gm)) - .collect(Collectors.toList())); - return new PrivacyGroup( - privacyGroupId.toBase64String(), groupType, "test", "testGroup", groupMembers); - } - - private static PrivateTransaction getValidSignedPrivateTransaction(final Address senderAddress) { - return PrivateTransaction.builder() - .nonce(0) - .gasPrice(Wei.ZERO) - .gasLimit(3000000) - .to(null) - .value(Wei.ZERO) - .payload(Bytes.wrap(new byte[] {})) - .sender(senderAddress) - .chainId(BigInteger.valueOf(1337)) - .privateFrom(Bytes.fromBase64String(PARTICIPANT_ENCLAVE_KEY0)) - .restriction(Restriction.RESTRICTED) - .privacyGroupId(Bytes.fromBase64String(PRIVACY_GROUP_ID)) - .signAndBuild(TEST_KEY); - } - - private static PrivateTransaction getValidLegacySignedPrivateTransaction( - final Address senderAddress) { - return PrivateTransaction.builder() - .nonce(0) - .gasPrice(Wei.ZERO) - .gasLimit(3000000) - .to(null) - .value(Wei.ZERO) - .payload(Bytes.wrap(new byte[] {})) - .sender(senderAddress) - .chainId(BigInteger.valueOf(1337)) - .privateFrom(LEAGCY_PRIVATE_FROM) - .privateFor(LEGACY_PRIVATE_FOR) - .restriction(Restriction.RESTRICTED) - .signAndBuild(TEST_KEY); - } -} diff --git a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/multitenancy/MultiTenancyPrivacyGroup.java b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/multitenancy/MultiTenancyPrivacyGroup.java deleted file mode 100644 index a53a173a0d7..00000000000 --- a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/multitenancy/MultiTenancyPrivacyGroup.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.privacy.multitenancy; - -import org.hyperledger.besu.tests.acceptance.dsl.privacy.PrivacyNode; - -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -public class MultiTenancyPrivacyGroup { - - private final Map> map; - - public MultiTenancyPrivacyGroup() { - this.map = new HashMap<>(); - } - - public MultiTenancyPrivacyGroup addNodeWithTenants( - final MultiTenancyPrivacyNode privacyNode, final List tenants) { - map.put(privacyNode, tenants); - return this; - } - - public List getPrivacyNodes() { - return map.keySet().stream().collect(Collectors.toList()); - } - - public List getTenantsForNode(final MultiTenancyPrivacyNode privacyNode) { - return map.get(privacyNode); - } - - public List getTenants() { - return map.values().stream().flatMap(Collection::stream).collect(Collectors.toList()); - } - - public PrivacyNode getGroupCreatingPrivacyNode() { - return getPrivacyNodes().get(0).getPrivacyNode(); - } - - public String getGroupCreatingTenant() { - return getPrivacyNodes().get(0).getTenants().get(0); - } -} diff --git a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/multitenancy/MultiTenancyPrivacyNode.java b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/multitenancy/MultiTenancyPrivacyNode.java deleted file mode 100644 index 1126d440674..00000000000 --- a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/multitenancy/MultiTenancyPrivacyNode.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.privacy.multitenancy; - -import org.hyperledger.besu.tests.acceptance.dsl.privacy.PrivacyNode; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -public class MultiTenancyPrivacyNode { - - private final PrivacyNode privacyNode; - private final Map tenantToTokenMap; - - public MultiTenancyPrivacyNode(final PrivacyNode privacyNode) { - this.privacyNode = privacyNode; - this.tenantToTokenMap = new HashMap<>(); - } - - public MultiTenancyPrivacyNode addTenantWithToken(final String tenant, final String token) { - tenantToTokenMap.put(tenant, token); - return this; - } - - public List getTenants() { - return tenantToTokenMap.keySet().stream().collect(Collectors.toList()); - } - - public String getTokenForTenant(final String tenant) { - return tenantToTokenMap.get(tenant); - } - - public PrivacyNode getPrivacyNode() { - return privacyNode; - } -} diff --git a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/multitenancy/MultiTenancyPrivateNonceIncrementingTest.java b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/multitenancy/MultiTenancyPrivateNonceIncrementingTest.java deleted file mode 100644 index 11c405c37a8..00000000000 --- a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/multitenancy/MultiTenancyPrivateNonceIncrementingTest.java +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Copyright contributors to Hyperledger Besu. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.privacy.multitenancy; - -import static com.github.tomakehurst.wiremock.client.WireMock.ok; -import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options; -import static java.nio.charset.StandardCharsets.UTF_8; - -import org.hyperledger.besu.crypto.KeyPair; -import org.hyperledger.besu.crypto.SignatureAlgorithm; -import org.hyperledger.besu.crypto.SignatureAlgorithmFactory; -import org.hyperledger.besu.datatypes.Address; -import org.hyperledger.besu.datatypes.Hash; -import org.hyperledger.besu.datatypes.Wei; -import org.hyperledger.besu.enclave.types.PrivacyGroup; -import org.hyperledger.besu.enclave.types.ReceiveResponse; -import org.hyperledger.besu.enclave.types.SendResponse; -import org.hyperledger.besu.ethereum.privacy.PrivateTransaction; -import org.hyperledger.besu.ethereum.rlp.BytesValueRLPOutput; -import org.hyperledger.besu.plugin.data.Restriction; -import org.hyperledger.besu.tests.acceptance.dsl.AcceptanceTestBase; -import org.hyperledger.besu.tests.acceptance.dsl.node.BesuNode; -import org.hyperledger.besu.tests.acceptance.dsl.node.cluster.Cluster; -import org.hyperledger.besu.tests.acceptance.dsl.node.cluster.ClusterConfiguration; -import org.hyperledger.besu.tests.acceptance.dsl.node.cluster.ClusterConfigurationBuilder; - -import java.math.BigInteger; -import java.util.List; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.github.tomakehurst.wiremock.junit.WireMockRule; -import com.google.common.base.Supplier; -import com.google.common.base.Suppliers; -import org.apache.tuweni.bytes.Bytes; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; - -public class MultiTenancyPrivateNonceIncrementingTest extends AcceptanceTestBase { - private BesuNode node; - private final ObjectMapper mapper = new ObjectMapper(); - private Cluster multiTenancyCluster; - - private static final Supplier SIGNATURE_ALGORITHM = - Suppliers.memoize(SignatureAlgorithmFactory::getInstance); - private static final KeyPair TEST_KEY = - SIGNATURE_ALGORITHM - .get() - .createKeyPair( - SIGNATURE_ALGORITHM - .get() - .createPrivateKey( - new BigInteger( - "853d7f0010fd86d0d7811c1f9d968ea89a24484a8127b4a483ddf5d2cfec766d", 16))); - private static final String PRIVACY_GROUP_ID = "B1aVtMxLCUHmBVHXoZzzBgPbW/wj5axDpW9X8l91SGo="; - private static final String PARTICIPANT_ENCLAVE_KEY0 = - "A1aVtMxLCUHmBVHXoZzzBgPbW/wj5axDpW9X8l91SGo="; - private static final String PARTICIPANT_ENCLAVE_KEY1 = - "sgFkVOyFndZe/5SAZJO5UYbrl7pezHetveriBBWWnE8="; - private final Address senderAddress = - Address.wrap(Bytes.fromHexString(accounts.getPrimaryBenefactor().getAddress())); - - @Rule public WireMockRule wireMockRule = new WireMockRule(options().dynamicPort()); - - @Before - public void setUp() throws Exception { - final ClusterConfiguration clusterConfiguration = - new ClusterConfigurationBuilder().awaitPeerDiscovery(false).build(); - multiTenancyCluster = new Cluster(clusterConfiguration, net); - node = - besu.createNodeWithMultiTenantedPrivacy( - "node1", - "http://127.0.0.1:" + wireMockRule.port(), - "authentication/auth_priv.toml", - "authentication/auth_priv_key", - false, - true); - multiTenancyCluster.start(node); - final String token = - node.execute(permissioningTransactions.createSuccessfulLogin("user", "pegasys")); - node.useAuthenticationTokenInHeaderForJsonRpc(token); - } - - @After - public void tearDown() { - multiTenancyCluster.close(); - } - - @Test - public void validateUnsuccessfulPrivateTransactionsNonceIncrementation() - throws JsonProcessingException { - executePrivateFailingTransaction(0, 0, 1); - executePrivateValidTransaction(1, 1, 2); - executePrivateFailingTransaction(2, 2, 3); - executePrivateFailingTransaction(3, 3, 4); - executePrivateValidTransaction(4, 4, 5); - } - - private void executePrivateValidTransaction( - final int nonce, - final int expectedTransactionCountBeforeExecution, - final int expectedTransactionCountAfterExecution) - throws JsonProcessingException { - final PrivateTransaction validSignedPrivateTransaction = - getValidSignedPrivateTransaction(senderAddress, nonce); - - final String accountAddress = validSignedPrivateTransaction.getSender().toHexString(); - final BytesValueRLPOutput rlpOutput = getRLPOutput(validSignedPrivateTransaction); - - processEnclaveStub(validSignedPrivateTransaction); - - node.verify( - priv.getTransactionCount( - accountAddress, PRIVACY_GROUP_ID, expectedTransactionCountBeforeExecution)); - - final Hash transactionReceipt = - node.execute(privacyTransactions.sendRawTransaction(rlpOutput.encoded().toHexString())); - - node.verify(priv.getSuccessfulTransactionReceipt(transactionReceipt)); - node.verify( - priv.getTransactionCount( - accountAddress, PRIVACY_GROUP_ID, expectedTransactionCountAfterExecution)); - } - - private void executePrivateFailingTransaction( - final int nonce, - final int expectedTransactionCountBeforeExecution, - final int expectedTransactionCountAfterExecution) - throws JsonProcessingException { - final PrivateTransaction invalidSignedPrivateTransaction = - getInvalidSignedPrivateTransaction(senderAddress, nonce); - final String accountAddress = invalidSignedPrivateTransaction.getSender().toHexString(); - final BytesValueRLPOutput invalidTxRlp = getRLPOutput(invalidSignedPrivateTransaction); - - processEnclaveStub(invalidSignedPrivateTransaction); - - node.verify( - priv.getTransactionCount( - accountAddress, PRIVACY_GROUP_ID, expectedTransactionCountBeforeExecution)); - final Hash invalidTransactionReceipt = - node.execute(privacyTransactions.sendRawTransaction(invalidTxRlp.encoded().toHexString())); - - node.verify(priv.getFailedTransactionReceipt(invalidTransactionReceipt)); - node.verify( - priv.getTransactionCount( - accountAddress, PRIVACY_GROUP_ID, expectedTransactionCountAfterExecution)); - } - - private void processEnclaveStub(final PrivateTransaction validSignedPrivateTransaction) - throws JsonProcessingException { - retrievePrivacyGroupEnclaveStub(); - sendEnclaveStub(); - receiveEnclaveStub(validSignedPrivateTransaction); - } - - private void retrievePrivacyGroupEnclaveStub() throws JsonProcessingException { - final String retrieveGroupResponse = - mapper.writeValueAsString( - createPrivacyGroup( - List.of(PARTICIPANT_ENCLAVE_KEY0, PARTICIPANT_ENCLAVE_KEY1), - PrivacyGroup.Type.PANTHEON)); - stubFor(post("/retrievePrivacyGroup").willReturn(ok(retrieveGroupResponse))); - } - - private void sendEnclaveStub() throws JsonProcessingException { - final String sendResponse = - mapper.writeValueAsString(new SendResponse(PARTICIPANT_ENCLAVE_KEY1)); - stubFor(post("/send").willReturn(ok(sendResponse))); - } - - private void receiveEnclaveStub(final PrivateTransaction privTx) throws JsonProcessingException { - final BytesValueRLPOutput rlpOutput = getRLPOutput(privTx); - final String senderKey = privTx.getPrivateFrom().toBase64String(); - final String receiveResponse = - mapper.writeValueAsString( - new ReceiveResponse( - rlpOutput.encoded().toBase64String().getBytes(UTF_8), PRIVACY_GROUP_ID, senderKey)); - stubFor(post("/receive").willReturn(ok(receiveResponse))); - } - - private BytesValueRLPOutput getRLPOutput(final PrivateTransaction privateTransaction) { - final BytesValueRLPOutput bvrlpo = new BytesValueRLPOutput(); - privateTransaction.writeTo(bvrlpo); - return bvrlpo; - } - - private PrivacyGroup createPrivacyGroup( - final List groupMembers, final PrivacyGroup.Type groupType) { - return new PrivacyGroup(PRIVACY_GROUP_ID, groupType, "test", "testGroup", groupMembers); - } - - private static PrivateTransaction getInvalidSignedPrivateTransaction( - final Address senderAddress, final int nonce) { - return PrivateTransaction.builder() - .nonce(nonce) - .gasPrice(Wei.ZERO) - .gasLimit(3000000) - .to(null) - .value(Wei.ZERO) - .payload(Bytes.fromHexString("0x1234")) - .sender(senderAddress) - .chainId(BigInteger.valueOf(1337)) - .privateFrom(Bytes.fromBase64String(PARTICIPANT_ENCLAVE_KEY0)) - .restriction(Restriction.RESTRICTED) - .privacyGroupId(Bytes.fromBase64String(PRIVACY_GROUP_ID)) - .signAndBuild(TEST_KEY); - } - - private static PrivateTransaction getValidSignedPrivateTransaction( - final Address senderAddress, final int nonce) { - return PrivateTransaction.builder() - .nonce(nonce) - .gasPrice(Wei.ZERO) - .gasLimit(3000000) - .to(null) - .value(Wei.ZERO) - .payload(Bytes.wrap(new byte[] {})) - .sender(senderAddress) - .chainId(BigInteger.valueOf(1337)) - .privateFrom(Bytes.fromBase64String(PARTICIPANT_ENCLAVE_KEY0)) - .restriction(Restriction.RESTRICTED) - .privacyGroupId(Bytes.fromBase64String(PRIVACY_GROUP_ID)) - .signAndBuild(TEST_KEY); - } -} diff --git a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/multitenancy/MultiTenancyValidationFailAcceptanceTest.java b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/multitenancy/MultiTenancyValidationFailAcceptanceTest.java deleted file mode 100644 index 28bf140bb36..00000000000 --- a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/multitenancy/MultiTenancyValidationFailAcceptanceTest.java +++ /dev/null @@ -1,232 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.tests.acceptance.privacy.multitenancy; - -import static com.github.tomakehurst.wiremock.client.WireMock.ok; -import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options; -import static org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.RpcErrorType.DELETE_PRIVACY_GROUP_ERROR; -import static org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.RpcErrorType.ENCLAVE_ERROR; -import static org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.RpcErrorType.FIND_PRIVACY_GROUP_ERROR; -import static org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.RpcErrorType.GET_PRIVATE_TRANSACTION_NONCE_ERROR; -import static org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.RpcErrorType.PRIVATE_FROM_DOES_NOT_MATCH_ENCLAVE_PUBLIC_KEY; - -import org.hyperledger.besu.crypto.SignatureAlgorithm; -import org.hyperledger.besu.crypto.SignatureAlgorithmFactory; -import org.hyperledger.besu.datatypes.Address; -import org.hyperledger.besu.datatypes.Hash; -import org.hyperledger.besu.datatypes.Wei; -import org.hyperledger.besu.enclave.types.PrivacyGroup; -import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.RpcErrorType; -import org.hyperledger.besu.ethereum.privacy.PrivateTransaction; -import org.hyperledger.besu.ethereum.rlp.BytesValueRLPOutput; -import org.hyperledger.besu.plugin.data.Restriction; -import org.hyperledger.besu.tests.acceptance.dsl.AcceptanceTestBase; -import org.hyperledger.besu.tests.acceptance.dsl.node.BesuNode; -import org.hyperledger.besu.tests.acceptance.dsl.node.cluster.Cluster; -import org.hyperledger.besu.tests.acceptance.dsl.node.cluster.ClusterConfiguration; -import org.hyperledger.besu.tests.acceptance.dsl.node.cluster.ClusterConfigurationBuilder; -import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction; - -import java.math.BigInteger; -import java.util.List; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.github.tomakehurst.wiremock.junit.WireMockRule; -import org.apache.tuweni.bytes.Bytes; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; - -public class MultiTenancyValidationFailAcceptanceTest extends AcceptanceTestBase { - private BesuNode node; - private final ObjectMapper mapper = new ObjectMapper(); - private Cluster multiTenancyCluster; - - private static final String PRIVACY_GROUP_ID = "B1aVtMxLCUHmBVHXoZzzBgPbW/wj5axDpW9X8l91SGo="; - private static final String ENCLAVE_PUBLIC_KEY = "B1aVtMxLCUHmBVHXoZzzBgPbW/wj5axDpW9X8l91SGo="; - private static final String OTHER_ENCLAVE_PUBLIC_KEY = - "A1aVtMxLCUHmBVHXoZzzBgPbW/wj5axDpW9X8l91SGo="; - private final Address senderAddress = - Address.wrap(Bytes.fromHexString(accounts.getPrimaryBenefactor().getAddress())); - - @Rule public WireMockRule wireMockRule = new WireMockRule(options().dynamicPort()); - - @Before - public void setUp() throws Exception { - final ClusterConfiguration clusterConfiguration = - new ClusterConfigurationBuilder().awaitPeerDiscovery(false).build(); - multiTenancyCluster = new Cluster(clusterConfiguration, net); - node = - besu.createNodeWithMultiTenantedPrivacy( - "node1", - "http://127.0.0.1:" + wireMockRule.port(), - "authentication/auth_priv.toml", - "authentication/auth_priv_key", - false, - false); - multiTenancyCluster.start(node); - - final String token = - node.execute(permissioningTransactions.createSuccessfulLogin("failUser", "pegasys")); - node.useAuthenticationTokenInHeaderForJsonRpc(token); - } - - @After - public void tearDown() { - multiTenancyCluster.close(); - } - - @Test - public void sendRawTransactionShouldFailWhenPrivateFromNotMatchEnclaveKey() - throws JsonProcessingException { - final PrivateTransaction validSignedPrivateTransaction = - getValidSignedPrivateTransaction(senderAddress, OTHER_ENCLAVE_PUBLIC_KEY); - retrievePrivacyGroupEnclaveStub(); - final Transaction transaction = - privacyTransactions.sendRawTransaction( - getRLPOutput(validSignedPrivateTransaction).encoded().toHexString()); - node.verify( - priv.multiTenancyValidationFail( - transaction, RpcErrorType.PRIVATE_FROM_DOES_NOT_MATCH_ENCLAVE_PUBLIC_KEY)); - } - - @Test - public void sendRawTransactionShouldFailWhenPrivacyGroupDoesNotContainEnclaveKey() - throws JsonProcessingException { - final PrivateTransaction validSignedPrivateTransaction = - getValidSignedPrivateTransaction(senderAddress, ENCLAVE_PUBLIC_KEY); - retrievePrivacyGroupEnclaveStub(); - final Transaction transaction = - privacyTransactions.sendRawTransaction( - getRLPOutput(validSignedPrivateTransaction).encoded().toHexString()); - node.verify(priv.multiTenancyValidationFail(transaction, ENCLAVE_ERROR)); - } - - @Test - public void distributeRawTransactionShouldFailWhenPrivateFromNotMatchEnclaveKey() { - final Address senderAddress = - Address.wrap(Bytes.fromHexString(accounts.getPrimaryBenefactor().getAddress())); - - final Transaction transaction = - privacyTransactions.distributeRawTransaction( - getRLPOutput(getValidSignedPrivateTransaction(senderAddress, OTHER_ENCLAVE_PUBLIC_KEY)) - .encoded() - .toHexString()); - node.verify( - priv.multiTenancyValidationFail( - transaction, PRIVATE_FROM_DOES_NOT_MATCH_ENCLAVE_PUBLIC_KEY)); - } - - @Test - public void distributeRawTransactionShouldFailWhenPrivacyGroupDoesNotContainEnclaveKey() - throws JsonProcessingException { - final Address senderAddress = - Address.wrap(Bytes.fromHexString(accounts.getPrimaryBenefactor().getAddress())); - - retrievePrivacyGroupEnclaveStub(); - - final Transaction transaction = - privacyTransactions.distributeRawTransaction( - getRLPOutput(getValidSignedPrivateTransaction(senderAddress, ENCLAVE_PUBLIC_KEY)) - .encoded() - .toHexString()); - node.verify(priv.multiTenancyValidationFail(transaction, ENCLAVE_ERROR)); - } - - @Test - public void deletePrivacyGroupShouldFailWhenEnclaveKeyNotInPrivacyGroup() - throws JsonProcessingException { - retrievePrivacyGroupEnclaveStub(); - final Transaction transaction = - privacyTransactions.deletePrivacyGroup(PRIVACY_GROUP_ID); - node.verify(priv.multiTenancyValidationFail(transaction, DELETE_PRIVACY_GROUP_ERROR)); - } - - @Test - public void findPrivacyGroupShouldFailWhenEnclaveKeyNotInPrivacyGroup() { - final Transaction transaction = - privacyTransactions.findPrivacyGroup(new String[] {OTHER_ENCLAVE_PUBLIC_KEY}); - node.verify(priv.multiTenancyValidationFail(transaction, FIND_PRIVACY_GROUP_ERROR)); - } - - @Test - public void determineEeaNonceShouldFailWhenPrivateFromNotMatchEnclaveKey() { - final String accountAddress = Address.ZERO.toHexString(); - final String senderAddressBase64 = Bytes.fromHexString(accountAddress).toBase64String(); - final String[] privateFor = {senderAddressBase64}; - final Transaction transaction = - privacyTransactions.getEeaTransactionCount( - accountAddress, OTHER_ENCLAVE_PUBLIC_KEY, privateFor); - node.verify( - priv.multiTenancyValidationFail( - transaction, PRIVATE_FROM_DOES_NOT_MATCH_ENCLAVE_PUBLIC_KEY)); - } - - @Test - public void determineBesuNonceShouldFailWhenEnclaveKeyNotInPrivacyGroup() - throws JsonProcessingException { - retrievePrivacyGroupEnclaveStub(); - final String accountAddress = Address.ZERO.toHexString(); - final Transaction transaction = - privacyTransactions.getTransactionCount(accountAddress, PRIVACY_GROUP_ID); - node.verify(priv.multiTenancyValidationFail(transaction, GET_PRIVATE_TRANSACTION_NONCE_ERROR)); - } - - private void retrievePrivacyGroupEnclaveStub() throws JsonProcessingException { - final String retrieveGroupResponse = - mapper.writeValueAsString( - testPrivacyGroup(List.of(OTHER_ENCLAVE_PUBLIC_KEY), PrivacyGroup.Type.PANTHEON)); - stubFor(post("/retrievePrivacyGroup").willReturn(ok(retrieveGroupResponse))); - } - - private PrivacyGroup testPrivacyGroup( - final List groupMembers, final PrivacyGroup.Type groupType) { - return new PrivacyGroup(PRIVACY_GROUP_ID, groupType, "test", "testGroup", groupMembers); - } - - private BytesValueRLPOutput getRLPOutput(final PrivateTransaction validSignedPrivateTransaction) { - final BytesValueRLPOutput bvrlpo = new BytesValueRLPOutput(); - validSignedPrivateTransaction.writeTo(bvrlpo); - return bvrlpo; - } - - private static PrivateTransaction getValidSignedPrivateTransaction( - final Address senderAddress, final String privateFrom) { - - final SignatureAlgorithm signatureAlgorithm = SignatureAlgorithmFactory.getInstance(); - - return PrivateTransaction.builder() - .nonce(0) - .gasPrice(Wei.ZERO) - .gasLimit(3000000) - .to(null) - .value(Wei.ZERO) - .payload(Bytes.wrap(new byte[] {})) - .sender(senderAddress) - .chainId(BigInteger.valueOf(2018)) - .privateFrom(Bytes.fromBase64String(privateFrom)) - .restriction(Restriction.RESTRICTED) - .privacyGroupId(Bytes.fromBase64String(PRIVACY_GROUP_ID)) - .signAndBuild( - signatureAlgorithm.createKeyPair( - signatureAlgorithm.createPrivateKey( - new BigInteger( - "853d7f0010fd86d0d7811c1f9d968ea89a24484a8127b4a483ddf5d2cfec766d", 16)))); - } -} From e0cd5084c7787a21c53e27f8591511887c84bf6b Mon Sep 17 00:00:00 2001 From: Luis Pinto Date: Thu, 12 Sep 2024 12:56:54 +0100 Subject: [PATCH 05/47] Change test to tease NPEs during DefaultBlockchain.() caused by initilization order (#7607) * Change test to tease NPEs during DefaultBlockchain.() caused by initilization order * fixup! Change test to tease NPEs during DefaultBlockchain.() caused by initilization order * move counters into their own method Signed-off-by: Luis Pinto --- CHANGELOG.md | 1 + .../ethereum/chain/DefaultBlockchain.java | 32 +++++++++------ .../ethereum/chain/DefaultBlockchainTest.java | 41 ++++++++++++------- 3 files changed, 47 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ea4ced222a..c38c30a4216 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ - Layered txpool: do not send notifications when moving tx between layers [#7539](https://github.com/hyperledger/besu/pull/7539) - Layered txpool: fix for unsent drop notifications on remove [#7538](https://github.com/hyperledger/besu/pull/7538) - Honor block number or tag parameter in eth_estimateGas and eth_createAccessList [#7502](https://github.com/hyperledger/besu/pull/7502) +- Fixed NPE during DefaultBlockchain object initialization [#7601](https://github.com/hyperledger/besu/pull/7601) ## 24.9.0 diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/chain/DefaultBlockchain.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/chain/DefaultBlockchain.java index b2b4e6abfc8..bce94a19153 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/chain/DefaultBlockchain.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/chain/DefaultBlockchain.java @@ -31,6 +31,7 @@ import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.core.TransactionReceipt; import org.hyperledger.besu.metrics.BesuMetricCategory; +import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem; import org.hyperledger.besu.metrics.prometheus.PrometheusMetricsSystem; import org.hyperledger.besu.plugin.services.MetricsSystem; import org.hyperledger.besu.plugin.services.metrics.Counter; @@ -84,8 +85,8 @@ public class DefaultBlockchain implements MutableBlockchain { private final Optional>> transactionReceiptsCache; private final Optional> totalDifficultyCache; - private final Counter gasUsedCounter; - private final Counter numberOfTransactionsCounter; + private Counter gasUsedCounter = NoOpMetricsSystem.NO_OP_COUNTER; + private Counter numberOfTransactionsCounter = NoOpMetricsSystem.NO_OP_COUNTER; private DefaultBlockchain( final Optional genesisBlock, @@ -147,6 +148,23 @@ private DefaultBlockchain( totalDifficultyCache = Optional.empty(); } + createCounters(metricsSystem); + createGauges(metricsSystem); + } + + private void createCounters(final MetricsSystem metricsSystem) { + gasUsedCounter = + metricsSystem.createCounter( + BesuMetricCategory.BLOCKCHAIN, "chain_head_gas_used_counter", "Counter for Gas used"); + + numberOfTransactionsCounter = + metricsSystem.createCounter( + BesuMetricCategory.BLOCKCHAIN, + "chain_head_transaction_count_counter", + "Counter for the number of transactions"); + } + + private void createGauges(final MetricsSystem metricsSystem) { metricsSystem.createLongGauge( BesuMetricCategory.ETHEREUM, "blockchain_height", @@ -183,10 +201,6 @@ private DefaultBlockchain( "Gas used by the current chain head block", () -> getChainHeadHeader().getGasUsed()); - gasUsedCounter = - metricsSystem.createCounter( - BesuMetricCategory.BLOCKCHAIN, "chain_head_gas_used_counter", "Counter for Gas used"); - metricsSystem.createLongGauge( BesuMetricCategory.BLOCKCHAIN, "chain_head_gas_limit", @@ -199,12 +213,6 @@ private DefaultBlockchain( "Number of transactions in the current chain head block", () -> chainHeadTransactionCount); - numberOfTransactionsCounter = - metricsSystem.createCounter( - BesuMetricCategory.BLOCKCHAIN, - "chain_head_transaction_count_counter", - "Counter for the number of transactions"); - metricsSystem.createIntegerGauge( BesuMetricCategory.BLOCKCHAIN, "chain_head_ommer_count", diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/chain/DefaultBlockchainTest.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/chain/DefaultBlockchainTest.java index 69fbfcdbd65..7ad1d82bfd2 100644 --- a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/chain/DefaultBlockchainTest.java +++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/chain/DefaultBlockchainTest.java @@ -35,8 +35,10 @@ import org.hyperledger.besu.plugin.services.storage.KeyValueStorage; import org.hyperledger.besu.services.kvstore.InMemoryKeyValueStorage; +import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Collections; +import java.util.Iterator; import java.util.List; import java.util.Optional; import java.util.Set; @@ -161,33 +163,42 @@ public void initializeReadOnly_withGiantDifficultyAndLiveMetrics() { () -> BlockOptions.create().setDifficulty(Difficulty.of(Long.MAX_VALUE))); final KeyValueStorage kvStore = new InMemoryKeyValueStorage(); final KeyValueStorage kvStoreVariables = new InMemoryKeyValueStorage(); - final List blocks = gen.blockSequence(10); + final ArrayDeque blocks = new ArrayDeque<>(gen.blockSequence(10)); final List> blockReceipts = new ArrayList<>(blocks.size()); blockReceipts.add(Collections.emptyList()); // Write small chain to storage final MutableBlockchain mutableBlockchain = - createMutableBlockchain(kvStore, kvStoreVariables, blocks.get(0)); - for (int i = 1; i < blocks.size(); i++) { - final Block block = blocks.get(i); - final List receipts = gen.receipts(block); - blockReceipts.add(receipts); - mutableBlockchain.appendBlock(block, receipts); - } + createMutableBlockchain(kvStore, kvStoreVariables, blocks.getFirst()); + blocks.stream() + .filter(block -> !block.equals(blocks.getFirst())) + .forEach( + block -> { + final List receipts = gen.receipts(block); + blockReceipts.add(receipts); + mutableBlockchain.appendBlock(block, receipts); + }); + + // To make sure there are no surprising NPEs during DefaultBlockchain. + BlockchainStorage blockchainStorage = createStorage(kvStore, kvStoreVariables); + BlockchainStorage.Updater updater = blockchainStorage.updater(); + updater.setFinalized(blocks.getLast().getHash()); + updater.setSafeBlock(blocks.getLast().getHash()); + updater.setChainHead(blocks.getLast().getHash()); + updater.commit(); // Create read only chain final Blockchain blockchain = DefaultBlockchain.create( - createStorage(kvStore, kvStoreVariables), + blockchainStorage, MetricsSystemFactory.create(MetricsConfiguration.builder().enabled(true).build()), 0); - for (int i = 0; i < blocks.size(); i++) { - assertBlockDataIsStored(blockchain, blocks.get(i), blockReceipts.get(i)); - } - final Block lastBlock = blocks.get(blocks.size() - 1); - assertBlockIsHead(blockchain, lastBlock); - assertTotalDifficultiesAreConsistent(blockchain, lastBlock); + assertThat(blockReceipts.size()).isEqualTo(blocks.size()); + Iterator> it = blockReceipts.iterator(); + blocks.forEach(block -> assertBlockDataIsStored(blockchain, block, it.next())); + assertBlockIsHead(blockchain, blocks.getLast()); + assertTotalDifficultiesAreConsistent(blockchain, blocks.getLast()); } @Test From 31c174b0c6fddca44033b4d6c7f1a53395bfe7a3 Mon Sep 17 00:00:00 2001 From: Fabio Di Fabio Date: Fri, 13 Sep 2024 12:43:08 +0200 Subject: [PATCH 06/47] Revert "Re-enable TxPoolOptionsTest::txpoolForcePriceBumpToZeroWhenZeroBaseFeeMarket (#7565)" (#7613) This reverts commit 07adb415eec5341fe22442ac9938e7f7b8a9de11. Signed-off-by: Fabio Di Fabio --- .../test/java/org/hyperledger/besu/cli/TxPoolOptionsTest.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/besu/src/test/java/org/hyperledger/besu/cli/TxPoolOptionsTest.java b/besu/src/test/java/org/hyperledger/besu/cli/TxPoolOptionsTest.java index a5ca07484a0..8389ab5bae8 100644 --- a/besu/src/test/java/org/hyperledger/besu/cli/TxPoolOptionsTest.java +++ b/besu/src/test/java/org/hyperledger/besu/cli/TxPoolOptionsTest.java @@ -30,6 +30,7 @@ import java.nio.file.Files; import java.nio.file.Path; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; public class TxPoolOptionsTest extends CommandTestAbstract { @@ -97,6 +98,7 @@ public void txpoolSaveFileAbsolutePathOutsideDataPath() throws IOException { } @Test + @Disabled // Failing in CI, but not locally public void txpoolForcePriceBumpToZeroWhenZeroBaseFeeMarket() throws IOException { final Path genesisFile = createFakeGenesisFile(GENESIS_WITH_ZERO_BASE_FEE_MARKET); parseCommand("--genesis-file", genesisFile.toString()); From 5df2a71a4db886444ed458938e58ea6705e3d49c Mon Sep 17 00:00:00 2001 From: Suyash Nayan <89125422+7suyash7@users.noreply.github.com> Date: Fri, 13 Sep 2024 19:05:34 +0530 Subject: [PATCH 07/47] Fix debug_traceCall to handle underpriced transactions (#7510) * Fix debug_traceCall to handle underpriced transactions Signed-off-by: 7suyash7 * remove unused methods Signed-off-by: 7suyash7 * Add test case and changelog entry for debug_traceCall fix Signed-off-by: 7suyash7 --------- Signed-off-by: 7suyash7 Signed-off-by: Fabio Di Fabio Co-authored-by: Fabio Di Fabio --- CHANGELOG.md | 3 +- .../internal/methods/DebugTraceCall.java | 16 ++++--- .../debug_traceCall_noGasPrice.json | 42 +++++++++++++++++++ 3 files changed, 54 insertions(+), 7 deletions(-) create mode 100644 ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-call/debug_traceCall_noGasPrice.json diff --git a/CHANGELOG.md b/CHANGELOG.md index c38c30a4216..1da225c56c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,8 +9,8 @@ ### Additions and Improvements - Remove privacy test classes support [#7569](https://github.com/hyperledger/besu/pull/7569) - ### Bug fixes +- Fix for `debug_traceCall` to handle transactions without specified gas price. [#7510](https://github.com/hyperledger/besu/pull/7510) ## 24.9.1 @@ -50,7 +50,6 @@ This release version has been deprecated release due to CI bug - ## 24.8.0 ### Upcoming Breaking Changes diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceCall.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceCall.java index e808e79ddc3..45b06ce6910 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceCall.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceCall.java @@ -29,18 +29,16 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.DebugTraceTransactionResult; import org.hyperledger.besu.ethereum.api.query.BlockchainQueries; import org.hyperledger.besu.ethereum.debug.TraceOptions; +import org.hyperledger.besu.ethereum.mainnet.ImmutableTransactionValidationParams; import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule; +import org.hyperledger.besu.ethereum.mainnet.TransactionValidationParams; import org.hyperledger.besu.ethereum.transaction.PreCloseStateHandler; import org.hyperledger.besu.ethereum.transaction.TransactionSimulator; import org.hyperledger.besu.ethereum.vm.DebugOperationTracer; import java.util.Optional; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - public class DebugTraceCall extends AbstractTraceCall { - private static final Logger LOG = LoggerFactory.getLogger(DebugTraceCall.class); public DebugTraceCall( final BlockchainQueries blockchainQueries, @@ -89,7 +87,6 @@ protected PreCloseStateHandler getSimulatorResultHandler( maybeSimulatorResult.map( result -> { if (result.isInvalid()) { - LOG.error("Invalid simulator result {}", result); final JsonRpcError error = new JsonRpcError( INTERNAL_ERROR, result.getValidationResult().getErrorMessage()); @@ -103,4 +100,13 @@ protected PreCloseStateHandler getSimulatorResultHandler( return new DebugTraceTransactionResult(transactionTrace); }); } + + @Override + protected TransactionValidationParams buildTransactionValidationParams() { + return ImmutableTransactionValidationParams.builder() + .from(TransactionValidationParams.transactionSimulator()) + .isAllowExceedingBalance(true) + .allowUnderpriced(true) + .build(); + } } diff --git a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-call/debug_traceCall_noGasPrice.json b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-call/debug_traceCall_noGasPrice.json new file mode 100644 index 00000000000..18fe53baa16 --- /dev/null +++ b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-call/debug_traceCall_noGasPrice.json @@ -0,0 +1,42 @@ +{ + "request": { + "jsonrpc": "2.0", + "method": "debug_traceCall", + "params": [ + { + "to": "0x0aae40965e6800cd9b1f4b05ff21581047e3f91e", + "data": "0x000000000000000000000000000000000000000000000000000000000001A00E" + }, + "latest", + { + "disableMemory": true, + "disableStack": true, + "disableStorage": true + } + ], + "id": 1 + }, + "response": { + "jsonrpc": "2.0", + "id": 1, + "result": { + "gas": 21164, + "failed": false, + "returnValue": "", + "structLogs": [ + { + "pc": 0, + "op": "STOP", + "gas": 17592186023252, + "gasCost": 0, + "depth": 1, + "stack": null, + "memory": null, + "storage": null, + "reason": null + } + ] + } + }, + "statusCode": 200 +} \ No newline at end of file From 87bad72b52da257c430039562aed2bcc2e1302f0 Mon Sep 17 00:00:00 2001 From: Sally MacFarlane Date: Mon, 16 Sep 2024 11:17:09 +1000 Subject: [PATCH 08/47] removed hyperledger from discord refs (#7618) Signed-off-by: Sally MacFarlane --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d54b6bb329f..cd4930fc76b 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Besu is an Apache 2.0 licensed, MainNet compatible, Ethereum client written in J Besu issues are tracked [in the github issues tab][Besu Issues]. See our [guidelines](https://wiki.hyperledger.org/display/BESU/Issues) for more details on searching and creating issues. -If you have any questions, queries or comments, [Besu channel on Hyperledger Discord] is the place to find us. +If you have any questions, queries or comments, [Besu channel on Discord] is the place to find us. ## Besu Users @@ -68,5 +68,5 @@ and YourKit YouMonitor. [Besu Issues]: https://github.com/hyperledger/besu/issues [Besu User Documentation]: https://besu.hyperledger.org -[Besu channel on Hyperledger Discord]: https://discord.gg/hyperledger +[Besu channel on Discord]: https://discord.gg/hyperledger [Contributing Guidelines]: CONTRIBUTING.md From 12caf7d83c6a6fec90ccbb444a1d76b4c7e38d80 Mon Sep 17 00:00:00 2001 From: ITStarMan100 Date: Mon, 16 Sep 2024 02:31:05 +0000 Subject: [PATCH 09/47] Added GraphQL Service Information in responese result NetServices (#7580) Signed-off-by: ITStarMan100 Co-authored-by: Justin Florentine Co-authored-by: Sally MacFarlane --- .../java/org/hyperledger/besu/RunnerBuilder.java | 7 +++++++ .../api/jsonrpc/JsonRpcTestMethodsFactory.java | 4 ++++ .../api/jsonrpc/internal/methods/NetServices.java | 11 ++++++++++- .../api/jsonrpc/methods/JsonRpcMethodsFactory.java | 5 ++++- .../api/jsonrpc/methods/NetJsonRpcMethods.java | 12 ++++++++++-- .../api/jsonrpc/AbstractJsonRpcHttpServiceTest.java | 2 ++ .../jsonrpc/JsonRpcHttpServiceHostAllowlistTest.java | 2 ++ .../api/jsonrpc/JsonRpcHttpServiceLoginTest.java | 2 ++ .../api/jsonrpc/JsonRpcHttpServiceRpcApisTest.java | 3 +++ .../api/jsonrpc/JsonRpcHttpServiceTestBase.java | 2 ++ .../jsonrpc/JsonRpcHttpServiceTlsClientAuthTest.java | 2 ++ .../JsonRpcHttpServiceTlsMisconfigurationTest.java | 2 ++ .../api/jsonrpc/JsonRpcHttpServiceTlsTest.java | 2 ++ .../jsonrpc/websocket/WebSocketServiceLoginTest.java | 2 ++ 14 files changed, 54 insertions(+), 4 deletions(-) diff --git a/besu/src/main/java/org/hyperledger/besu/RunnerBuilder.java b/besu/src/main/java/org/hyperledger/besu/RunnerBuilder.java index 39e4356a7f3..96eef547fed 100644 --- a/besu/src/main/java/org/hyperledger/besu/RunnerBuilder.java +++ b/besu/src/main/java/org/hyperledger/besu/RunnerBuilder.java @@ -863,6 +863,7 @@ public Runner build() { jsonRpcConfiguration, webSocketConfiguration, metricsConfiguration, + graphQLConfiguration, natService, besuPluginContext.getNamedPlugins(), dataDir, @@ -907,6 +908,7 @@ public Runner build() { engineJsonRpcConfiguration.get(), webSocketConfiguration, metricsConfiguration, + graphQLConfiguration, natService, besuPluginContext.getNamedPlugins(), dataDir, @@ -1001,6 +1003,7 @@ public Runner build() { jsonRpcConfiguration, webSocketConfiguration, metricsConfiguration, + graphQLConfiguration, natService, besuPluginContext.getNamedPlugins(), dataDir, @@ -1081,6 +1084,7 @@ public Runner build() { jsonRpcConfiguration, webSocketConfiguration, metricsConfiguration, + graphQLConfiguration, natService, besuPluginContext.getNamedPlugins(), dataDir, @@ -1119,6 +1123,7 @@ public Runner build() { jsonRpcConfiguration, webSocketConfiguration, metricsConfiguration, + graphQLConfiguration, natService, besuPluginContext.getNamedPlugins(), dataDir, @@ -1280,6 +1285,7 @@ private Map jsonRpcMethods( final JsonRpcConfiguration jsonRpcConfiguration, final WebSocketConfiguration webSocketConfiguration, final MetricsConfiguration metricsConfiguration, + final GraphQLConfiguration graphQLConfiguration, final NatService natService, final Map namedPlugins, final Path dataDir, @@ -1313,6 +1319,7 @@ private Map jsonRpcMethods( jsonRpcConfiguration, webSocketConfiguration, metricsConfiguration, + graphQLConfiguration, natService, namedPlugins, dataDir, diff --git a/ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcTestMethodsFactory.java b/ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcTestMethodsFactory.java index b5f65e6d4b5..538060a905b 100644 --- a/ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcTestMethodsFactory.java +++ b/ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcTestMethodsFactory.java @@ -21,6 +21,7 @@ import org.hyperledger.besu.config.StubGenesisConfigOptions; import org.hyperledger.besu.ethereum.ProtocolContext; import org.hyperledger.besu.ethereum.api.ImmutableApiConfiguration; +import org.hyperledger.besu.ethereum.api.graphql.GraphQLConfiguration; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.filter.FilterManager; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.filter.FilterManagerBuilder; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.JsonRpcMethod; @@ -164,6 +165,8 @@ public Map methods() { final JsonRpcConfiguration jsonRpcConfiguration = mock(JsonRpcConfiguration.class); final WebSocketConfiguration webSocketConfiguration = mock(WebSocketConfiguration.class); final MetricsConfiguration metricsConfiguration = mock(MetricsConfiguration.class); + final GraphQLConfiguration graphQLConfiguration = mock(GraphQLConfiguration.class); + final NatService natService = new NatService(Optional.empty()); final List apis = new ArrayList<>(); @@ -200,6 +203,7 @@ public Map methods() { jsonRpcConfiguration, webSocketConfiguration, metricsConfiguration, + graphQLConfiguration, natService, new HashMap<>(), dataDir, diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/NetServices.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/NetServices.java index 335a74846f2..fbc3a88574a 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/NetServices.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/NetServices.java @@ -14,6 +14,7 @@ */ package org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods; +import org.hyperledger.besu.ethereum.api.graphql.GraphQLConfiguration; import org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcConfiguration; import org.hyperledger.besu.ethereum.api.jsonrpc.RpcMethod; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.JsonRpcRequestContext; @@ -32,16 +33,19 @@ public class NetServices implements JsonRpcMethod { private final WebSocketConfiguration webSocketConfiguration; private final P2PNetwork p2pNetwork; private final MetricsConfiguration metricsConfiguration; + private final GraphQLConfiguration graphQLConfiguration; public NetServices( final JsonRpcConfiguration jsonRpcConfiguration, final WebSocketConfiguration webSocketConfiguration, final P2PNetwork p2pNetwork, - final MetricsConfiguration metricsConfiguration) { + final MetricsConfiguration metricsConfiguration, + final GraphQLConfiguration graphQLConfiguration) { this.jsonRpcConfiguration = jsonRpcConfiguration; this.webSocketConfiguration = webSocketConfiguration; this.p2pNetwork = p2pNetwork; this.metricsConfiguration = metricsConfiguration; + this.graphQLConfiguration = graphQLConfiguration; } @Override @@ -82,6 +86,11 @@ public JsonRpcResponse response(final JsonRpcRequestContext requestContext) { createServiceDetailsMap( metricsConfiguration.getHost(), metricsConfiguration.getActualPort())); } + if (graphQLConfiguration.isEnabled()) { + servicesMapBuilder.put( + "graphQL", + createServiceDetailsMap(graphQLConfiguration.getHost(), graphQLConfiguration.getPort())); + } return new JsonRpcSuccessResponse( requestContext.getRequest().getId(), servicesMapBuilder.build()); diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/JsonRpcMethodsFactory.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/JsonRpcMethodsFactory.java index 55d9ef60292..cdf4440bde9 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/JsonRpcMethodsFactory.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/JsonRpcMethodsFactory.java @@ -17,6 +17,7 @@ import org.hyperledger.besu.config.GenesisConfigOptions; import org.hyperledger.besu.ethereum.ProtocolContext; import org.hyperledger.besu.ethereum.api.ApiConfiguration; +import org.hyperledger.besu.ethereum.api.graphql.GraphQLConfiguration; import org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcConfiguration; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.filter.FilterManager; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.JsonRpcMethod; @@ -77,6 +78,7 @@ public Map methods( final JsonRpcConfiguration jsonRpcConfiguration, final WebSocketConfiguration webSocketConfiguration, final MetricsConfiguration metricsConfiguration, + final GraphQLConfiguration graphQLConfiguration, final NatService natService, final Map namedPlugins, final Path dataDir, @@ -135,7 +137,8 @@ public Map methods( networkId, jsonRpcConfiguration, webSocketConfiguration, - metricsConfiguration), + metricsConfiguration, + graphQLConfiguration), new MinerJsonRpcMethods(miningParameters, miningCoordinator), new PermJsonRpcMethods(accountsAllowlistController, nodeAllowlistController), new PrivJsonRpcMethods( diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/NetJsonRpcMethods.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/NetJsonRpcMethods.java index a3fcc318cf7..9ccfc81fedf 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/NetJsonRpcMethods.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/NetJsonRpcMethods.java @@ -14,6 +14,7 @@ */ package org.hyperledger.besu.ethereum.api.jsonrpc.methods; +import org.hyperledger.besu.ethereum.api.graphql.GraphQLConfiguration; import org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcConfiguration; import org.hyperledger.besu.ethereum.api.jsonrpc.RpcApis; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.JsonRpcMethod; @@ -37,18 +38,21 @@ public class NetJsonRpcMethods extends ApiGroupJsonRpcMethods { private final JsonRpcConfiguration jsonRpcConfiguration; private final WebSocketConfiguration webSocketConfiguration; private final MetricsConfiguration metricsConfiguration; + private final GraphQLConfiguration graphQLConfiguration; public NetJsonRpcMethods( final P2PNetwork p2pNetwork, final BigInteger networkId, final JsonRpcConfiguration jsonRpcConfiguration, final WebSocketConfiguration webSocketConfiguration, - final MetricsConfiguration metricsConfiguration) { + final MetricsConfiguration metricsConfiguration, + final GraphQLConfiguration graphQLConfiguration) { this.p2pNetwork = p2pNetwork; this.networkId = networkId; this.jsonRpcConfiguration = jsonRpcConfiguration; this.webSocketConfiguration = webSocketConfiguration; this.metricsConfiguration = metricsConfiguration; + this.graphQLConfiguration = graphQLConfiguration; } @Override @@ -64,6 +68,10 @@ protected Map create() { new NetPeerCount(p2pNetwork), new NetEnode(p2pNetwork), new NetServices( - jsonRpcConfiguration, webSocketConfiguration, p2pNetwork, metricsConfiguration)); + jsonRpcConfiguration, + webSocketConfiguration, + p2pNetwork, + metricsConfiguration, + graphQLConfiguration)); } } diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/AbstractJsonRpcHttpServiceTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/AbstractJsonRpcHttpServiceTest.java index 862e17b890c..d504e3bb0d4 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/AbstractJsonRpcHttpServiceTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/AbstractJsonRpcHttpServiceTest.java @@ -23,6 +23,7 @@ import org.hyperledger.besu.config.StubGenesisConfigOptions; import org.hyperledger.besu.ethereum.ProtocolContext; import org.hyperledger.besu.ethereum.api.ApiConfiguration; +import org.hyperledger.besu.ethereum.api.graphql.GraphQLConfiguration; import org.hyperledger.besu.ethereum.api.jsonrpc.health.HealthService; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.filter.FilterIdGenerator; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.filter.FilterManager; @@ -193,6 +194,7 @@ protected Map getRpcMethods( config, mock(WebSocketConfiguration.class), mock(MetricsConfiguration.class), + mock(GraphQLConfiguration.class), natService, new HashMap<>(), folder, diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceHostAllowlistTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceHostAllowlistTest.java index 25077bbf82f..022aa244220 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceHostAllowlistTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceHostAllowlistTest.java @@ -21,6 +21,7 @@ import org.hyperledger.besu.config.StubGenesisConfigOptions; import org.hyperledger.besu.ethereum.ProtocolContext; import org.hyperledger.besu.ethereum.api.ApiConfiguration; +import org.hyperledger.besu.ethereum.api.graphql.GraphQLConfiguration; import org.hyperledger.besu.ethereum.api.jsonrpc.health.HealthService; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.filter.FilterManager; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.JsonRpcMethod; @@ -130,6 +131,7 @@ public void initServerAndClient() throws Exception { mock(JsonRpcConfiguration.class), mock(WebSocketConfiguration.class), mock(MetricsConfiguration.class), + mock(GraphQLConfiguration.class), natService, new HashMap<>(), folder, diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceLoginTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceLoginTest.java index eb23b054d07..f9dba0bc260 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceLoginTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceLoginTest.java @@ -23,6 +23,7 @@ import org.hyperledger.besu.config.StubGenesisConfigOptions; import org.hyperledger.besu.ethereum.ProtocolContext; import org.hyperledger.besu.ethereum.api.ApiConfiguration; +import org.hyperledger.besu.ethereum.api.graphql.GraphQLConfiguration; import org.hyperledger.besu.ethereum.api.jsonrpc.health.HealthService; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.filter.FilterManager; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.EthAccounts; @@ -161,6 +162,7 @@ public static void initServerAndClient() throws Exception { mock(JsonRpcConfiguration.class), mock(WebSocketConfiguration.class), mock(MetricsConfiguration.class), + mock(GraphQLConfiguration.class), natService, new HashMap<>(), folder, diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceRpcApisTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceRpcApisTest.java index f35893490ae..63ae1b8bfb2 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceRpcApisTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceRpcApisTest.java @@ -24,6 +24,7 @@ import org.hyperledger.besu.datatypes.Hash; import org.hyperledger.besu.ethereum.ProtocolContext; import org.hyperledger.besu.ethereum.api.ApiConfiguration; +import org.hyperledger.besu.ethereum.api.graphql.GraphQLConfiguration; import org.hyperledger.besu.ethereum.api.jsonrpc.health.HealthService; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.filter.FilterManager; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.JsonRpcMethod; @@ -227,6 +228,7 @@ private JsonRpcHttpService createJsonRpcHttpServiceWithRpcApis(final JsonRpcConf mock(JsonRpcConfiguration.class), mock(WebSocketConfiguration.class), mock(MetricsConfiguration.class), + mock(GraphQLConfiguration.class), natService, new HashMap<>(), folder, @@ -337,6 +339,7 @@ private JsonRpcHttpService createJsonRpcHttpService( jsonRpcConfiguration, webSocketConfiguration, metricsConfiguration, + mock(GraphQLConfiguration.class), natService, new HashMap<>(), folder, diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTestBase.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTestBase.java index 5e5dc36bb01..5a439fa1947 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTestBase.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTestBase.java @@ -19,6 +19,7 @@ import org.hyperledger.besu.config.StubGenesisConfigOptions; import org.hyperledger.besu.ethereum.ProtocolContext; import org.hyperledger.besu.ethereum.api.ApiConfiguration; +import org.hyperledger.besu.ethereum.api.graphql.GraphQLConfiguration; import org.hyperledger.besu.ethereum.api.jsonrpc.health.HealthService; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.filter.FilterManager; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.JsonRpcMethod; @@ -139,6 +140,7 @@ public static void initServerAndClient() throws Exception { mock(JsonRpcConfiguration.class), mock(WebSocketConfiguration.class), mock(MetricsConfiguration.class), + mock(GraphQLConfiguration.class), natService, new HashMap<>(), folder, diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTlsClientAuthTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTlsClientAuthTest.java index 5cf13a45762..28474d3c536 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTlsClientAuthTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTlsClientAuthTest.java @@ -25,6 +25,7 @@ import org.hyperledger.besu.config.StubGenesisConfigOptions; import org.hyperledger.besu.ethereum.ProtocolContext; import org.hyperledger.besu.ethereum.api.ApiConfiguration; +import org.hyperledger.besu.ethereum.api.graphql.GraphQLConfiguration; import org.hyperledger.besu.ethereum.api.jsonrpc.health.HealthService; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.filter.FilterManager; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.JsonRpcMethod; @@ -144,6 +145,7 @@ public void initServer() throws Exception { mock(JsonRpcConfiguration.class), mock(WebSocketConfiguration.class), mock(MetricsConfiguration.class), + mock(GraphQLConfiguration.class), natService, Collections.emptyMap(), folder, diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTlsMisconfigurationTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTlsMisconfigurationTest.java index c2661141a4c..15df60230b6 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTlsMisconfigurationTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTlsMisconfigurationTest.java @@ -24,6 +24,7 @@ import org.hyperledger.besu.config.StubGenesisConfigOptions; import org.hyperledger.besu.ethereum.ProtocolContext; import org.hyperledger.besu.ethereum.api.ApiConfiguration; +import org.hyperledger.besu.ethereum.api.graphql.GraphQLConfiguration; import org.hyperledger.besu.ethereum.api.jsonrpc.health.HealthService; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.filter.FilterManager; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.JsonRpcMethod; @@ -132,6 +133,7 @@ public void beforeEach() { mock(JsonRpcConfiguration.class), mock(WebSocketConfiguration.class), mock(MetricsConfiguration.class), + mock(GraphQLConfiguration.class), natService, Collections.emptyMap(), tempDir.getRoot(), diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTlsTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTlsTest.java index c0846ed9f26..6f7ce4e1d66 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTlsTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTlsTest.java @@ -24,6 +24,7 @@ import org.hyperledger.besu.config.StubGenesisConfigOptions; import org.hyperledger.besu.ethereum.ProtocolContext; import org.hyperledger.besu.ethereum.api.ApiConfiguration; +import org.hyperledger.besu.ethereum.api.graphql.GraphQLConfiguration; import org.hyperledger.besu.ethereum.api.jsonrpc.health.HealthService; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.filter.FilterManager; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.JsonRpcMethod; @@ -133,6 +134,7 @@ public void initServer() throws Exception { mock(JsonRpcConfiguration.class), mock(WebSocketConfiguration.class), mock(MetricsConfiguration.class), + mock(GraphQLConfiguration.class), natService, Collections.emptyMap(), folder, diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/websocket/WebSocketServiceLoginTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/websocket/WebSocketServiceLoginTest.java index 342941d0e9c..47a16135ffd 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/websocket/WebSocketServiceLoginTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/websocket/WebSocketServiceLoginTest.java @@ -26,6 +26,7 @@ import org.hyperledger.besu.config.StubGenesisConfigOptions; import org.hyperledger.besu.ethereum.ProtocolContext; import org.hyperledger.besu.ethereum.api.ApiConfiguration; +import org.hyperledger.besu.ethereum.api.graphql.GraphQLConfiguration; import org.hyperledger.besu.ethereum.api.handlers.TimeoutOptions; import org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcConfiguration; import org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcHttpService; @@ -197,6 +198,7 @@ public void before() throws URISyntaxException { mock(JsonRpcConfiguration.class), mock(WebSocketConfiguration.class), mock(MetricsConfiguration.class), + mock(GraphQLConfiguration.class), natService, new HashMap<>(), folder, From 89dfa958607e362ee550cc8b948f93bdf13904ff Mon Sep 17 00:00:00 2001 From: Sally MacFarlane Date: Mon, 16 Sep 2024 13:26:14 +1000 Subject: [PATCH 10/47] [CHANGELOG] upcoming breaking change for k8s nat (#7534) * upcoming breaking change for k8s nat * log warning if deprecated NAT method used Signed-off-by: Sally MacFarlane --------- Signed-off-by: Sally MacFarlane --- CHANGELOG.md | 1 + .../main/java/org/hyperledger/besu/cli/BesuCommand.java | 7 +++++++ nat/src/main/java/org/hyperledger/besu/nat/NatMethod.java | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1da225c56c9..c2418386370 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## [Unreleased] ### Upcoming Breaking Changes +- k8s (KUBERNETES) Nat method is now deprecated and will be removed in a future release ### Breaking Changes diff --git a/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java b/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java index f79ef45b995..ecfc0eaadb2 100644 --- a/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java +++ b/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java @@ -1568,6 +1568,13 @@ private void validateGraphQlOptions() { @SuppressWarnings("ConstantConditions") private void validateNatParams() { + if (natMethod.equals(NatMethod.KUBERNETES)) { + logger.warn("Kubernetes NAT method is deprecated. Please use Docker or UPNP"); + } + if (!unstableNatOptions.getNatManagerServiceName().equals(DEFAULT_BESU_SERVICE_NAME_FILTER)) { + logger.warn( + "`--Xnat-kube-service-name` and Kubernetes NAT method are deprecated. Please use Docker or UPNP"); + } if (!(natMethod.equals(NatMethod.AUTO) || natMethod.equals(NatMethod.KUBERNETES)) && !unstableNatOptions .getNatManagerServiceName() diff --git a/nat/src/main/java/org/hyperledger/besu/nat/NatMethod.java b/nat/src/main/java/org/hyperledger/besu/nat/NatMethod.java index bbd1c02c40c..ed7d46a712c 100644 --- a/nat/src/main/java/org/hyperledger/besu/nat/NatMethod.java +++ b/nat/src/main/java/org/hyperledger/besu/nat/NatMethod.java @@ -18,7 +18,7 @@ public enum NatMethod { /** Upnp nat method. */ UPNP, - /** Upnpp 2 ponly nat method. */ + /** Upnp p2p only nat method. */ UPNPP2PONLY, /** Docker nat method. */ DOCKER, From 33085dd2331d137bb846d2d16833341b3dec53eb Mon Sep 17 00:00:00 2001 From: Fabio Di Fabio Date: Wed, 18 Sep 2024 05:35:06 +0200 Subject: [PATCH 11/47] Fix flakiness ofTxPoolOptionsTest::txpoolForcePriceBumpToZeroWhenZeroBaseFeeMarket (#7610) Signed-off-by: Fabio Di Fabio --- .../hyperledger/besu/cli/CommandTestAbstract.java | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/besu/src/test/java/org/hyperledger/besu/cli/CommandTestAbstract.java b/besu/src/test/java/org/hyperledger/besu/cli/CommandTestAbstract.java index 3dd9641b487..7d11a4a8e99 100644 --- a/besu/src/test/java/org/hyperledger/besu/cli/CommandTestAbstract.java +++ b/besu/src/test/java/org/hyperledger/besu/cli/CommandTestAbstract.java @@ -24,7 +24,6 @@ import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.atLeast; -import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.lenient; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -43,7 +42,6 @@ import org.hyperledger.besu.cli.options.unstable.MetricsCLIOptions; import org.hyperledger.besu.cli.options.unstable.NetworkingOptions; import org.hyperledger.besu.cli.options.unstable.SynchronizerOptions; -import org.hyperledger.besu.components.BesuComponent; import org.hyperledger.besu.config.GenesisConfigOptions; import org.hyperledger.besu.controller.BesuController; import org.hyperledger.besu.controller.BesuControllerBuilder; @@ -256,10 +254,8 @@ public abstract class CommandTestAbstract { @BeforeEach public void initMocks() throws Exception { - // doReturn used because of generic BesuController - doReturn(mockControllerBuilder) - .when(mockControllerBuilderFactory) - .fromEthNetworkConfig(any(), any()); + when(mockControllerBuilderFactory.fromEthNetworkConfig(any(), any())) + .thenReturn(mockControllerBuilder); when(mockControllerBuilder.synchronizerConfiguration(any())).thenReturn(mockControllerBuilder); when(mockControllerBuilder.ethProtocolConfiguration(any())).thenReturn(mockControllerBuilder); when(mockControllerBuilder.transactionPoolConfiguration(any())) @@ -288,14 +284,12 @@ public void initMocks() throws Exception { when(mockControllerBuilder.maxPeers(anyInt())).thenReturn(mockControllerBuilder); when(mockControllerBuilder.maxRemotelyInitiatedPeers(anyInt())) .thenReturn(mockControllerBuilder); - when(mockControllerBuilder.besuComponent(any(BesuComponent.class))) - .thenReturn(mockControllerBuilder); + when(mockControllerBuilder.besuComponent(any())).thenReturn(mockControllerBuilder); when(mockControllerBuilder.cacheLastBlocks(any())).thenReturn(mockControllerBuilder); when(mockControllerBuilder.genesisStateHashCacheEnabled(any())) .thenReturn(mockControllerBuilder); - // doReturn used because of generic BesuController - doReturn(mockController).when(mockControllerBuilder).build(); + when(mockControllerBuilder.build()).thenReturn(mockController); lenient().when(mockController.getProtocolManager()).thenReturn(mockEthProtocolManager); lenient().when(mockController.getProtocolSchedule()).thenReturn(mockProtocolSchedule); lenient().when(mockController.getProtocolContext()).thenReturn(mockProtocolContext); From 578104e222619eedcf90740b8b1176b10c7ce165 Mon Sep 17 00:00:00 2001 From: Gabriel-Trintinalia Date: Wed, 18 Sep 2024 15:20:14 +1000 Subject: [PATCH 12/47] Fix Snap Server Account Range tests (#7552) Signed-off-by: Gabriel-Trintinalia --- .../ethereum/core/BlockchainSetupUtil.java | 21 +- .../ethereum/eth/manager/snap/SnapServer.java | 18 +- .../messages/snap/AccountRangeMessage.java | 25 +- .../messages/snap/GetAccountRangeMessage.java | 12 +- .../snap/SnapServerGetAccountRangeTest.java | 495 ++++++++++++++++++ .../eth/manager/snap/SnapServerTest.java | 2 +- .../snap/AccountRangeMessageTest.java | 83 ++- .../besu/testutil/BlockTestUtil.java | 20 + .../src/main/resources/snap/snapGenesis.json | 111 ++++ .../main/resources/snap/testBlockchain.blocks | Bin 0 -> 342468 bytes 10 files changed, 772 insertions(+), 15 deletions(-) create mode 100644 ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/snap/SnapServerGetAccountRangeTest.java create mode 100644 testutil/src/main/resources/snap/snapGenesis.json create mode 100644 testutil/src/main/resources/snap/testBlockchain.blocks diff --git a/ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/BlockchainSetupUtil.java b/ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/BlockchainSetupUtil.java index 551f593e825..62d670c07ab 100644 --- a/ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/BlockchainSetupUtil.java +++ b/ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/BlockchainSetupUtil.java @@ -85,6 +85,13 @@ public Blockchain importAllBlocks() { return blockchain; } + public Blockchain importAllBlocks( + final HeaderValidationMode headerValidationMode, + final HeaderValidationMode ommerValidationMode) { + importBlocks(blocks, headerValidationMode, ommerValidationMode); + return blockchain; + } + public void importFirstBlocks(final int count) { importBlocks(blocks.subList(0, count)); } @@ -126,6 +133,10 @@ public static BlockchainSetupUtil forUpgradedFork() { return createForEthashChain(BlockTestUtil.getUpgradedForkResources(), DataStorageFormat.FOREST); } + public static BlockchainSetupUtil forSnapTesting(final DataStorageFormat storageFormat) { + return createForEthashChain(BlockTestUtil.getSnapTestChainResources(), storageFormat); + } + public static BlockchainSetupUtil createForEthashChain( final ChainResources chainResources, final DataStorageFormat storageFormat) { return create( @@ -241,6 +252,13 @@ public TransactionPool getTransactionPool() { } private void importBlocks(final List blocks) { + importBlocks(blocks, HeaderValidationMode.FULL, HeaderValidationMode.FULL); + } + + private void importBlocks( + final List blocks, + final HeaderValidationMode headerValidationMode, + final HeaderValidationMode ommerValidationMode) { for (final Block block : blocks) { if (block.getHeader().getNumber() == BlockHeader.GENESIS_BLOCK_NUMBER) { continue; @@ -248,7 +266,8 @@ private void importBlocks(final List blocks) { final ProtocolSpec protocolSpec = protocolSchedule.getByBlockHeader(block.getHeader()); final BlockImporter blockImporter = protocolSpec.getBlockImporter(); final BlockImportResult result = - blockImporter.importBlock(protocolContext, block, HeaderValidationMode.FULL); + blockImporter.importBlock( + protocolContext, block, headerValidationMode, ommerValidationMode); if (!result.isImported()) { throw new IllegalStateException("Unable to import block " + block.getHeader().getNumber()); } diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/snap/SnapServer.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/snap/SnapServer.java index c1b855f2d6f..7de933e1370 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/snap/SnapServer.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/snap/SnapServer.java @@ -31,6 +31,7 @@ import org.hyperledger.besu.ethereum.p2p.rlpx.wire.MessageData; import org.hyperledger.besu.ethereum.proof.WorldStateProofProvider; import org.hyperledger.besu.ethereum.rlp.BytesValueRLPOutput; +import org.hyperledger.besu.ethereum.rlp.RLP; import org.hyperledger.besu.ethereum.trie.CompactEncoding; import org.hyperledger.besu.ethereum.trie.MerkleTrie; import org.hyperledger.besu.ethereum.trie.diffbased.bonsai.BonsaiWorldStateProvider; @@ -240,12 +241,9 @@ MessageData constructGetAccountRangeResponse(final MessageData message) { stopWatch, maxResponseBytes, (pair) -> { - var rlpOutput = new BytesValueRLPOutput(); - rlpOutput.startList(); - rlpOutput.writeBytes(pair.getFirst()); - rlpOutput.writeRLPBytes(pair.getSecond()); - rlpOutput.endList(); - return rlpOutput.encodedSize(); + Bytes bytes = + AccountRangeMessage.toSlimAccount(RLP.input(pair.getSecond())); + return Hash.SIZE + bytes.size(); }); final Bytes32 endKeyBytes = range.endKeyHash(); @@ -257,11 +255,15 @@ MessageData constructGetAccountRangeResponse(final MessageData message) { storage.streamFlatAccounts(range.startKeyHash(), shouldContinuePredicate); if (accounts.isEmpty() && shouldContinuePredicate.shouldContinue.get()) { + var fromNextHash = + range.endKeyHash().compareTo(range.startKeyHash()) >= 0 + ? range.endKeyHash() + : range.startKeyHash(); // fetch next account after range, if it exists LOGGER.debug( "found no accounts in range, taking first value starting from {}", - asLogHash(range.endKeyHash())); - accounts = storage.streamFlatAccounts(range.endKeyHash(), UInt256.MAX_VALUE, 1L); + asLogHash(fromNextHash)); + accounts = storage.streamFlatAccounts(fromNextHash, UInt256.MAX_VALUE, 1L); } final var worldStateProof = diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/messages/snap/AccountRangeMessage.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/messages/snap/AccountRangeMessage.java index 8e1b1a31a54..71d04295925 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/messages/snap/AccountRangeMessage.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/messages/snap/AccountRangeMessage.java @@ -14,6 +14,7 @@ */ package org.hyperledger.besu.ethereum.eth.messages.snap; +import org.hyperledger.besu.datatypes.Hash; import org.hyperledger.besu.ethereum.p2p.rlpx.wire.AbstractSnapMessageData; import org.hyperledger.besu.ethereum.p2p.rlpx.wire.MessageData; import org.hyperledger.besu.ethereum.rlp.BytesValueRLPInput; @@ -28,6 +29,7 @@ import java.util.Optional; import java.util.TreeMap; +import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.Maps; import kotlin.collections.ArrayDeque; import org.apache.tuweni.bytes.Bytes; @@ -117,7 +119,8 @@ public AccountRangeData accountData(final boolean withRequestId) { return ImmutableAccountRangeData.builder().accounts(accounts).proofs(proofs).build(); } - private Bytes toFullAccount(final RLPInput rlpInput) { + @VisibleForTesting + public static Bytes toFullAccount(final RLPInput rlpInput) { final StateTrieAccountValue accountValue = StateTrieAccountValue.readFrom(rlpInput); final BytesValueRLPOutput rlpOutput = new BytesValueRLPOutput(); @@ -131,6 +134,26 @@ private Bytes toFullAccount(final RLPInput rlpInput) { return rlpOutput.encoded(); } + public static Bytes toSlimAccount(final RLPInput rlpInput) { + StateTrieAccountValue accountValue = StateTrieAccountValue.readFrom(rlpInput); + var rlpOutput = new BytesValueRLPOutput(); + rlpOutput.startList(); + rlpOutput.writeLongScalar(accountValue.getNonce()); + rlpOutput.writeUInt256Scalar(accountValue.getBalance()); + if (accountValue.getStorageRoot().equals(Hash.EMPTY_TRIE_HASH)) { + rlpOutput.writeNull(); + } else { + rlpOutput.writeBytes(accountValue.getStorageRoot()); + } + if (accountValue.getCodeHash().equals(Hash.EMPTY)) { + rlpOutput.writeNull(); + } else { + rlpOutput.writeBytes(accountValue.getCodeHash()); + } + rlpOutput.endList(); + return rlpOutput.encoded(); + } + @Value.Immutable public interface AccountRangeData { diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/messages/snap/GetAccountRangeMessage.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/messages/snap/GetAccountRangeMessage.java index 8f5fcaf9a73..6d8c8c128c6 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/messages/snap/GetAccountRangeMessage.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/messages/snap/GetAccountRangeMessage.java @@ -24,6 +24,7 @@ import java.math.BigInteger; import java.util.Optional; +import com.google.common.annotations.VisibleForTesting; import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.Bytes32; import org.immutables.value.Value; @@ -48,12 +49,21 @@ public static GetAccountRangeMessage readFrom(final MessageData message) { public static GetAccountRangeMessage create( final Hash worldStateRootHash, final Bytes32 startKeyHash, final Bytes32 endKeyHash) { + return create(worldStateRootHash, startKeyHash, endKeyHash, SIZE_REQUEST); + } + + @VisibleForTesting + public static GetAccountRangeMessage create( + final Hash worldStateRootHash, + final Bytes32 startKeyHash, + final Bytes32 endKeyHash, + final BigInteger sizeRequest) { final BytesValueRLPOutput tmp = new BytesValueRLPOutput(); tmp.startList(); tmp.writeBytes(worldStateRootHash); tmp.writeBytes(startKeyHash); tmp.writeBytes(endKeyHash); - tmp.writeBigIntegerScalar(SIZE_REQUEST); + tmp.writeBigIntegerScalar(sizeRequest); tmp.endList(); return new GetAccountRangeMessage(tmp.encoded()); } diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/snap/SnapServerGetAccountRangeTest.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/snap/SnapServerGetAccountRangeTest.java new file mode 100644 index 00000000000..6d8180c8c0e --- /dev/null +++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/snap/SnapServerGetAccountRangeTest.java @@ -0,0 +1,495 @@ +/* + * Copyright contributors to Hyperledger Besu. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ +package org.hyperledger.besu.ethereum.eth.manager.snap; + +import static org.assertj.core.api.AssertionsForClassTypes.assertThat; + +import org.hyperledger.besu.datatypes.Hash; +import org.hyperledger.besu.ethereum.ProtocolContext; +import org.hyperledger.besu.ethereum.core.BlockchainSetupUtil; +import org.hyperledger.besu.ethereum.eth.manager.EthMessages; +import org.hyperledger.besu.ethereum.eth.messages.snap.AccountRangeMessage; +import org.hyperledger.besu.ethereum.eth.messages.snap.GetAccountRangeMessage; +import org.hyperledger.besu.ethereum.eth.sync.snapsync.ImmutableSnapSyncConfiguration; +import org.hyperledger.besu.ethereum.eth.sync.snapsync.SnapSyncConfiguration; +import org.hyperledger.besu.ethereum.mainnet.HeaderValidationMode; +import org.hyperledger.besu.ethereum.trie.diffbased.common.DiffBasedWorldStateProvider; +import org.hyperledger.besu.ethereum.worldstate.WorldStateStorageCoordinator; +import org.hyperledger.besu.plugin.services.storage.DataStorageFormat; + +import java.math.BigInteger; +import java.util.NavigableMap; + +import org.apache.tuweni.bytes.Bytes; +import org.apache.tuweni.bytes.Bytes32; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +public class SnapServerGetAccountRangeTest { + private Hash rootHash; + public Bytes32 firstAccount; + public Bytes32 secondAccount; + private SnapServer snapServer; + private static ProtocolContext protocolContext; + + @BeforeAll + public static void setup() { + // Setup local blockchain for testing + BlockchainSetupUtil localBlockchainSetup = + BlockchainSetupUtil.forSnapTesting(DataStorageFormat.BONSAI); + localBlockchainSetup.importAllBlocks( + HeaderValidationMode.LIGHT_DETACHED_ONLY, HeaderValidationMode.LIGHT); + + protocolContext = localBlockchainSetup.getProtocolContext(); + } + + @BeforeEach + public void setupTest() { + WorldStateStorageCoordinator worldStateStorageCoordinator = + new WorldStateStorageCoordinator( + ((DiffBasedWorldStateProvider) protocolContext.getWorldStateArchive()) + .getWorldStateKeyValueStorage()); + + SnapSyncConfiguration snapSyncConfiguration = + ImmutableSnapSyncConfiguration.builder().isSnapServerEnabled(true).build(); + snapServer = + new SnapServer( + snapSyncConfiguration, + new EthMessages(), + worldStateStorageCoordinator, + protocolContext) + .start(); + initAccounts(); + } + + /** + * In this test, we request the entire state range, but limit the response to 4000 bytes. + * Expected: 86 accounts. + */ + @Test + public void test0_RequestEntireStateRangeWith4000BytesLimit() { + testAccountRangeRequest( + new AccountRangeRequestParams.Builder() + .rootHash(rootHash) + .responseBytes(4000) + .expectedAccounts(86) + .expectedFirstAccount(firstAccount) + .expectedLastAccount( + Bytes32.fromHexString( + "0x445cb5c1278fdce2f9cbdb681bdd76c52f8e50e41dbd9e220242a69ba99ac099")) + .build()); + } + + /** + * In this test, we request the entire state range, but limit the response to 3000 bytes. + * Expected: 65 accounts. + */ + @Test + public void test1_RequestEntireStateRangeWith3000BytesLimit() { + testAccountRangeRequest( + new AccountRangeRequestParams.Builder() + .rootHash(rootHash) + .responseBytes(3000) + .expectedAccounts(65) + .expectedFirstAccount(firstAccount) + .expectedLastAccount( + Bytes32.fromHexString( + "0x2e6fe1362b3e388184fd7bf08e99e74170b26361624ffd1c5f646da7067b58b6")) + .build()); + } + + /** + * In this test, we request the entire state range, but limit the response to 2000 bytes. + * Expected: 44 accounts. + */ + @Test + public void test2_RequestEntireStateRangeWith2000BytesLimit() { + testAccountRangeRequest( + new AccountRangeRequestParams.Builder() + .rootHash(rootHash) + .responseBytes(2000) + .expectedAccounts(44) + .expectedFirstAccount(firstAccount) + .expectedLastAccount( + Bytes32.fromHexString( + "0x1c3f74249a4892081ba0634a819aec9ed25f34c7653f5719b9098487e65ab595")) + .build()); + } + + /** + * In this test, we request the entire state range, but limit the response to 1 byte. The server + * should return the first account of the state. Expected: 1 account. + */ + @Test + public void test3_RequestEntireStateRangeWith1ByteLimit() { + testAccountRangeRequest( + new AccountRangeRequestParams.Builder() + .rootHash(rootHash) + .responseBytes(1) + .expectedAccounts(1) + .expectedFirstAccount(firstAccount) + .expectedLastAccount(firstAccount) + .build()); + } + + /** + * Here we request with a responseBytes limit of zero. The server should return one account. + * Expected: 1 account. + */ + @Test + public void test4_RequestEntireStateRangeWithZeroBytesLimit() { + testAccountRangeRequest( + new AccountRangeRequestParams.Builder() + .rootHash(rootHash) + .responseBytes(0) + .expectedAccounts(1) + .expectedFirstAccount(firstAccount) + .expectedLastAccount(firstAccount) + .build()); + } + + /** + * In this test, we request a range where startingHash is before the first available account key, + * and limitHash is after. The server should return the first and second account of the state + * (because the second account is the 'next available'). Expected: 2 accounts. + */ + @Test + public void test5_RequestRangeBeforeFirstAccountKey() { + testAccountRangeRequest( + new AccountRangeRequestParams.Builder() + .rootHash(rootHash) + .startHash(hashAdd(firstAccount, -500)) + .limitHash(hashAdd(firstAccount, 1)) + .expectedAccounts(2) + .expectedFirstAccount(firstAccount) + .expectedLastAccount(secondAccount) + .build()); + } + + /** + * Here we request range where both bounds are before the first available account key. This should + * return the first account (even though it's out of bounds). Expected: 1 account. + */ + @Test + public void test6_RequestRangeBothBoundsBeforeFirstAccountKey() { + testAccountRangeRequest( + new AccountRangeRequestParams.Builder() + .rootHash(rootHash) + .startHash(hashAdd(firstAccount, -500)) + .limitHash(hashAdd(firstAccount, -400)) + .expectedAccounts(1) + .expectedFirstAccount(firstAccount) + .expectedLastAccount(firstAccount) + .build()); + } + + /** + * In this test, both startingHash and limitHash are zero. The server should return the first + * available account. Expected: 1 account. + */ + @Test + public void test7_RequestBothBoundsZero() { + testAccountRangeRequest( + new AccountRangeRequestParams.Builder() + .rootHash(rootHash) + .startHash(Hash.ZERO) + .limitHash(Hash.ZERO) + .expectedAccounts(1) + .expectedFirstAccount(firstAccount) + .expectedLastAccount(firstAccount) + .build()); + } + + /** + * In this test, startingHash is exactly the first available account key. The server should return + * the first available account of the state as the first item. Expected: 86 accounts. + */ + @Test + public void test8_RequestStartingHashFirstAvailableAccountKey() { + testAccountRangeRequest( + new AccountRangeRequestParams.Builder() + .rootHash(rootHash) + .startHash(firstAccount) + .responseBytes(4000) + .expectedAccounts(86) + .expectedFirstAccount(firstAccount) + .expectedLastAccount( + Bytes32.fromHexString( + "0x445cb5c1278fdce2f9cbdb681bdd76c52f8e50e41dbd9e220242a69ba99ac099")) + .build()); + } + + /** + * In this test, startingHash is after the first available key. The server should return the + * second account of the state as the first item. Expected: 86 accounts. + */ + @Test + public void test9_RequestStartingHashAfterFirstAvailableKey() { + testAccountRangeRequest( + new AccountRangeRequestParams.Builder() + .rootHash(rootHash) + .startHash(secondAccount) + .responseBytes(4000) + .expectedAccounts(86) + .expectedFirstAccount(secondAccount) + .expectedLastAccount( + Bytes32.fromHexString( + "0x4615e5f5df5b25349a00ad313c6cd0436b6c08ee5826e33a018661997f85ebaa")) + .build()); + } + + /** This test requests a non-existent state root. Expected: 0 accounts. */ + @Test + public void test10_RequestNonExistentStateRoot() { + Hash rootHash = + Hash.fromHexString("1337000000000000000000000000000000000000000000000000000000000000"); + testAccountRangeRequest( + new AccountRangeRequestParams.Builder().rootHash(rootHash).expectedAccounts(0).build()); + } + + /** + * This test requests data at a state root that is 127 blocks old. We expect the server to have + * this state available. Expected: 84 accounts. + */ + @Test + public void test12_RequestStateRoot127BlocksOld() { + + Hash rootHash = + protocolContext + .getBlockchain() + .getBlockHeader((protocolContext.getBlockchain().getChainHeadBlockNumber() - 127)) + .orElseThrow() + .getStateRoot(); + testAccountRangeRequest( + new AccountRangeRequestParams.Builder() + .rootHash(rootHash) + .expectedAccounts(84) + .responseBytes(4000) + .expectedFirstAccount(firstAccount) + .expectedLastAccount( + Bytes32.fromHexString( + "0x580aa878e2f92d113a12c0a3ce3c21972b03dbe80786858d49a72097e2c491a3")) + .build()); + } + + /** + * This test requests data at a state root that is actually the storage root of an existing + * account. The server is supposed to ignore this request. Expected: 0 accounts. + */ + @Test + public void test13_RequestStateRootIsStorageRoot() { + Hash rootHash = + Hash.fromHexString("df97f94bc47471870606f626fb7a0b42eed2d45fcc84dc1200ce62f7831da990"); + testAccountRangeRequest( + new AccountRangeRequestParams.Builder().rootHash(rootHash).expectedAccounts(0).build()); + } + + /** + * In this test, the startingHash is after limitHash (wrong order). The server should ignore this + * invalid request. Expected: 0 accounts. + */ + @Test + public void test14_RequestStartingHashAfterLimitHash() { + testAccountRangeRequest( + new AccountRangeRequestParams.Builder() + .rootHash(rootHash) + .startHash(Hash.LAST) + .limitHash(Hash.ZERO) + .expectedAccounts(0) + .build()); + } + + /** + * In this test, the startingHash is the first available key, and limitHash is a key before + * startingHash (wrong order). The server should return the first available key. Expected: 1 + * account. + */ + @Test + public void test15_RequestStartingHashFirstAvailableKeyAndLimitHashBefore() { + testAccountRangeRequest( + new AccountRangeRequestParams.Builder() + .rootHash(rootHash) + .startHash(firstAccount) + .limitHash(hashAdd(firstAccount, -1)) + .expectedAccounts(1) + .expectedFirstAccount(firstAccount) + .expectedLastAccount(firstAccount) + .build()); + } + + /** + * In this test, the startingHash is the first available key and limitHash is zero. (wrong order). + * The server should return the first available key. Expected: 1 account. + */ + @Test + public void test16_RequestStartingHashFirstAvailableKeyAndLimitHashZero() { + testAccountRangeRequest( + new AccountRangeRequestParams.Builder() + .rootHash(rootHash) + .startHash(firstAccount) + .limitHash(Hash.ZERO) + .expectedAccounts(1) + .expectedFirstAccount(firstAccount) + .expectedLastAccount(firstAccount) + .build()); + } + + private void testAccountRangeRequest(final AccountRangeRequestParams params) { + NavigableMap accounts = getAccountRange(params); + assertThat(accounts.size()).isEqualTo(params.getExpectedAccounts()); + + if (params.getExpectedAccounts() > 0) { + assertThat(accounts.firstKey()).isEqualTo(params.getExpectedFirstAccount()); + assertThat(accounts.lastKey()).isEqualTo(params.getExpectedLastAccount()); + } + } + + private NavigableMap getAccountRange(final AccountRangeRequestParams params) { + Hash rootHash = params.getRootHash(); + Bytes32 startHash = params.getStartHash(); + Bytes32 limitHash = params.getLimitHash(); + BigInteger sizeRequest = BigInteger.valueOf(params.getResponseBytes()); + + GetAccountRangeMessage requestMessage = + GetAccountRangeMessage.create(rootHash, startHash, limitHash, sizeRequest); + + AccountRangeMessage resultMessage = + AccountRangeMessage.readFrom( + snapServer.constructGetAccountRangeResponse( + requestMessage.wrapMessageData(BigInteger.ONE))); + NavigableMap accounts = resultMessage.accountData(false).accounts(); + return accounts; + } + + @SuppressWarnings("UnusedVariable") + private void initAccounts() { + rootHash = protocolContext.getWorldStateArchive().getMutable().rootHash(); + GetAccountRangeMessage requestMessage = + GetAccountRangeMessage.create(rootHash, Hash.ZERO, Hash.LAST, BigInteger.valueOf(4000)); + AccountRangeMessage resultMessage = + AccountRangeMessage.readFrom( + snapServer.constructGetAccountRangeResponse( + requestMessage.wrapMessageData(BigInteger.ONE))); + NavigableMap accounts = resultMessage.accountData(false).accounts(); + firstAccount = accounts.firstEntry().getKey(); + secondAccount = + accounts.entrySet().stream().skip(1).findFirst().orElse(accounts.firstEntry()).getKey(); + } + + private Bytes32 hashAdd(final Bytes32 hash, final int value) { + var result = Hash.wrap(hash).toBigInteger().add(BigInteger.valueOf(value)); + Bytes resultBytes = Bytes.wrap(result.toByteArray()); + return Bytes32.leftPad(resultBytes); + } + + public static class AccountRangeRequestParams { + private final Hash rootHash; + private final Bytes32 startHash; + private final Bytes32 limitHash; + private final int responseBytes; + private final int expectedAccounts; + private final Bytes32 expectedFirstAccount; + private final Bytes32 expectedLastAccount; + + private AccountRangeRequestParams(final Builder builder) { + this.rootHash = builder.rootHash; + this.startHash = builder.startHash; + this.limitHash = builder.limitHash; + this.responseBytes = builder.responseBytes; + this.expectedAccounts = builder.expectedAccounts; + this.expectedFirstAccount = builder.expectedFirstAccount; + this.expectedLastAccount = builder.expectedLastAccount; + } + + public static class Builder { + private Hash rootHash = null; + private Bytes32 startHash = Bytes32.ZERO; + private Bytes32 limitHash = Hash.LAST; + private int responseBytes = Integer.MAX_VALUE; + private int expectedAccounts = 0; + private Bytes32 expectedFirstAccount = null; + private Bytes32 expectedLastAccount = null; + + public Builder rootHash(final Hash rootHashHex) { + this.rootHash = rootHashHex; + return this; + } + + public Builder startHash(final Bytes32 startHashHex) { + this.startHash = startHashHex; + return this; + } + + public Builder limitHash(final Bytes32 limitHashHex) { + this.limitHash = limitHashHex; + return this; + } + + public Builder responseBytes(final int responseBytes) { + this.responseBytes = responseBytes; + return this; + } + + public Builder expectedAccounts(final int expectedAccounts) { + this.expectedAccounts = expectedAccounts; + return this; + } + + public Builder expectedFirstAccount(final Bytes32 expectedFirstAccount) { + this.expectedFirstAccount = expectedFirstAccount; + return this; + } + + public Builder expectedLastAccount(final Bytes32 expectedLastAccount) { + this.expectedLastAccount = expectedLastAccount; + return this; + } + + public AccountRangeRequestParams build() { + return new AccountRangeRequestParams(this); + } + } + + // Getters for each field + public Hash getRootHash() { + return rootHash; + } + + public Bytes32 getStartHash() { + return startHash; + } + + public Bytes32 getLimitHash() { + return limitHash; + } + + public int getResponseBytes() { + return responseBytes; + } + + public int getExpectedAccounts() { + return expectedAccounts; + } + + public Bytes32 getExpectedFirstAccount() { + return expectedFirstAccount; + } + + public Bytes32 getExpectedLastAccount() { + return expectedLastAccount; + } + } +} diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/snap/SnapServerTest.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/snap/SnapServerTest.java index a41da1ef6b8..e168b7e2fe3 100644 --- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/snap/SnapServerTest.java +++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/snap/SnapServerTest.java @@ -188,7 +188,7 @@ public void assertEmptyRangeLeftProofOfExclusionAndNextAccount() { public void assertAccountLimitRangeResponse() { // assert we limit the range response according to size final int acctCount = 2000; - final long acctRLPSize = 105; + final long acctRLPSize = 37; List randomLoad = IntStream.range(1, 4096).boxed().collect(Collectors.toList()); Collections.shuffle(randomLoad); diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/messages/snap/AccountRangeMessageTest.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/messages/snap/AccountRangeMessageTest.java index bd715b64597..c7e5bf74c42 100644 --- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/messages/snap/AccountRangeMessageTest.java +++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/messages/snap/AccountRangeMessageTest.java @@ -14,11 +14,15 @@ */ package org.hyperledger.besu.ethereum.eth.messages.snap; +import static org.assertj.core.api.Assertions.assertThat; + import org.hyperledger.besu.datatypes.Hash; import org.hyperledger.besu.datatypes.Wei; import org.hyperledger.besu.ethereum.p2p.rlpx.wire.MessageData; import org.hyperledger.besu.ethereum.p2p.rlpx.wire.RawMessage; +import org.hyperledger.besu.ethereum.rlp.BytesValueRLPOutput; import org.hyperledger.besu.ethereum.rlp.RLP; +import org.hyperledger.besu.ethereum.rlp.RLPInput; import org.hyperledger.besu.ethereum.worldstate.StateTrieAccountValue; import java.util.ArrayList; @@ -28,7 +32,6 @@ import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.Bytes32; -import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; public final class AccountRangeMessageTest { @@ -51,7 +54,81 @@ public void roundTripTest() { // check match originals. final AccountRangeMessage.AccountRangeData range = message.accountData(false); - Assertions.assertThat(range.accounts()).isEqualTo(keys); - Assertions.assertThat(range.proofs()).isEqualTo(proofs); + assertThat(range.accounts()).isEqualTo(keys); + assertThat(range.proofs()).isEqualTo(proofs); + } + + @Test + public void toSlimAccountTest() { + // Initialize nonce and balance + long nonce = 1L; + Wei balance = Wei.of(2L); + + // Create a StateTrieAccountValue with the given nonce and balance + final StateTrieAccountValue accountValue = + new StateTrieAccountValue(nonce, balance, Hash.EMPTY_TRIE_HASH, Hash.EMPTY); + + // Encode the account value to RLP + final BytesValueRLPOutput rlpOut = new BytesValueRLPOutput(); + accountValue.writeTo(rlpOut); + + // Convert the encoded account value to a slim account representation + Bytes slimAccount = AccountRangeMessage.toSlimAccount(RLP.input(rlpOut.encoded())); + + // Read the slim account RLP input + RLPInput in = RLP.input(slimAccount); + in.enterList(); + + // Verify the nonce and balance + final long expectedNonce = in.readLongScalar(); + final Wei expectedWei = Wei.of(in.readUInt256Scalar()); + assertThat(expectedNonce).isEqualTo(nonce); + assertThat(expectedWei).isEqualTo(balance); + + // Check that the storageRoot is empty + assertThat(in.nextIsNull()).isTrue(); + in.skipNext(); + + // Check that the codeHash is empty + assertThat(in.nextIsNull()).isTrue(); + in.skipNext(); + + // Exit the list + in.leaveList(); + } + + @Test + public void toFullAccountTest() { + // Initialize nonce and balance + long nonce = 1L; + Wei balance = Wei.of(2L); + + // Create a StateTrieAccountValue with the given nonce and balance + final StateTrieAccountValue accountValue = + new StateTrieAccountValue(nonce, balance, Hash.EMPTY_TRIE_HASH, Hash.EMPTY); + + // Encode the account value to RLP + final BytesValueRLPOutput rlpOut = new BytesValueRLPOutput(); + accountValue.writeTo(rlpOut); + + // Convert the encoded account value to a full account representation + Bytes fullAccount = AccountRangeMessage.toFullAccount(RLP.input(rlpOut.encoded())); + + // Read the full account RLP input + RLPInput in = RLP.input(fullAccount); + in.enterList(); + + // Verify the nonce and balance + final long expectedNonce = in.readLongScalar(); + final Wei expectedWei = Wei.of(in.readUInt256Scalar()); + assertThat(expectedNonce).isEqualTo(nonce); + assertThat(expectedWei).isEqualTo(balance); + + // Verify the storageRoot and codeHash + assertThat(in.readBytes32()).isEqualTo(Hash.EMPTY_TRIE_HASH); + assertThat(in.readBytes32()).isEqualTo(Hash.EMPTY); + + // Exit the list + in.leaveList(); } } diff --git a/testutil/src/main/java/org/hyperledger/besu/testutil/BlockTestUtil.java b/testutil/src/main/java/org/hyperledger/besu/testutil/BlockTestUtil.java index 9f31283bfcf..4c45d3cf740 100644 --- a/testutil/src/main/java/org/hyperledger/besu/testutil/BlockTestUtil.java +++ b/testutil/src/main/java/org/hyperledger/besu/testutil/BlockTestUtil.java @@ -52,6 +52,8 @@ private BlockTestUtil() { Suppliers.memoize(BlockTestUtil::supplyUpgradedForkResources); private static final Supplier testRpcCompactChainSupplier = Suppliers.memoize(BlockTestUtil::supplyTestRpcCompactResources); + private static final Supplier snapTestChainSupplier = + Suppliers.memoize(BlockTestUtil::supplySnapTestChainResources); /** * Gets test blockchain url. @@ -156,6 +158,15 @@ public static ChainResources getEthRefTestResources() { return testRpcCompactChainSupplier.get(); } + /** + * Gets test chain resources for Snap tests. + * + * @return the test chain resources + */ + public static ChainResources getSnapTestChainResources() { + return snapTestChainSupplier.get(); + } + private static ChainResources supplyTestChainResources() { final URL genesisURL = ensureFileUrl(BlockTestUtil.class.getClassLoader().getResource("testGenesis.json")); @@ -164,6 +175,15 @@ private static ChainResources supplyTestChainResources() { return new ChainResources(genesisURL, blocksURL); } + private static ChainResources supplySnapTestChainResources() { + final URL genesisURL = + ensureFileUrl(BlockTestUtil.class.getClassLoader().getResource("snap/snapGenesis.json")); + final URL blocksURL = + ensureFileUrl( + BlockTestUtil.class.getClassLoader().getResource("snap/testBlockchain.blocks")); + return new ChainResources(genesisURL, blocksURL); + } + private static ChainResources supplyHiveTestChainResources() { final URL genesisURL = ensureFileUrl(BlockTestUtil.class.getClassLoader().getResource("hive/testGenesis.json")); diff --git a/testutil/src/main/resources/snap/snapGenesis.json b/testutil/src/main/resources/snap/snapGenesis.json new file mode 100644 index 00000000000..20979e7f747 --- /dev/null +++ b/testutil/src/main/resources/snap/snapGenesis.json @@ -0,0 +1,111 @@ +{ + "config": { + "ethash": {}, + "chainID": 3503995874084926, + "homesteadBlock": 0, + "eip150Block": 6, + "eip155Block": 12, + "eip158Block": 12, + "byzantiumBlock": 18, + "constantinopleBlock": 24, + "constantinopleFixBlock": 30, + "istanbulBlock": 36, + "muirGlacierBlock": 42, + "berlinBlock": 48, + "londonBlock": 54, + "arrowGlacierBlock": 60, + "grayGlacierBlock": 66, + "mergeNetsplitBlock": 72, + "terminalTotalDifficulty": 9454784, + "shanghaiTime": 780, + "cancunTime": 840 + }, + "nonce": "0x0", + "timestamp": "0x0", + "extraData": "0x68697665636861696e", + "gasLimit": "0x23f3e20", + "difficulty": "0x20000", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "coinbase": "0x0000000000000000000000000000000000000000", + "alloc": { + "000f3df6d732807ef1319fb7b8bb8522d0beac02": { + "code": "0x3373fffffffffffffffffffffffffffffffffffffffe14604d57602036146024575f5ffd5b5f35801560495762001fff810690815414603c575f5ffd5b62001fff01545f5260205ff35b5f5ffd5b62001fff42064281555f359062001fff015500", + "balance": "0x2a" + }, + "0c2c51a0990aee1d73c1228de158688341557508": { + "balance": "0xc097ce7bc90715b34b9f1000000000" + }, + "14e46043e63d0e3cdcf2530519f4cfaf35058cb2": { + "balance": "0xc097ce7bc90715b34b9f1000000000" + }, + "16c57edf7fa9d9525378b0b81bf8a3ced0620c1c": { + "balance": "0xc097ce7bc90715b34b9f1000000000" + }, + "1f4924b14f34e24159387c0a4cdbaa32f3ddb0cf": { + "balance": "0xc097ce7bc90715b34b9f1000000000" + }, + "1f5bde34b4afc686f136c7a3cb6ec376f7357759": { + "balance": "0xc097ce7bc90715b34b9f1000000000" + }, + "2d389075be5be9f2246ad654ce152cf05990b209": { + "balance": "0xc097ce7bc90715b34b9f1000000000" + }, + "3ae75c08b4c907eb63a8960c45b86e1e9ab6123c": { + "balance": "0xc097ce7bc90715b34b9f1000000000" + }, + "4340ee1b812acb40a1eb561c019c327b243b92df": { + "balance": "0xc097ce7bc90715b34b9f1000000000" + }, + "4a0f1452281bcec5bd90c3dce6162a5995bfe9df": { + "balance": "0xc097ce7bc90715b34b9f1000000000" + }, + "4dde844b71bcdf95512fb4dc94e84fb67b512ed8": { + "balance": "0xc097ce7bc90715b34b9f1000000000" + }, + "5f552da00dfb4d3749d9e62dcee3c918855a86a0": { + "balance": "0xc097ce7bc90715b34b9f1000000000" + }, + "654aa64f5fbefb84c270ec74211b81ca8c44a72e": { + "balance": "0xc097ce7bc90715b34b9f1000000000" + }, + "717f8aa2b982bee0e29f573d31df288663e1ce16": { + "balance": "0xc097ce7bc90715b34b9f1000000000" + }, + "7435ed30a8b4aeb0877cef0c6e8cffe834eb865f": { + "balance": "0xc097ce7bc90715b34b9f1000000000" + }, + "83c7e323d189f18725ac510004fdc2941f8c4a78": { + "balance": "0xc097ce7bc90715b34b9f1000000000" + }, + "84e75c28348fb86acea1a93a39426d7d60f4cc46": { + "balance": "0xc097ce7bc90715b34b9f1000000000" + }, + "8bebc8ba651aee624937e7d897853ac30c95a067": { + "storage": { + "0x0000000000000000000000000000000000000000000000000000000000000001": "0x0000000000000000000000000000000000000000000000000000000000000001", + "0x0000000000000000000000000000000000000000000000000000000000000002": "0x0000000000000000000000000000000000000000000000000000000000000002", + "0x0000000000000000000000000000000000000000000000000000000000000003": "0x0000000000000000000000000000000000000000000000000000000000000003" + }, + "balance": "0x1", + "nonce": "0x1" + }, + "c7b99a164efd027a93f147376cc7da7c67c6bbe0": { + "balance": "0xc097ce7bc90715b34b9f1000000000" + }, + "d803681e487e6ac18053afc5a6cd813c86ec3e4d": { + "balance": "0xc097ce7bc90715b34b9f1000000000" + }, + "e7d13f7aa2a838d24c59b40186a0aca1e21cffcc": { + "balance": "0xc097ce7bc90715b34b9f1000000000" + }, + "eda8645ba6948855e3b3cd596bbb07596d59c603": { + "balance": "0xc097ce7bc90715b34b9f1000000000" + } + }, + "number": "0x0", + "gasUsed": "0x0", + "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "baseFeePerGas": null, + "excessBlobGas": null, + "blobGasUsed": null +} \ No newline at end of file diff --git a/testutil/src/main/resources/snap/testBlockchain.blocks b/testutil/src/main/resources/snap/testBlockchain.blocks new file mode 100644 index 0000000000000000000000000000000000000000..0df8d2f63ad54f13682181181b114e78f0e4229f GIT binary patch literal 342468 zcmeF4c|278`~S@#B5TMNW68c{7cr>p+4m*;maK`aV~s+#qEwEulx#^t_R79wNo2_u zBH1FO{LTzh-QCN4xF7dFzpwXw&v|dxIWx`ma-HjW-e+dkpwKnQHvkJm0S>pQO%2tX z`aBGKVprVKP1{9&k}mP``GfOma^K+H2?~jSbpYVddi>?Y{)nt=H`p!Dr4%&qa<~y2 zX2(@er*R97VSm#C^rjdO(Y5GiZibwkh_7CCHdY*_yWx~u4YA~ZGGfs% ze`+iQiiL#;g~~|75Qs>7hYL1V_7)D#0H*gK0&P%Ty#|d~gM0ywiwqY>wszvd40&&= z5y7H|E%?fdoF&L)H5mMLUmMHqQUs$j*6z);gD>LB7uA}K8>KHZ&S)VnN=_I^2YB!N(3PgXcqzEe|P`tmDNZDBm{zsk3f`2nG=a) zBg~1+u_Vl~mdvr_gS5qoNf9MQ=(ZGzsVR0M#r)M= z2q;BjYEX*ie~_Z6Ih4YjS>Mge-No6C*UG}l$=c$)g@=QWjX9Qgka^GSX?|q}K`8eA1hRJ~|hP}MWE771_FCyg{@}y70 zhODtwhi%qRt-NoI;##6`)3d4wegP(8tFboSUCK3m?A<&0cbgJ?!!$KRRi|wQv$Wr} z9Qy*fDkpqG@-qPqkY61UMnH>)M@>_a?p5~vCPl*3m(EOJE}RlV0wFUMadO=TdwM^3_Fpl->MH3l&iWc0+A<= zloggaOv@Z@Yz{Zaf|VptZF4VVYw9va4ARKSb09;JFmk2A+_&yyKKIKz5oJ%--{-E>oOMVs{∨M zy`lxR=Ze%`<}5)C^8u+k(){GjiWdS>T_?l$_gBA}eB39l#^>7gWtZAZNS3a*rKFZs zYi4s*5bg50K`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>I4tT!JgAx$tKmtb6Mv?N2Tinfo##*?8W@(?Q^HL;=B zAu=RiD=G>SY02Lm;l7-__Z`0{|IwyCc^JxC#D6XRU|~zVQirE(iy?n`B0JiYW*cp= zi#RVAP-!cdU+o=yK^{EJ8D0n`Sd+!OoWibv_GH}U>G`1%>I0kN)XhjY_6y^Sp~>%! zYttDQ&m|AkOe7vH$>~$iEatzt>^MI5@fQ?RzCK z8h8G>v?|lute{4M_EvhzYpP(R6vdMh@+d^s@F*ojFVZc_n=+7w<$1i5$v+5Nbk1vTH|4}{h?862{F*GZ7ylOaE1 zeJ%!=kYf^D`dBv8kSU`hilh3DUo)X$C(W~$TZCeJ9-|TVSAJMlDkO;&U6c=8GZ=Pf zD_g-K<+@4Q6j7j0JELBCnH$v%-w|n@l0GLBovbfSbyHf6CD_Nl`c0BzQ!$Cwmo2q3 zvE;XdftemYB#r7?%qBa3o4J-0#a#8Fkyajl&cg1SepP4HB#yIEzrguR1BBLPc)W$$ zl-HkzbyczFM&q|@91B8@cRAbxCLWf|OAZL(Uc|Hn>r92*F@|TQ0%2Jx!i@U}1dg7p zIZc8Txg0_qtFlEu-YfMutI}qIwGvrUTz@3N$wN4K>`UIemV4F)!>Hvv*)?5&!f=YO kW+?&l+=YeEH-oPpt`9ttw!?7i1`SlV774ugTwebF01?>9A^-pY literal 0 HcmV?d00001 From 0d9fa16a1f5ec11d22e4a03942a563940f7c35f4 Mon Sep 17 00:00:00 2001 From: Bhanu Pulluri <59369753+pullurib@users.noreply.github.com> Date: Wed, 18 Sep 2024 05:35:00 -0400 Subject: [PATCH 13/47] [#4292] Fix mounted data path directory permissions for besu user (#7575) * Fix mounted data path directory permissions for besu user Signed-off-by: Bhanu Pulluri * Add besu CLI option to output dirs needing permission update Signed-off-by: Bhanu Pulluri * run spotless apply to handle PR test failure Signed-off-by: Bhanu Pulluri * Remove newly added --print-paths-and-exit option from config file test This option doesn't have a corresponding config file entry as it's a standalone option to be used with docker containers Signed-off-by: Bhanu Pulluri * Add optional user argument to --print-paths-and-exit and fix directory permissions Signed-off-by: Bhanu Pulluri * Correct build.gradle changes, remove a duplicate line and extra whitespaces Signed-off-by: Bhanu Pulluri * Fix checking for user in path's group membership Signed-off-by: Bhanu Pulluri * Add platform check to restrict --print-paths-and-exit option usage to Linux and Mac Signed-off-by: Bhanu Pulluri * Apply suggestions from code review Co-authored-by: Fabio Di Fabio Signed-off-by: Bhanu Pulluri <59369753+pullurib@users.noreply.github.com> --------- Signed-off-by: Bhanu Pulluri Signed-off-by: Bhanu Pulluri <59369753+pullurib@users.noreply.github.com> Co-authored-by: Bhanu Pulluri Co-authored-by: Fabio Di Fabio --- CHANGELOG.md | 2 + .../org/hyperledger/besu/cli/BesuCommand.java | 137 ++++++++++++++++++ besu/src/main/scripts/besu-entry.sh | 49 +++++++ .../hyperledger/besu/cli/BesuCommandTest.java | 1 + build.gradle | 1 + docker/Dockerfile | 10 +- docker/test.sh | 8 + docker/tests/02/goss.yaml | 10 ++ docker/tests/dgoss | 2 +- 9 files changed, 217 insertions(+), 3 deletions(-) create mode 100755 besu/src/main/scripts/besu-entry.sh create mode 100644 docker/tests/02/goss.yaml diff --git a/CHANGELOG.md b/CHANGELOG.md index c2418386370..d30ad08c98e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,8 +11,10 @@ - Remove privacy test classes support [#7569](https://github.com/hyperledger/besu/pull/7569) ### Bug fixes +- Fix mounted data path directory permissions for besu user [#7575](https://github.com/hyperledger/besu/pull/7575) - Fix for `debug_traceCall` to handle transactions without specified gas price. [#7510](https://github.com/hyperledger/besu/pull/7510) + ## 24.9.1 ### Upcoming Breaking Changes diff --git a/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java b/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java index ecfc0eaadb2..01ee6172f60 100644 --- a/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java +++ b/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java @@ -16,6 +16,7 @@ import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkState; +import static java.nio.charset.StandardCharsets.UTF_8; import static java.util.Arrays.asList; import static java.util.Collections.singletonList; import static org.hyperledger.besu.cli.DefaultCommandValues.getDefaultBesuDataPath; @@ -203,16 +204,23 @@ import org.hyperledger.besu.util.number.Percentage; import org.hyperledger.besu.util.number.PositiveNumber; +import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.io.InputStream; +import java.io.InputStreamReader; import java.math.BigInteger; import java.net.InetAddress; import java.net.SocketException; import java.net.URI; import java.net.URL; import java.net.UnknownHostException; +import java.nio.file.Files; import java.nio.file.Path; +import java.nio.file.attribute.GroupPrincipal; +import java.nio.file.attribute.PosixFileAttributes; +import java.nio.file.attribute.PosixFilePermission; +import java.nio.file.attribute.UserPrincipal; import java.time.Clock; import java.util.ArrayList; import java.util.Arrays; @@ -232,6 +240,7 @@ import java.util.stream.Collectors; import com.google.common.annotations.VisibleForTesting; +import com.google.common.base.Splitter; import com.google.common.base.Strings; import com.google.common.base.Suppliers; import com.google.common.collect.ImmutableMap; @@ -243,6 +252,8 @@ import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.units.bigints.UInt256; import org.slf4j.Logger; +import oshi.PlatformEnum; +import oshi.SystemInfo; import picocli.AutoComplete; import picocli.CommandLine; import picocli.CommandLine.Command; @@ -382,6 +393,28 @@ public class BesuCommand implements DefaultCommandValues, Runnable { arity = "1") private final Optional identityString = Optional.empty(); + private Boolean printPathsAndExit = Boolean.FALSE; + private String besuUserName = "besu"; + + @Option( + names = "--print-paths-and-exit", + paramLabel = "", + description = "Print the configured paths and exit without starting the node.", + arity = "0..1") + void setUserName(final String userName) { + PlatformEnum currentPlatform = SystemInfo.getCurrentPlatform(); + // Only allow on Linux and macOS + if (currentPlatform == PlatformEnum.LINUX || currentPlatform == PlatformEnum.MACOS) { + if (userName != null) { + besuUserName = userName; + } + printPathsAndExit = Boolean.TRUE; + } else { + throw new UnsupportedOperationException( + "--print-paths-and-exit is only supported on Linux and macOS."); + } + } + // P2P Discovery Option Group @CommandLine.ArgGroup(validate = false, heading = "@|bold P2P Discovery Options|@%n") P2PDiscoveryOptionGroup p2PDiscoveryOptionGroup = new P2PDiscoveryOptionGroup(); @@ -1093,6 +1126,12 @@ public void run() { try { configureLogging(true); + if (printPathsAndExit) { + // Print configured paths requiring read/write permissions to be adjusted + checkPermissionsAndPrintPaths(besuUserName); + System.exit(0); // Exit before any services are started + } + // set merge config on the basis of genesis config setMergeConfigOptions(); @@ -1138,6 +1177,104 @@ public void run() { } } + private void checkPermissionsAndPrintPaths(final String userName) { + // Check permissions for the data path + checkPermissions(dataDir(), userName, false); + + // Check permissions for genesis file + try { + if (genesisFile != null) { + checkPermissions(genesisFile.toPath(), userName, true); + } + } catch (Exception e) { + commandLine + .getOut() + .println("Error: Failed checking genesis file: Reason: " + e.getMessage()); + } + } + + // Helper method to check permissions on a given path + private void checkPermissions(final Path path, final String besuUser, final boolean readOnly) { + try { + // Get the permissions of the file + // check if besu user is the owner - get owner permissions if yes + // else, check if besu user and owner are in the same group - if yes, check the group + // permission + // otherwise check permissions for others + + // Get the owner of the file or directory + UserPrincipal owner = Files.getOwner(path); + boolean hasReadPermission, hasWritePermission; + + // Get file permissions + Set permissions = Files.getPosixFilePermissions(path); + + // Check if besu is the owner + if (owner.getName().equals(besuUser)) { + // Owner permissions + hasReadPermission = permissions.contains(PosixFilePermission.OWNER_READ); + hasWritePermission = permissions.contains(PosixFilePermission.OWNER_WRITE); + } else { + // Get the group of the file + // Get POSIX file attributes and then group + PosixFileAttributes attrs = Files.readAttributes(path, PosixFileAttributes.class); + GroupPrincipal group = attrs.group(); + + // Check if besu user belongs to this group + boolean isMember = isGroupMember(besuUserName, group); + + if (isMember) { + // Group's permissions + hasReadPermission = permissions.contains(PosixFilePermission.GROUP_READ); + hasWritePermission = permissions.contains(PosixFilePermission.GROUP_WRITE); + } else { + // Others' permissions + hasReadPermission = permissions.contains(PosixFilePermission.OTHERS_READ); + hasWritePermission = permissions.contains(PosixFilePermission.OTHERS_WRITE); + } + } + + if (!hasReadPermission || (!readOnly && !hasWritePermission)) { + String accessType = readOnly ? "READ" : "READ_WRITE"; + commandLine.getOut().println("PERMISSION_CHECK_PATH:" + path + ":" + accessType); + } + } catch (Exception e) { + // Do nothing upon catching an error + commandLine + .getOut() + .println( + "Error: Failed to check permissions for path: '" + + path + + "'. Reason: " + + e.getMessage()); + } + } + + private static boolean isGroupMember(final String userName, final GroupPrincipal group) + throws IOException { + // Get the groups of the user by executing 'id -Gn username' + Process process = Runtime.getRuntime().exec(new String[] {"id", "-Gn", userName}); + BufferedReader reader = + new BufferedReader(new InputStreamReader(process.getInputStream(), UTF_8)); + + // Read the output of the command + String line = reader.readLine(); + boolean isMember = false; + if (line != null) { + // Split the groups + Iterable userGroups = Splitter.on(" ").split(line); + // Check if any of the user's groups match the file's group + + for (String grp : userGroups) { + if (grp.equals(group.getName())) { + isMember = true; + break; + } + } + } + return isMember; + } + @VisibleForTesting void setBesuConfiguration(final BesuConfigurationImpl pluginCommonConfiguration) { this.pluginCommonConfiguration = pluginCommonConfiguration; diff --git a/besu/src/main/scripts/besu-entry.sh b/besu/src/main/scripts/besu-entry.sh new file mode 100755 index 00000000000..ed3687b2291 --- /dev/null +++ b/besu/src/main/scripts/besu-entry.sh @@ -0,0 +1,49 @@ +#!/bin/bash +## +## Copyright contributors to Hyperledger Besu. +## +## Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with +## the License. You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on +## an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the +## specific language governing permissions and limitations under the License. +## +## SPDX-License-Identifier: Apache-2.0 +## + +# Run Besu first to get paths needing permission adjustment +output=$(/opt/besu/bin/besu --print-paths-and-exit $BESU_USER_NAME "$@") + +# Parse the output to find the paths and their required access types +echo "$output" | while IFS=: read -r prefix path accessType; do + if [[ "$prefix" == "PERMISSION_CHECK_PATH" ]]; then + # Change ownership to besu user and group + chown -R $BESU_USER_NAME:$BESU_USER_NAME $path + + # Ensure read/write permissions for besu user + + echo "Setting permissions for: $path with access: $accessType" + + if [[ "$accessType" == "READ" ]]; then + # Set read-only permissions for besu user + # Add execute for directories to allow access + find $path -type d -exec chmod u+rx {} \; + find $path -type f -exec chmod u+r {} \; + elif [[ "$accessType" == "READ_WRITE" ]]; then + # Set read/write permissions for besu user + # Add execute for directories to allow access + find $path -type d -exec chmod u+rwx {} \; + find $path -type f -exec chmod u+rw {} \; + fi + fi +done + +# Finally, run Besu with the actual arguments passed to the container +# Construct the command as a single string +COMMAND="/opt/besu/bin/besu $@" + +# Switch to the besu user and execute the command +exec su -s /bin/bash $BESU_USER_NAME -c "$COMMAND" diff --git a/besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java b/besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java index e6e0e859517..99b45ada1b8 100644 --- a/besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java +++ b/besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java @@ -390,6 +390,7 @@ public void tomlThatConfiguresEverythingExceptPermissioningToml() throws IOExcep options.remove(spec.optionsMap().get("--config-file")); options.remove(spec.optionsMap().get("--help")); options.remove(spec.optionsMap().get("--version")); + options.remove(spec.optionsMap().get("--print-paths-and-exit")); for (final String tomlKey : tomlResult.keySet()) { final CommandLine.Model.OptionSpec optionSpec = spec.optionsMap().get("--" + tomlKey); diff --git a/build.gradle b/build.gradle index 792355417f4..ee4392c9fc1 100644 --- a/build.gradle +++ b/build.gradle @@ -1097,6 +1097,7 @@ distributions { from("build/reports/license/license-dependency.html") { into "." } from("./docs/GettingStartedBinaries.md") { into "." } from("./docs/DocsArchive0.8.0.html") { into "." } + from("./besu/src/main/scripts/besu-entry.sh") { into "./bin/" } from(autocomplete) { into "." } } } diff --git a/docker/Dockerfile b/docker/Dockerfile index c16345a82bd..a45a3ac73d8 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -18,7 +18,8 @@ RUN apt-get update $NO_PROXY_CACHE && \ chown besu:besu /opt/besu && \ chmod 0755 /opt/besu -USER besu +ARG BESU_USER=besu +USER ${BESU_USER} WORKDIR /opt/besu COPY --chown=besu:besu besu /opt/besu/ @@ -43,7 +44,12 @@ ENV OTEL_RESOURCE_ATTRIBUTES="service.name=besu,service.version=$VERSION" ENV OLDPATH="${PATH}" ENV PATH="/opt/besu/bin:${OLDPATH}" -ENTRYPOINT ["besu"] +USER root +RUN chmod +x /opt/besu/bin/besu-entry.sh + +ENV BESU_USER_NAME=${BESU_USER} + +ENTRYPOINT ["besu-entry.sh"] HEALTHCHECK --start-period=5s --interval=5s --timeout=1s --retries=10 CMD bash -c "[ -f /tmp/pid ]" # Build-time metadata as defined at http://label-schema.org diff --git a/docker/test.sh b/docker/test.sh index 6e08db13b55..e230f79ad1c 100755 --- a/docker/test.sh +++ b/docker/test.sh @@ -41,4 +41,12 @@ bash $TEST_PATH/dgoss run --sysctl net.ipv6.conf.all.disable_ipv6=1 $DOCKER_IMAG --graphql-http-enabled \ > ./reports/01.xml || i=`expr $i + 1` +if [[ $i != 0 ]]; then exit $i; fi + +# Test for directory permissions +GOSS_FILES_PATH=$TEST_PATH/02 \ +bash $TEST_PATH/dgoss run --sysctl net.ipv6.conf.all.disable_ipv6=1 -v besu-data:/var/lib/besu $DOCKER_IMAGE --data-path=/var/lib/besu \ +--network=dev \ +> ./reports/02.xml || i=`expr $i + 1` + exit $i diff --git a/docker/tests/02/goss.yaml b/docker/tests/02/goss.yaml new file mode 100644 index 00000000000..d266cafa399 --- /dev/null +++ b/docker/tests/02/goss.yaml @@ -0,0 +1,10 @@ +--- +# runtime docker tests +file: + /var/lib/besu: + exists: true + owner: besu + mode: "0755" +process: + java: + running: true diff --git a/docker/tests/dgoss b/docker/tests/dgoss index 59bbc4683e1..170270eff35 100755 --- a/docker/tests/dgoss +++ b/docker/tests/dgoss @@ -76,7 +76,7 @@ GOSS_PATH="${GOSS_PATH:-$(which goss 2> /dev/null || true)}" [[ $GOSS_PATH ]] || { error "Couldn't find goss installation, please set GOSS_PATH to it"; } [[ ${GOSS_OPTS+x} ]] || GOSS_OPTS="--color --format documentation" [[ ${GOSS_WAIT_OPTS+x} ]] || GOSS_WAIT_OPTS="-r 30s -s 1s > /dev/null" -GOSS_SLEEP=${GOSS_SLEEP:-0.2} +GOSS_SLEEP=${GOSS_SLEEP:-1.0} case "$1" in run) From 6df4149f2a04555fb36702911b8f6142b843c5b3 Mon Sep 17 00:00:00 2001 From: Fabio Di Fabio Date: Wed, 18 Sep 2024 15:55:10 +0200 Subject: [PATCH 14/47] Fix logging the evaluation time when a tx is selected for block creation (#7636) Signed-off-by: Fabio Di Fabio --- .../blockcreation/txselection/BlockTransactionSelector.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/txselection/BlockTransactionSelector.java b/ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/txselection/BlockTransactionSelector.java index 3d56c1fc07b..e07b43b9904 100644 --- a/ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/txselection/BlockTransactionSelector.java +++ b/ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/txselection/BlockTransactionSelector.java @@ -401,7 +401,7 @@ private TransactionSelectionResult handleTransactionSelected( LOG.atTrace() .setMessage("Selected {} for block creation, evaluated in {}") .addArgument(transaction::toTraceLog) - .addArgument(evaluationContext.getPendingTransaction()) + .addArgument(evaluationContext.getEvaluationTimer()) .log(); return SELECTED; } From 7d3e376771f99598e3730a0569793c7c1bd58834 Mon Sep 17 00:00:00 2001 From: Justin Florentine Date: Wed, 18 Sep 2024 10:31:03 -0400 Subject: [PATCH 15/47] shift creation of plugin context to BesuCommand for now (#7625) * shift creation of plugin context to BesuCommand for now * mock component will provide a no-op metrics sys --------- Signed-off-by: Justin Florentine --- CHANGELOG.md | 1 + .../dsl/node/ProcessBesuNodeRunner.java | 125 +++++++++--------- .../dsl/node/ThreadBesuNodeRunner.java | 23 ++-- .../main/java/org/hyperledger/besu/Besu.java | 5 +- .../org/hyperledger/besu/cli/BesuCommand.java | 38 ++++-- .../besu/components/BesuCommandModule.java | 12 +- .../besu/components/BesuComponent.java | 4 +- .../components/BesuPluginContextModule.java | 16 --- .../controller/BesuControllerBuilder.java | 2 +- .../besu/cli/CommandTestAbstract.java | 7 + .../components/MockBesuCommandModule.java | 16 +++ .../BonsaiCachedMerkleTrieLoaderModule.java | 5 +- .../besu/metrics/MetricsSystemModule.java | 6 - .../opentelemetry/OpenTelemetrySystem.java | 2 + 14 files changed, 148 insertions(+), 114 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d30ad08c98e..ff4d7cfbf94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ ### Bug fixes - Fix mounted data path directory permissions for besu user [#7575](https://github.com/hyperledger/besu/pull/7575) - Fix for `debug_traceCall` to handle transactions without specified gas price. [#7510](https://github.com/hyperledger/besu/pull/7510) +- Corrects a regression where custom plugin services are not initialized correctly. [#7625](https://github.com/hyperledger/besu/pull/7625) ## 24.9.1 diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ProcessBesuNodeRunner.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ProcessBesuNodeRunner.java index c6696b15a22..6e00701ef2b 100644 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ProcessBesuNodeRunner.java +++ b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ProcessBesuNodeRunner.java @@ -75,6 +75,70 @@ public void startNode(final BesuNode node) { final Path dataDir = node.homeDirectory(); + final List params = commandlineArgs(node, dataDir); + + LOG.info("Creating besu process with params {}", params); + final ProcessBuilder processBuilder = + new ProcessBuilder(params) + .directory(new File(System.getProperty("user.dir")).getParentFile().getParentFile()) + .redirectErrorStream(true) + .redirectInput(Redirect.INHERIT); + if (!node.getPlugins().isEmpty()) { + processBuilder + .environment() + .put( + "BESU_OPTS", + "-Dbesu.plugins.dir=" + dataDir.resolve("plugins").toAbsolutePath().toString()); + } + // Use non-blocking randomness for acceptance tests + processBuilder + .environment() + .put( + "JAVA_OPTS", + "-Djava.security.properties=" + + "acceptance-tests/tests/build/resources/test/acceptanceTesting.security"); + // add additional environment variables + processBuilder.environment().putAll(node.getEnvironment()); + + try { + int debugPort = Integer.parseInt(System.getenv("BESU_DEBUG_CHILD_PROCESS_PORT")); + LOG.warn("Waiting for debugger to attach to SUSPENDED child process"); + String debugOpts = + " -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:" + debugPort; + String prevJavaOpts = processBuilder.environment().get("JAVA_OPTS"); + if (prevJavaOpts == null) { + processBuilder.environment().put("JAVA_OPTS", debugOpts); + } else { + processBuilder.environment().put("JAVA_OPTS", prevJavaOpts + debugOpts); + } + + } catch (NumberFormatException e) { + LOG.debug( + "Child process may be attached to by exporting BESU_DEBUG_CHILD_PROCESS_PORT= to env"); + } + + try { + checkState( + isNotAliveOrphan(node.getName()), + "A live process with name: %s, already exists. Cannot create another with the same name as it would orphan the first", + node.getName()); + + final Process process = processBuilder.start(); + process.onExit().thenRun(() -> node.setExitCode(process.exitValue())); + outputProcessorExecutor.execute(() -> printOutput(node, process)); + besuProcesses.put(node.getName(), process); + } catch (final IOException e) { + LOG.error("Error starting BesuNode process", e); + } + + if (node.getRunCommand().isEmpty()) { + waitForFile(dataDir, "besu.ports"); + waitForFile(dataDir, "besu.networks"); + } + MDC.remove("node"); + } + + private List commandlineArgs(final BesuNode node, final Path dataDir) { final List params = new ArrayList<>(); params.add("build/install/besu/bin/besu"); @@ -388,66 +452,7 @@ public void startNode(final BesuNode node) { } params.addAll(node.getRunCommand()); - - LOG.info("Creating besu process with params {}", params); - final ProcessBuilder processBuilder = - new ProcessBuilder(params) - .directory(new File(System.getProperty("user.dir")).getParentFile().getParentFile()) - .redirectErrorStream(true) - .redirectInput(Redirect.INHERIT); - if (!node.getPlugins().isEmpty()) { - processBuilder - .environment() - .put( - "BESU_OPTS", - "-Dbesu.plugins.dir=" + dataDir.resolve("plugins").toAbsolutePath().toString()); - } - // Use non-blocking randomness for acceptance tests - processBuilder - .environment() - .put( - "JAVA_OPTS", - "-Djava.security.properties=" - + "acceptance-tests/tests/build/resources/test/acceptanceTesting.security"); - // add additional environment variables - processBuilder.environment().putAll(node.getEnvironment()); - - try { - int debugPort = Integer.parseInt(System.getenv("BESU_DEBUG_CHILD_PROCESS_PORT")); - LOG.warn("Waiting for debugger to attach to SUSPENDED child process"); - String debugOpts = - " -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:" + debugPort; - String prevJavaOpts = processBuilder.environment().get("JAVA_OPTS"); - if (prevJavaOpts == null) { - processBuilder.environment().put("JAVA_OPTS", debugOpts); - } else { - processBuilder.environment().put("JAVA_OPTS", prevJavaOpts + debugOpts); - } - - } catch (NumberFormatException e) { - LOG.debug( - "Child process may be attached to by exporting BESU_DEBUG_CHILD_PROCESS_PORT= to env"); - } - - try { - checkState( - isNotAliveOrphan(node.getName()), - "A live process with name: %s, already exists. Cannot create another with the same name as it would orphan the first", - node.getName()); - - final Process process = processBuilder.start(); - process.onExit().thenRun(() -> node.setExitCode(process.exitValue())); - outputProcessorExecutor.execute(() -> printOutput(node, process)); - besuProcesses.put(node.getName(), process); - } catch (final IOException e) { - LOG.error("Error starting BesuNode process", e); - } - - if (node.getRunCommand().isEmpty()) { - waitForFile(dataDir, "besu.ports"); - waitForFile(dataDir, "besu.networks"); - } - MDC.remove("node"); + return params; } private boolean isNotAliveOrphan(final String name) { diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ThreadBesuNodeRunner.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ThreadBesuNodeRunner.java index d4ec54045d3..5d78f1460c4 100644 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ThreadBesuNodeRunner.java +++ b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ThreadBesuNodeRunner.java @@ -138,7 +138,8 @@ public void startNode(final BesuNode node) { final PermissioningServiceImpl permissioningService = new PermissioningServiceImpl(); GlobalOpenTelemetry.resetForTest(); - final ObservableMetricsSystem metricsSystem = component.getObservableMetricsSystem(); + final ObservableMetricsSystem metricsSystem = + (ObservableMetricsSystem) component.getMetricsSystem(); final List bootnodes = node.getConfiguration().getBootnodes().stream().map(EnodeURLImpl::fromURI).toList(); @@ -280,6 +281,16 @@ public BesuNodeProviderModule(final BesuNode toProvide) { this.toProvide = toProvide; } + @Provides + @Singleton + MetricsConfiguration provideMetricsConfiguration() { + if (toProvide.getMetricsConfiguration() != null) { + return toProvide.getMetricsConfiguration(); + } else { + return MetricsConfiguration.builder().build(); + } + } + @Provides public BesuNode provideBesuNodeRunner() { return toProvide; @@ -410,13 +421,13 @@ public BesuControllerBuilder provideBesuControllerBuilder( public BesuController provideBesuController( final SynchronizerConfiguration synchronizerConfiguration, final BesuControllerBuilder builder, - final ObservableMetricsSystem metricsSystem, + final MetricsSystem metricsSystem, final KeyValueStorageProvider storageProvider, final MiningParameters miningParameters) { builder .synchronizerConfiguration(synchronizerConfiguration) - .metricsSystem(metricsSystem) + .metricsSystem((ObservableMetricsSystem) metricsSystem) .dataStorageConfiguration(DataStorageConfiguration.DEFAULT_FOREST_CONFIG) .ethProtocolConfiguration(EthProtocolConfiguration.defaultConfig()) .clock(Clock.systemUTC()) @@ -562,12 +573,6 @@ BesuCommand provideBesuCommand(final BesuPluginContextImpl pluginContext) { return besuCommand; } - @Provides - @Singleton - MetricsConfiguration provideMetricsConfiguration() { - return MetricsConfiguration.builder().build(); - } - @Provides @Named("besuCommandLogger") @Singleton diff --git a/besu/src/main/java/org/hyperledger/besu/Besu.java b/besu/src/main/java/org/hyperledger/besu/Besu.java index 8d40a10eb49..3ba0af0a9b1 100644 --- a/besu/src/main/java/org/hyperledger/besu/Besu.java +++ b/besu/src/main/java/org/hyperledger/besu/Besu.java @@ -16,6 +16,7 @@ import org.hyperledger.besu.cli.BesuCommand; import org.hyperledger.besu.cli.logging.BesuLoggingConfigurationFactory; +import org.hyperledger.besu.components.BesuComponent; import org.hyperledger.besu.components.DaggerBesuComponent; import io.netty.util.internal.logging.InternalLoggerFactory; @@ -36,13 +37,15 @@ public Besu() {} */ public static void main(final String... args) { setupLogging(); - final BesuCommand besuCommand = DaggerBesuComponent.create().getBesuCommand(); + final BesuComponent besuComponent = DaggerBesuComponent.create(); + final BesuCommand besuCommand = besuComponent.getBesuCommand(); int exitCode = besuCommand.parse( new RunLast(), besuCommand.parameterExceptionHandler(), besuCommand.executionExceptionHandler(), System.in, + besuComponent, args); System.exit(exitCode); diff --git a/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java b/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java index 01ee6172f60..79879538bd5 100644 --- a/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java +++ b/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java @@ -85,6 +85,7 @@ import org.hyperledger.besu.cli.util.CommandLineUtils; import org.hyperledger.besu.cli.util.ConfigDefaultValueProviderStrategy; import org.hyperledger.besu.cli.util.VersionProvider; +import org.hyperledger.besu.components.BesuComponent; import org.hyperledger.besu.config.CheckpointConfigOptions; import org.hyperledger.besu.config.GenesisConfigFile; import org.hyperledger.besu.config.GenesisConfigOptions; @@ -145,7 +146,6 @@ import org.hyperledger.besu.metrics.BesuMetricCategory; import org.hyperledger.besu.metrics.MetricCategoryRegistryImpl; import org.hyperledger.besu.metrics.MetricsProtocol; -import org.hyperledger.besu.metrics.MetricsSystemFactory; import org.hyperledger.besu.metrics.ObservableMetricsSystem; import org.hyperledger.besu.metrics.StandardMetricCategory; import org.hyperledger.besu.metrics.prometheus.MetricsConfiguration; @@ -423,6 +423,7 @@ void setUserName(final String userName) { private final TransactionPoolValidatorServiceImpl transactionValidatorServiceImpl; private final TransactionSimulationServiceImpl transactionSimulationServiceImpl; private final BlockchainServiceImpl blockchainServiceImpl; + private BesuComponent besuComponent; static class P2PDiscoveryOptionGroup { @@ -897,9 +898,6 @@ static class PrivacyOptionGroup { private BesuController besuController; private BesuConfigurationImpl pluginCommonConfiguration; - private final Supplier metricsSystem = - Suppliers.memoize(() -> MetricsSystemFactory.create(metricsConfiguration())); - private Vertx vertx; private EnodeDnsConfiguration enodeDnsConfiguration; private KeyValueStorageProvider keyValueStorageProvider; @@ -1029,6 +1027,7 @@ protected BesuCommand( * @param parameterExceptionHandler Handler for exceptions related to command line parameters. * @param executionExceptionHandler Handler for exceptions during command execution. * @param in The input stream for commands. + * @param besuComponent The Besu component. * @param args The command line arguments. * @return The execution result status code. */ @@ -1037,8 +1036,12 @@ public int parse( final BesuParameterExceptionHandler parameterExceptionHandler, final BesuExecutionExceptionHandler executionExceptionHandler, final InputStream in, + final BesuComponent besuComponent, final String... args) { - + if (besuComponent == null) { + throw new IllegalArgumentException("BesuComponent must be provided"); + } + this.besuComponent = besuComponent; initializeCommandLineSettings(in); // Create the execution strategy chain. @@ -1142,7 +1145,7 @@ public void run() { logger.info("Starting Besu"); // Need to create vertx after cmdline has been parsed, such that metricsSystem is configurable - vertx = createVertx(createVertxOptions(metricsSystem.get())); + vertx = createVertx(createVertxOptions(besuComponent.getMetricsSystem())); validateOptions(); @@ -1527,8 +1530,8 @@ private void validatePrivacyPluginOptions() { } private void setReleaseMetrics() { - metricsSystem - .get() + besuComponent + .getMetricsSystem() .createLabelledGauge( StandardMetricCategory.PROCESS, "release", "Release information", "version") .labels(() -> 1, BesuInfo.version()); @@ -1992,7 +1995,7 @@ public BesuControllerBuilder setupControllerBuilder() { .miningParameters(miningParametersSupplier.get()) .transactionPoolConfiguration(buildTransactionPoolConfiguration()) .nodeKey(new NodeKey(securityModule())) - .metricsSystem(metricsSystem.get()) + .metricsSystem((ObservableMetricsSystem) besuComponent.getMetricsSystem()) .messagePermissioningProviders(permissioningService.getMessagePermissioningProviders()) .privacyParameters(privacyParameters()) .clock(Clock.systemUTC()) @@ -2012,7 +2015,8 @@ public BesuControllerBuilder setupControllerBuilder() { .randomPeerPriority(p2PDiscoveryOptionGroup.randomPeerPriority) .chainPruningConfiguration(unstableChainPruningOptions.toDomainObject()) .cacheLastBlocks(numberOfblocksToCache) - .genesisStateHashCacheEnabled(genesisStateHashCacheEnabled); + .genesisStateHashCacheEnabled(genesisStateHashCacheEnabled) + .besuComponent(besuComponent); } private JsonRpcConfiguration createEngineJsonRpcConfiguration( @@ -2414,7 +2418,6 @@ private Runner synchronize( p2pTLSConfiguration.ifPresent(runnerBuilder::p2pTLSConfiguration); - final ObservableMetricsSystem metricsSystem = this.metricsSystem.get(); final Runner runner = runnerBuilder .vertx(vertx) @@ -2441,7 +2444,7 @@ private Runner synchronize( .pidPath(pidPath) .dataDir(dataDir()) .bannedNodeIds(p2PDiscoveryOptionGroup.bannedNodeIds) - .metricsSystem(metricsSystem) + .metricsSystem((ObservableMetricsSystem) besuComponent.getMetricsSystem()) .permissioningService(permissioningService) .metricsConfiguration(metricsConfiguration) .staticNodes(staticNodes) @@ -2608,7 +2611,7 @@ private File resolveNodePrivateKeyFile(final File nodePrivateKeyFile) { * @return Instance of MetricsSystem */ public MetricsSystem getMetricsSystem() { - return metricsSystem.get(); + return besuComponent.getMetricsSystem(); } private Set loadStaticNodes() throws IOException { @@ -2946,4 +2949,13 @@ && getDataStorageConfiguration().getBonsaiLimitTrieLogsEnabled()) { return builder.build(); } + + /** + * Returns the plugin context. + * + * @return the plugin context. + */ + public BesuPluginContextImpl getBesuPluginContext() { + return besuPluginContext; + } } diff --git a/besu/src/main/java/org/hyperledger/besu/components/BesuCommandModule.java b/besu/src/main/java/org/hyperledger/besu/components/BesuCommandModule.java index 86aa8c75949..59e2d60bf37 100644 --- a/besu/src/main/java/org/hyperledger/besu/components/BesuCommandModule.java +++ b/besu/src/main/java/org/hyperledger/besu/components/BesuCommandModule.java @@ -42,9 +42,7 @@ public BesuCommandModule() {} @Provides @Singleton - BesuCommand provideBesuCommand( - final BesuPluginContextImpl pluginContext, - final @Named("besuCommandLogger") Logger commandLogger) { + BesuCommand provideBesuCommand(final @Named("besuCommandLogger") Logger commandLogger) { final BesuCommand besuCommand = new BesuCommand( RlpBlockImporter::new, @@ -52,7 +50,7 @@ BesuCommand provideBesuCommand( RlpBlockExporter::new, new RunnerBuilder(), new BesuController.Builder(), - pluginContext, + new BesuPluginContextImpl(), System.getenv(), commandLogger); besuCommand.toCommandLine(); @@ -71,4 +69,10 @@ MetricsConfiguration provideMetricsConfiguration(final BesuCommand provideFrom) Logger provideBesuCommandLogger() { return Besu.getFirstLogger(); } + + @Provides + @Singleton + BesuPluginContextImpl provideBesuPluginContextImpl(final BesuCommand provideFrom) { + return provideFrom.getBesuPluginContext(); + } } diff --git a/besu/src/main/java/org/hyperledger/besu/components/BesuComponent.java b/besu/src/main/java/org/hyperledger/besu/components/BesuComponent.java index 9f810a6dc6e..b0d5c3da0f0 100644 --- a/besu/src/main/java/org/hyperledger/besu/components/BesuComponent.java +++ b/besu/src/main/java/org/hyperledger/besu/components/BesuComponent.java @@ -20,7 +20,7 @@ import org.hyperledger.besu.ethereum.trie.diffbased.bonsai.cache.BonsaiCachedMerkleTrieLoader; import org.hyperledger.besu.ethereum.trie.diffbased.bonsai.cache.BonsaiCachedMerkleTrieLoaderModule; import org.hyperledger.besu.metrics.MetricsSystemModule; -import org.hyperledger.besu.metrics.ObservableMetricsSystem; +import org.hyperledger.besu.plugin.services.MetricsSystem; import org.hyperledger.besu.services.BesuPluginContextImpl; import javax.inject.Named; @@ -60,7 +60,7 @@ public interface BesuComponent { * * @return ObservableMetricsSystem */ - ObservableMetricsSystem getObservableMetricsSystem(); + MetricsSystem getMetricsSystem(); /** * a Logger specifically configured to provide configuration feedback to users. diff --git a/besu/src/main/java/org/hyperledger/besu/components/BesuPluginContextModule.java b/besu/src/main/java/org/hyperledger/besu/components/BesuPluginContextModule.java index d62ab702244..702b63af190 100644 --- a/besu/src/main/java/org/hyperledger/besu/components/BesuPluginContextModule.java +++ b/besu/src/main/java/org/hyperledger/besu/components/BesuPluginContextModule.java @@ -14,9 +14,7 @@ */ package org.hyperledger.besu.components; -import org.hyperledger.besu.plugin.services.BesuConfiguration; import org.hyperledger.besu.services.BesuConfigurationImpl; -import org.hyperledger.besu.services.BesuPluginContextImpl; import javax.inject.Singleton; @@ -35,18 +33,4 @@ public BesuPluginContextModule() {} BesuConfigurationImpl provideBesuPluginConfig() { return new BesuConfigurationImpl(); } - - /** - * Creates a BesuPluginContextImpl, used for plugin service discovery. - * - * @param pluginConfig the BesuConfigurationImpl - * @return the BesuPluginContext - */ - @Provides - @Singleton - public BesuPluginContextImpl provideBesuPluginContext(final BesuConfigurationImpl pluginConfig) { - BesuPluginContextImpl retval = new BesuPluginContextImpl(); - retval.addService(BesuConfiguration.class, pluginConfig); - return retval; - } } diff --git a/besu/src/main/java/org/hyperledger/besu/controller/BesuControllerBuilder.java b/besu/src/main/java/org/hyperledger/besu/controller/BesuControllerBuilder.java index 6bb3fb117c1..bded2a38ac7 100644 --- a/besu/src/main/java/org/hyperledger/besu/controller/BesuControllerBuilder.java +++ b/besu/src/main/java/org/hyperledger/besu/controller/BesuControllerBuilder.java @@ -552,7 +552,7 @@ public BesuController build() { checkNotNull(evmConfiguration, "Missing evm config"); checkNotNull(networkingConfiguration, "Missing network configuration"); checkNotNull(dataStorageConfiguration, "Missing data storage configuration"); - + checkNotNull(besuComponent, "Must supply a BesuComponent"); prepForBuild(); final ProtocolSchedule protocolSchedule = createProtocolSchedule(); diff --git a/besu/src/test/java/org/hyperledger/besu/cli/CommandTestAbstract.java b/besu/src/test/java/org/hyperledger/besu/cli/CommandTestAbstract.java index 7d11a4a8e99..5b1274389d6 100644 --- a/besu/src/test/java/org/hyperledger/besu/cli/CommandTestAbstract.java +++ b/besu/src/test/java/org/hyperledger/besu/cli/CommandTestAbstract.java @@ -42,6 +42,7 @@ import org.hyperledger.besu.cli.options.unstable.MetricsCLIOptions; import org.hyperledger.besu.cli.options.unstable.NetworkingOptions; import org.hyperledger.besu.cli.options.unstable.SynchronizerOptions; +import org.hyperledger.besu.components.BesuComponent; import org.hyperledger.besu.config.GenesisConfigOptions; import org.hyperledger.besu.controller.BesuController; import org.hyperledger.besu.controller.BesuControllerBuilder; @@ -69,6 +70,7 @@ import org.hyperledger.besu.ethereum.storage.StorageProvider; import org.hyperledger.besu.ethereum.worldstate.DataStorageConfiguration; import org.hyperledger.besu.ethereum.worldstate.WorldStateArchive; +import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem; import org.hyperledger.besu.metrics.prometheus.MetricsConfiguration; import org.hyperledger.besu.plugin.services.PicoCLIOptions; import org.hyperledger.besu.plugin.services.StorageService; @@ -204,6 +206,9 @@ public abstract class CommandTestAbstract { @Mock(lenient = true) protected BesuController mockController; + @Mock(lenient = true) + protected BesuComponent mockBesuComponent; + @Mock protected RlpBlockExporter rlpBlockExporter; @Mock protected JsonBlockImporter jsonBlockImporter; @Mock protected RlpBlockImporter rlpBlockImporter; @@ -344,6 +349,7 @@ public void initMocks() throws Exception { when(mockRunnerBuilder.allowedSubnets(any())).thenReturn(mockRunnerBuilder); when(mockRunnerBuilder.poaDiscoveryRetryBootnodes(anyBoolean())).thenReturn(mockRunnerBuilder); when(mockRunnerBuilder.build()).thenReturn(mockRunner); + when(mockBesuComponent.getMetricsSystem()).thenReturn(new NoOpMetricsSystem()); final SignatureAlgorithm signatureAlgorithm = SignatureAlgorithmFactory.getInstance(); @@ -451,6 +457,7 @@ protected TestBesuCommand parseCommand( besuCommand.parameterExceptionHandler(), besuCommand.executionExceptionHandler(), in, + mockBesuComponent, args); return besuCommand; } diff --git a/besu/src/test/java/org/hyperledger/besu/components/MockBesuCommandModule.java b/besu/src/test/java/org/hyperledger/besu/components/MockBesuCommandModule.java index 743b4ee8de9..3695fe54f78 100644 --- a/besu/src/test/java/org/hyperledger/besu/components/MockBesuCommandModule.java +++ b/besu/src/test/java/org/hyperledger/besu/components/MockBesuCommandModule.java @@ -18,6 +18,9 @@ import org.hyperledger.besu.cli.BesuCommand; import org.hyperledger.besu.metrics.prometheus.MetricsConfiguration; +import org.hyperledger.besu.plugin.services.BesuConfiguration; +import org.hyperledger.besu.services.BesuConfigurationImpl; +import org.hyperledger.besu.services.BesuPluginContextImpl; import javax.inject.Named; import javax.inject.Singleton; @@ -47,4 +50,17 @@ MetricsConfiguration provideMetricsConfiguration() { Logger provideBesuCommandLogger() { return LoggerFactory.getLogger(MockBesuCommandModule.class); } + + /** + * Creates a BesuPluginContextImpl, used for plugin service discovery. + * + * @return the BesuPluginContext + */ + @Provides + @Singleton + public BesuPluginContextImpl provideBesuPluginContext() { + BesuPluginContextImpl retval = new BesuPluginContextImpl(); + retval.addService(BesuConfiguration.class, new BesuConfigurationImpl()); + return retval; + } } diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/trie/diffbased/bonsai/cache/BonsaiCachedMerkleTrieLoaderModule.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/trie/diffbased/bonsai/cache/BonsaiCachedMerkleTrieLoaderModule.java index 8ed7daa35f1..b506d5a5ff1 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/trie/diffbased/bonsai/cache/BonsaiCachedMerkleTrieLoaderModule.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/trie/diffbased/bonsai/cache/BonsaiCachedMerkleTrieLoaderModule.java @@ -15,6 +15,7 @@ package org.hyperledger.besu.ethereum.trie.diffbased.bonsai.cache; import org.hyperledger.besu.metrics.ObservableMetricsSystem; +import org.hyperledger.besu.plugin.services.MetricsSystem; import dagger.Module; import dagger.Provides; @@ -24,7 +25,7 @@ public class BonsaiCachedMerkleTrieLoaderModule { @Provides BonsaiCachedMerkleTrieLoader provideCachedMerkleTrieLoaderModule( - final ObservableMetricsSystem metricsSystem) { - return new BonsaiCachedMerkleTrieLoader(metricsSystem); + final MetricsSystem metricsSystem) { + return new BonsaiCachedMerkleTrieLoader((ObservableMetricsSystem) metricsSystem); } } diff --git a/metrics/core/src/main/java/org/hyperledger/besu/metrics/MetricsSystemModule.java b/metrics/core/src/main/java/org/hyperledger/besu/metrics/MetricsSystemModule.java index 044085ef426..1347d6faaaf 100644 --- a/metrics/core/src/main/java/org/hyperledger/besu/metrics/MetricsSystemModule.java +++ b/metrics/core/src/main/java/org/hyperledger/besu/metrics/MetricsSystemModule.java @@ -36,10 +36,4 @@ public MetricsSystemModule() {} MetricsSystem provideMetricsSystem(final MetricsConfiguration metricsConfig) { return MetricsSystemFactory.create(metricsConfig); } - - @Provides - @Singleton - ObservableMetricsSystem provideObservableMetricsSystem(final MetricsConfiguration metricsConfig) { - return MetricsSystemFactory.create(metricsConfig); - } } diff --git a/metrics/core/src/main/java/org/hyperledger/besu/metrics/opentelemetry/OpenTelemetrySystem.java b/metrics/core/src/main/java/org/hyperledger/besu/metrics/opentelemetry/OpenTelemetrySystem.java index ca1dc5dd3a3..a399b283734 100644 --- a/metrics/core/src/main/java/org/hyperledger/besu/metrics/opentelemetry/OpenTelemetrySystem.java +++ b/metrics/core/src/main/java/org/hyperledger/besu/metrics/opentelemetry/OpenTelemetrySystem.java @@ -41,6 +41,7 @@ import java.util.concurrent.TimeUnit; import java.util.function.DoubleSupplier; import java.util.stream.Stream; +import javax.inject.Singleton; import com.google.common.collect.ImmutableSet; import io.opentelemetry.api.common.AttributeKey; @@ -67,6 +68,7 @@ import org.slf4j.LoggerFactory; /** Metrics system relying on the native OpenTelemetry format. */ +@Singleton public class OpenTelemetrySystem implements ObservableMetricsSystem { private static final Logger LOG = LoggerFactory.getLogger(OpenTelemetrySystem.class); From 96e9873dd9624200f3a78cc6759a70b159c01d80 Mon Sep 17 00:00:00 2001 From: Bhanu Pulluri <59369753+pullurib@users.noreply.github.com> Date: Wed, 18 Sep 2024 13:53:11 -0400 Subject: [PATCH 16/47] Handle hadolint check failure with proper risk assessment (#7637) Signed-off-by: Bhanu Pulluri Co-authored-by: Bhanu Pulluri Co-authored-by: Fabio Di Fabio --- docker/Dockerfile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docker/Dockerfile b/docker/Dockerfile index a45a3ac73d8..fe91c7026fd 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -44,6 +44,12 @@ ENV OTEL_RESOURCE_ATTRIBUTES="service.name=besu,service.version=$VERSION" ENV OLDPATH="${PATH}" ENV PATH="/opt/besu/bin:${OLDPATH}" + +# The entry script just sets permissions as needed based on besu config +# and is replaced by the besu process running as besu user. +# Suppressing this warning as there's no risk here because the root user +# only sets permissions and does not continue running the main process. +# hadolint ignore=DL3002 USER root RUN chmod +x /opt/besu/bin/besu-entry.sh From beaee59212f18ca8767498fbb018381af7531893 Mon Sep 17 00:00:00 2001 From: Suyash Nayan <89125422+7suyash7@users.noreply.github.com> Date: Thu, 19 Sep 2024 20:27:06 +0530 Subject: [PATCH 17/47] Add BlobMetrics (#7622) * Add BlobMetrics Signed-off-by: 7suyash7 * refactor Signed-off-by: 7suyash7 * remove unused blob_storage Signed-off-by: 7suyash7 * add .size() to BlobCache Signed-off-by: 7suyash7 * Add to Changelog Signed-off-by: 7suyash7 --------- Signed-off-by: 7suyash7 Co-authored-by: Fabio Di Fabio --- CHANGELOG.md | 1 + .../ethereum/eth/transactions/BlobCache.java | 4 ++++ .../eth/transactions/TransactionPool.java | 14 ++++++++++++++ .../transactions/TransactionPoolMetrics.java | 17 +++++++++++++++++ 4 files changed, 36 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ff4d7cfbf94..c1ecca978ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ ### Additions and Improvements - Remove privacy test classes support [#7569](https://github.com/hyperledger/besu/pull/7569) +- Add Blob Transaction Metrics [#7622](https://github.com/hyperledger/besu/pull/7622) ### Bug fixes - Fix mounted data path directory permissions for besu user [#7575](https://github.com/hyperledger/besu/pull/7575) diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/BlobCache.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/BlobCache.java index 3d3a435f1f8..1cca3f5ee25 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/BlobCache.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/BlobCache.java @@ -91,4 +91,8 @@ public Optional restoreBlob(final Transaction transaction) { public BlobsWithCommitments.BlobQuad get(final VersionedHash vh) { return cache.getIfPresent(vh); } + + public long size() { + return cache.estimatedSize(); + } } diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPool.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPool.java index 315f82921bb..7bbf1abe3b7 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPool.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPool.java @@ -129,6 +129,7 @@ public TransactionPool( this.blockAddedEventOrderedProcessor = ethContext.getScheduler().createOrderedProcessor(this::processBlockAddedEvent); this.cacheForBlobsOfTransactionsAddedToABlock = blobCache; + initializeBlobMetrics(); initLogForReplay(); subscribePendingTransactions(this::mapBlobsOnTransactionAdded); subscribeDroppedTransactions(this::unmapBlobsOnTransactionDropped); @@ -686,6 +687,19 @@ public boolean isEnabled() { return isPoolEnabled.get(); } + public int getBlobCacheSize() { + return (int) cacheForBlobsOfTransactionsAddedToABlock.size(); + } + + public int getBlobMapSize() { + return mapOfBlobsInTransactionPool.size(); + } + + private void initializeBlobMetrics() { + metrics.createBlobCacheSizeMetric(this::getBlobCacheSize); + metrics.createBlobMapSizeMetric(this::getBlobMapSize); + } + class PendingTransactionsListenersProxy { private final Subscribers onAddedListeners = Subscribers.create(); diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPoolMetrics.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPoolMetrics.java index e08805551f9..fac9b3174d0 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPoolMetrics.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPoolMetrics.java @@ -28,6 +28,7 @@ import java.util.HashMap; import java.util.Map; import java.util.function.DoubleSupplier; +import java.util.function.IntSupplier; import org.apache.commons.lang3.tuple.Pair; import org.slf4j.Logger; @@ -285,4 +286,20 @@ private String location(final boolean receivedFromLocalSource) { private String priority(final boolean hasPriority) { return hasPriority ? "yes" : "no"; } + + public void createBlobCacheSizeMetric(final IntSupplier sizeSupplier) { + metricsSystem.createIntegerGauge( + BesuMetricCategory.TRANSACTION_POOL, + "blob_cache_size", + "Current size of the blob cache", + sizeSupplier); + } + + public void createBlobMapSizeMetric(final IntSupplier sizeSupplier) { + metricsSystem.createIntegerGauge( + BesuMetricCategory.TRANSACTION_POOL, + "blob_map_size", + "Current size of the blob map", + sizeSupplier); + } } From 25186d322110313d89c7cf9e77301f8e2671b8c0 Mon Sep 17 00:00:00 2001 From: Danno Ferrin Date: Thu, 19 Sep 2024 17:30:49 -0600 Subject: [PATCH 18/47] Remove Danno Ferrin as maintainer (#7644) I am no longer aligned with the Governance policies and practices of LFDT and resign my position as maintainer. Signed-off-by: Danno Ferrin --- MAINTAINERS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS.md b/MAINTAINERS.md index 1bd4f851f57..f699321efbd 100644 --- a/MAINTAINERS.md +++ b/MAINTAINERS.md @@ -28,7 +28,6 @@ | Matthew Whitehead| matthew1001 | matthew.whitehead | | Meredith Baxter | mbaxter | mbaxter | | Stefan Pingel | pinges | pinges | -| Danno Ferrin | shemnon | shemnon | | Simon Dudley | siladu | siladu | | Usman Saleem | usmansaleem | usmansaleem | @@ -52,6 +51,7 @@ | Rai Sur | RatanRSur | ratanraisur | | Rob Dawson | rojotek | RobDawson | | Sajida Zouarhi | sajz | SajidaZ | +| Danno Ferrin | shemnon | shemnon | | Taccat Isid | taccatisid | taccatisid | | Tim Beiko | timbeiko | timbeiko | | Vijay Michalik | vmichalik | VijayMichalik | From cb1e36a992bdf455916f604edfc22039b64f071e Mon Sep 17 00:00:00 2001 From: daniellehrner Date: Fri, 20 Sep 2024 03:56:25 +0200 Subject: [PATCH 19/47] Fix 7702 signature bound checks (#7641) * create separate signature class for code delegations as they have different bound checks Signed-off-by: Daniel Lehrner * test if increasing xmx let's failing acceptance test pass Signed-off-by: Daniel Lehrner * javadoc Signed-off-by: Sally MacFarlane --------- Signed-off-by: Daniel Lehrner Signed-off-by: Sally MacFarlane Co-authored-by: Sally MacFarlane --- .github/workflows/acceptance-tests.yml | 2 +- .../besu/crypto/AbstractSECP256.java | 6 ++ .../besu/crypto/CodeDelegationSignature.java | 59 ++++++++++++ .../besu/crypto/SignatureAlgorithm.java | 11 +++ .../crypto/CodeDelegationSignatureTest.java | 93 +++++++++++++++++++ .../CodeDelegationTransactionDecoder.java | 5 +- .../mainnet/MainnetTransactionValidator.java | 8 ++ .../encoding/CodeDelegationDecoderTest.java | 12 +++ 8 files changed, 193 insertions(+), 3 deletions(-) create mode 100644 crypto/algorithms/src/main/java/org/hyperledger/besu/crypto/CodeDelegationSignature.java create mode 100644 crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/CodeDelegationSignatureTest.java diff --git a/.github/workflows/acceptance-tests.yml b/.github/workflows/acceptance-tests.yml index 287f402bced..a8f6981d896 100644 --- a/.github/workflows/acceptance-tests.yml +++ b/.github/workflows/acceptance-tests.yml @@ -11,7 +11,7 @@ concurrency: cancel-in-progress: true env: - GRADLE_OPTS: "-Xmx6g" + GRADLE_OPTS: "-Xmx7g" total-runners: 12 jobs: diff --git a/crypto/algorithms/src/main/java/org/hyperledger/besu/crypto/AbstractSECP256.java b/crypto/algorithms/src/main/java/org/hyperledger/besu/crypto/AbstractSECP256.java index b10e654626f..ce376512668 100644 --- a/crypto/algorithms/src/main/java/org/hyperledger/besu/crypto/AbstractSECP256.java +++ b/crypto/algorithms/src/main/java/org/hyperledger/besu/crypto/AbstractSECP256.java @@ -212,6 +212,12 @@ public SECPSignature createSignature(final BigInteger r, final BigInteger s, fin return SECPSignature.create(r, s, recId, curveOrder); } + @Override + public CodeDelegationSignature createCodeDelegationSignature( + final BigInteger r, final BigInteger s, final long yParity) { + return CodeDelegationSignature.create(r, s, yParity); + } + @Override public SECPSignature decodeSignature(final Bytes bytes) { return SECPSignature.decode(bytes, curveOrder); diff --git a/crypto/algorithms/src/main/java/org/hyperledger/besu/crypto/CodeDelegationSignature.java b/crypto/algorithms/src/main/java/org/hyperledger/besu/crypto/CodeDelegationSignature.java new file mode 100644 index 00000000000..4bb2e4653e2 --- /dev/null +++ b/crypto/algorithms/src/main/java/org/hyperledger/besu/crypto/CodeDelegationSignature.java @@ -0,0 +1,59 @@ +/* + * Copyright contributors to Hyperledger Besu. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ +package org.hyperledger.besu.crypto; + +import static com.google.common.base.Preconditions.checkNotNull; + +import java.math.BigInteger; + +/** Secp signature with code delegation. */ +public class CodeDelegationSignature extends SECPSignature { + private static final BigInteger TWO_POW_256 = BigInteger.TWO.pow(256); + + /** + * Instantiates a new SECPSignature. + * + * @param r the r part of the signature + * @param s the s part of the signature + * @param yParity the parity of the y coordinate of the public key + */ + public CodeDelegationSignature(final BigInteger r, final BigInteger s, final byte yParity) { + super(r, s, yParity); + } + + /** + * Create a new CodeDelegationSignature. + * + * @param r the r part of the signature + * @param s the s part of the signature + * @param yParity the parity of the y coordinate of the public key + * @return the new CodeDelegationSignature + */ + public static CodeDelegationSignature create( + final BigInteger r, final BigInteger s, final long yParity) { + checkNotNull(r); + checkNotNull(s); + + if (r.compareTo(TWO_POW_256) >= 0) { + throw new IllegalArgumentException("Invalid 'r' value, should be < 2^256 but got " + r); + } + + if (s.compareTo(TWO_POW_256) >= 0) { + throw new IllegalArgumentException("Invalid 's' value, should be < 2^256 but got " + s); + } + + return new CodeDelegationSignature(r, s, (byte) yParity); + } +} diff --git a/crypto/algorithms/src/main/java/org/hyperledger/besu/crypto/SignatureAlgorithm.java b/crypto/algorithms/src/main/java/org/hyperledger/besu/crypto/SignatureAlgorithm.java index db9565d18d0..8e19b608544 100644 --- a/crypto/algorithms/src/main/java/org/hyperledger/besu/crypto/SignatureAlgorithm.java +++ b/crypto/algorithms/src/main/java/org/hyperledger/besu/crypto/SignatureAlgorithm.java @@ -215,6 +215,17 @@ Optional recoverPublicKeyFromSignature( */ SECPSignature createSignature(final BigInteger r, final BigInteger s, final byte recId); + /** + * Create code delegation signature which have different bounds than transaction signatures. + * + * @param r the r part of the signature + * @param s the s part of the signature + * @param yParity the parity of the y coordinate of the public key + * @return the code delegation signature + */ + CodeDelegationSignature createCodeDelegationSignature( + final BigInteger r, final BigInteger s, final long yParity); + /** * Decode secp signature. * diff --git a/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/CodeDelegationSignatureTest.java b/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/CodeDelegationSignatureTest.java new file mode 100644 index 00000000000..1cc66966a78 --- /dev/null +++ b/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/CodeDelegationSignatureTest.java @@ -0,0 +1,93 @@ +/* + * Copyright contributors to Hyperledger Besu. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ +package org.hyperledger.besu.crypto; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; + +import java.math.BigInteger; + +import org.junit.jupiter.api.Test; + +class CodeDelegationSignatureTest { + + private static final BigInteger TWO_POW_256 = BigInteger.valueOf(2).pow(256); + + @Test + void testValidInputs() { + BigInteger r = BigInteger.ONE; + BigInteger s = BigInteger.TEN; + long yParity = 1L; + + CodeDelegationSignature result = CodeDelegationSignature.create(r, s, yParity); + + assertThat(r).isEqualTo(result.getR()); + assertThat(s).isEqualTo(result.getS()); + assertThat((byte) yParity).isEqualTo(result.getRecId()); + } + + @Test + void testNullRValue() { + BigInteger s = BigInteger.TEN; + long yParity = 0L; + + assertThatExceptionOfType(NullPointerException.class) + .isThrownBy(() -> CodeDelegationSignature.create(null, s, yParity)); + } + + @Test + void testNullSValue() { + BigInteger r = BigInteger.ONE; + long yParity = 0L; + + assertThatExceptionOfType(NullPointerException.class) + .isThrownBy(() -> CodeDelegationSignature.create(r, null, yParity)); + } + + @Test + void testRValueExceedsTwoPow256() { + BigInteger r = TWO_POW_256; + BigInteger s = BigInteger.TEN; + long yParity = 0L; + + assertThatExceptionOfType(IllegalArgumentException.class) + .isThrownBy(() -> CodeDelegationSignature.create(r, s, yParity)) + .withMessageContainingAll("Invalid 'r' value, should be < 2^256"); + } + + @Test + void testSValueExceedsTwoPow256() { + BigInteger r = BigInteger.ONE; + BigInteger s = TWO_POW_256; + long yParity = 0L; + + assertThatExceptionOfType(IllegalArgumentException.class) + .isThrownBy(() -> CodeDelegationSignature.create(r, s, yParity)) + .withMessageContainingAll("Invalid 's' value, should be < 2^256"); + } + + @Test + void testValidYParityZero() { + BigInteger r = BigInteger.ONE; + BigInteger s = BigInteger.TEN; + long yParity = 0L; + + CodeDelegationSignature result = CodeDelegationSignature.create(r, s, yParity); + + assertThat(r).isEqualTo(result.getR()); + assertThat(s).isEqualTo(result.getS()); + assertThat((byte) yParity).isEqualTo(result.getRecId()); + } +} diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/encoding/CodeDelegationTransactionDecoder.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/encoding/CodeDelegationTransactionDecoder.java index 8961431c9cd..d3ef60bfc41 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/encoding/CodeDelegationTransactionDecoder.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/encoding/CodeDelegationTransactionDecoder.java @@ -81,13 +81,14 @@ public static CodeDelegation decodeInnerPayload(final RLPInput input) { final Address address = Address.wrap(input.readBytes()); final long nonce = input.readLongScalar(); - final byte yParity = (byte) input.readUnsignedByteScalar(); + final long yParity = input.readUnsignedIntScalar(); final BigInteger r = input.readUInt256Scalar().toUnsignedBigInteger(); final BigInteger s = input.readUInt256Scalar().toUnsignedBigInteger(); input.leaveList(); - final SECPSignature signature = SIGNATURE_ALGORITHM.get().createSignature(r, s, yParity); + final SECPSignature signature = + SIGNATURE_ALGORITHM.get().createCodeDelegationSignature(r, s, yParity); return new org.hyperledger.besu.ethereum.core.CodeDelegation( chainId, address, nonce, signature); diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetTransactionValidator.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetTransactionValidator.java index e67ccbb4c62..0e86b6b8783 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetTransactionValidator.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetTransactionValidator.java @@ -52,6 +52,8 @@ */ public class MainnetTransactionValidator implements TransactionValidator { + public static final BigInteger TWO_POW_256 = BigInteger.TWO.pow(256); + private final GasCalculator gasCalculator; private final GasLimitCalculator gasLimitCalculator; private final FeeMarket feeMarket; @@ -163,6 +165,12 @@ private static ValidationResult validateCodeDelegation .map( codeDelegations -> { for (CodeDelegation codeDelegation : codeDelegations) { + if (codeDelegation.chainId().compareTo(TWO_POW_256) >= 0) { + throw new IllegalArgumentException( + "Invalid 'chainId' value, should be < 2^256 but got " + + codeDelegation.chainId()); + } + if (codeDelegation.signature().getS().compareTo(halfCurveOrder) > 0) { return ValidationResult.invalid( TransactionInvalidReason.INVALID_SIGNATURE, diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/core/encoding/CodeDelegationDecoderTest.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/core/encoding/CodeDelegationDecoderTest.java index d6ff585b4fc..a0c7689bc71 100644 --- a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/core/encoding/CodeDelegationDecoderTest.java +++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/core/encoding/CodeDelegationDecoderTest.java @@ -99,4 +99,16 @@ void shouldDecodeInnerPayloadWithChainIdZero() { assertThat(signature.getS().toString(16)) .isEqualTo("3c8a25b2becd6e666f69803d1ae3322f2e137b7745c2c7f19da80f993ffde4df"); } + + @Test + void shouldDecodeInnerPayloadWhenSignatureIsZero() { + final BytesValueRLPInput input = + new BytesValueRLPInput( + Bytes.fromHexString( + "0xdf8501a1f0ff5a947a40026a3b9a41754a95eec8c92c6b99886f440c5b808080"), + true); + final CodeDelegation authorization = CodeDelegationTransactionDecoder.decodeInnerPayload(input); + + assertThat(authorization.chainId()).isEqualTo(new BigInteger("01a1f0ff5a", 16)); + } } From 637ebcb9c57107656b9a8e1cc261a2cd10a2e829 Mon Sep 17 00:00:00 2001 From: Gabriel Fukushima Date: Fri, 20 Sep 2024 12:25:16 +1000 Subject: [PATCH 20/47] add Teku EL-bootnode to holesky genesis (#7648) Signed-off-by: Gabriel Fukushima --- config/src/main/resources/holesky.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/src/main/resources/holesky.json b/config/src/main/resources/holesky.json index d91971b3515..ea83279953d 100644 --- a/config/src/main/resources/holesky.json +++ b/config/src/main/resources/holesky.json @@ -21,7 +21,8 @@ "bootnodes": [ "enode://ac906289e4b7f12df423d654c5a962b6ebe5b3a74cc9e06292a85221f9a64a6f1cfdd6b714ed6dacef51578f92b34c60ee91e9ede9c7f8fadc4d347326d95e2b@146.190.13.128:30303", "enode://a3435a0155a3e837c02f5e7f5662a2f1fbc25b48e4dc232016e1c51b544cb5b4510ef633ea3278c0e970fa8ad8141e2d4d0f9f95456c537ff05fdf9b31c15072@178.128.136.233:30303", - "enode://7fa09f1e8bb179ab5e73f45d3a7169a946e7b3de5ef5cea3a0d4546677e4435ee38baea4dd10b3ddfdc1f1c5e869052932af8b8aeb6f9738598ec4590d0b11a6@65.109.94.124:30303" + "enode://7fa09f1e8bb179ab5e73f45d3a7169a946e7b3de5ef5cea3a0d4546677e4435ee38baea4dd10b3ddfdc1f1c5e869052932af8b8aeb6f9738598ec4590d0b11a6@65.109.94.124:30303", + "enode://3524632a412f42dee4b9cc899b946912359bb20103d7596bddb9c8009e7683b7bff39ea20040b7ab64d23105d4eac932d86b930a605e632357504df800dba100@172.174.35.249:30303" ] } }, From e1f44897411eaa8a11a87c23c381090bb6ed18b1 Mon Sep 17 00:00:00 2001 From: Jason Frame Date: Fri, 20 Sep 2024 16:07:27 +1000 Subject: [PATCH 21/47] Disable body validation for POS networks during sync (#7646) Signed-off-by: Jason Frame Co-authored-by: Stefan Pingel <16143240+pinges@users.noreply.github.com> --- .../besu/ethereum/BlockValidator.java | 11 +- .../besu/ethereum/MainnetBlockValidator.java | 8 +- .../besu/ethereum/core/BlockImporter.java | 6 +- .../mainnet/BaseFeeBlockBodyValidator.java | 6 +- .../ethereum/mainnet/BlockBodyValidator.java | 3 +- .../ethereum/mainnet/BodyValidationMode.java | 26 ++++ .../mainnet/MainnetBlockBodyValidator.java | 34 +++-- .../mainnet/MainnetBlockImporter.java | 10 +- .../ethereum/MainnetBlockValidatorTest.java | 44 ++++--- .../MainnetBlockBodyValidatorTest.java | 123 +++++++++++++++++- .../mainnet/PragueRequestsValidatorTest.java | 3 +- .../FastSyncDownloadPipelineFactory.java | 8 +- .../eth/sync/fastsync/ImportBlocksStep.java | 14 +- .../sync/fastsync/ImportBlocksStepTest.java | 18 ++- 14 files changed, 255 insertions(+), 59 deletions(-) create mode 100644 ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/BodyValidationMode.java diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/BlockValidator.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/BlockValidator.java index e8136062bbd..8cfafee730b 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/BlockValidator.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/BlockValidator.java @@ -17,6 +17,7 @@ import org.hyperledger.besu.ethereum.core.Block; import org.hyperledger.besu.ethereum.core.Request; import org.hyperledger.besu.ethereum.core.TransactionReceipt; +import org.hyperledger.besu.ethereum.mainnet.BodyValidationMode; import org.hyperledger.besu.ethereum.mainnet.HeaderValidationMode; import java.util.List; @@ -83,8 +84,8 @@ BlockProcessingResult validateAndProcessBlock( final boolean shouldRecordBadBlock); /** - * Performs fast block validation with the given context, block, transaction receipts, requests, - * header validation mode, and ommer validation mode. + * Performs fast block validation appropriate for use during syncing skipping transaction receipt + * roots and receipts roots as these are done during the download of the blocks. * * @param context the protocol context * @param block the block to validate @@ -92,13 +93,15 @@ BlockProcessingResult validateAndProcessBlock( * @param requests the requests * @param headerValidationMode the header validation mode * @param ommerValidationMode the ommer validation mode + * @param bodyValidationMode the body validation mode * @return true if the block is valid, false otherwise */ - boolean fastBlockValidation( + boolean validateBlockForSyncing( final ProtocolContext context, final Block block, final List receipts, final Optional> requests, final HeaderValidationMode headerValidationMode, - final HeaderValidationMode ommerValidationMode); + final HeaderValidationMode ommerValidationMode, + final BodyValidationMode bodyValidationMode); } diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/MainnetBlockValidator.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/MainnetBlockValidator.java index 5d80a951505..0c56a419e35 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/MainnetBlockValidator.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/MainnetBlockValidator.java @@ -25,6 +25,7 @@ import org.hyperledger.besu.ethereum.mainnet.BlockBodyValidator; import org.hyperledger.besu.ethereum.mainnet.BlockHeaderValidator; import org.hyperledger.besu.ethereum.mainnet.BlockProcessor; +import org.hyperledger.besu.ethereum.mainnet.BodyValidationMode; import org.hyperledger.besu.ethereum.mainnet.HeaderValidationMode; import org.hyperledger.besu.ethereum.trie.MerkleTrieException; import org.hyperledger.besu.plugin.services.exception.StorageException; @@ -247,13 +248,14 @@ protected BlockProcessingResult processBlock( } @Override - public boolean fastBlockValidation( + public boolean validateBlockForSyncing( final ProtocolContext context, final Block block, final List receipts, final Optional> requests, final HeaderValidationMode headerValidationMode, - final HeaderValidationMode ommerValidationMode) { + final HeaderValidationMode ommerValidationMode, + final BodyValidationMode bodyValidationMode) { final BlockHeader header = block.getHeader(); if (!blockHeaderValidator.validateHeader(header, context, headerValidationMode)) { String description = String.format("Failed header validation (%s)", headerValidationMode); @@ -262,7 +264,7 @@ public boolean fastBlockValidation( } if (!blockBodyValidator.validateBodyLight( - context, block, receipts, requests, ommerValidationMode)) { + context, block, receipts, requests, ommerValidationMode, bodyValidationMode)) { badBlockManager.addBadBlock( block, BadBlockCause.fromValidationFailure("Failed body validation (light)")); return false; diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/BlockImporter.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/BlockImporter.java index ce5c849e3a2..468485b9fde 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/BlockImporter.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/BlockImporter.java @@ -16,6 +16,7 @@ import org.hyperledger.besu.ethereum.ProtocolContext; import org.hyperledger.besu.ethereum.mainnet.BlockImportResult; +import org.hyperledger.besu.ethereum.mainnet.BodyValidationMode; import org.hyperledger.besu.ethereum.mainnet.HeaderValidationMode; import java.util.List; @@ -73,10 +74,11 @@ BlockImportResult importBlock( * @return {@code BlockImportResult} * @see BlockImportResult */ - BlockImportResult fastImportBlock( + BlockImportResult importBlockForSyncing( ProtocolContext context, Block block, List receipts, HeaderValidationMode headerValidationMode, - HeaderValidationMode ommerValidationMode); + HeaderValidationMode ommerValidationMode, + BodyValidationMode bodyValidationMode); } diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/BaseFeeBlockBodyValidator.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/BaseFeeBlockBodyValidator.java index 0e288185cfc..aabc4ee5d09 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/BaseFeeBlockBodyValidator.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/BaseFeeBlockBodyValidator.java @@ -43,9 +43,11 @@ public boolean validateBodyLight( final Block block, final List receipts, final Optional> requests, - final HeaderValidationMode ommerValidationMode) { + final HeaderValidationMode ommerValidationMode, + final BodyValidationMode bodyValidationMode) { - return super.validateBodyLight(context, block, receipts, requests, ommerValidationMode) + return super.validateBodyLight( + context, block, receipts, requests, ommerValidationMode, bodyValidationMode) && validateTransactionGasPrice(block); } diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/BlockBodyValidator.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/BlockBodyValidator.java index 62b4985f5ca..c84be3771b9 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/BlockBodyValidator.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/BlockBodyValidator.java @@ -59,5 +59,6 @@ boolean validateBodyLight( Block block, List receipts, final Optional> requests, - final HeaderValidationMode ommerValidationMode); + final HeaderValidationMode ommerValidationMode, + final BodyValidationMode bodyValidationMode); } diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/BodyValidationMode.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/BodyValidationMode.java new file mode 100644 index 00000000000..344a950e365 --- /dev/null +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/BodyValidationMode.java @@ -0,0 +1,26 @@ +/* + * Copyright contributors to Hyperledger Besu. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ +package org.hyperledger.besu.ethereum.mainnet; + +public enum BodyValidationMode { + /** No Validation. data must be pre-validated */ + NONE, + + /** Skip receipts and transactions root validation */ + LIGHT, + + /** Fully validate the body */ + FULL; +} diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetBlockBodyValidator.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetBlockBodyValidator.java index 3202440dd89..68951f9f2a3 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetBlockBodyValidator.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetBlockBodyValidator.java @@ -29,6 +29,7 @@ import java.util.Optional; import java.util.Set; +import com.google.common.annotations.VisibleForTesting; import org.apache.tuweni.bytes.Bytes32; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -55,7 +56,8 @@ public boolean validateBody( final Hash worldStateRootHash, final HeaderValidationMode ommerValidationMode) { - if (!validateBodyLight(context, block, receipts, requests, ommerValidationMode)) { + if (!validateBodyLight( + context, block, receipts, requests, ommerValidationMode, BodyValidationMode.FULL)) { return false; } @@ -77,18 +79,26 @@ public boolean validateBodyLight( final Block block, final List receipts, final Optional> requests, - final HeaderValidationMode ommerValidationMode) { + final HeaderValidationMode ommerValidationMode, + final BodyValidationMode bodyValidationMode) { + if (bodyValidationMode == BodyValidationMode.NONE) { + return true; + } + final BlockHeader header = block.getHeader(); final BlockBody body = block.getBody(); - final Bytes32 transactionsRoot = BodyValidation.transactionsRoot(body.getTransactions()); - if (!validateTransactionsRoot(header, header.getTransactionsRoot(), transactionsRoot)) { - return false; - } + // these checks are only needed for full validation and can be skipped for light validation + if (bodyValidationMode == BodyValidationMode.FULL) { + final Bytes32 transactionsRoot = BodyValidation.transactionsRoot(body.getTransactions()); + if (!validateTransactionsRoot(header, header.getTransactionsRoot(), transactionsRoot)) { + return false; + } - final Bytes32 receiptsRoot = BodyValidation.receiptsRoot(receipts); - if (!validateReceiptsRoot(header, header.getReceiptsRoot(), receiptsRoot)) { - return false; + final Bytes32 receiptsRoot = BodyValidation.receiptsRoot(receipts); + if (!validateReceiptsRoot(header, header.getReceiptsRoot(), receiptsRoot)) { + return false; + } } final long gasUsed = @@ -115,7 +125,8 @@ public boolean validateBodyLight( return true; } - private static boolean validateTransactionsRoot( + @VisibleForTesting + protected boolean validateTransactionsRoot( final BlockHeader header, final Bytes32 expected, final Bytes32 actual) { if (!expected.equals(actual)) { LOG.info( @@ -157,7 +168,8 @@ private static boolean validateGasUsed( return true; } - private static boolean validateReceiptsRoot( + @VisibleForTesting + protected boolean validateReceiptsRoot( final BlockHeader header, final Bytes32 expected, final Bytes32 actual) { if (!expected.equals(actual)) { LOG.warn( diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetBlockImporter.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetBlockImporter.java index 62b708d33e6..8646467a282 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetBlockImporter.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetBlockImporter.java @@ -57,20 +57,22 @@ public synchronized BlockImportResult importBlock( } @Override - public BlockImportResult fastImportBlock( + public BlockImportResult importBlockForSyncing( final ProtocolContext context, final Block block, final List receipts, final HeaderValidationMode headerValidationMode, - final HeaderValidationMode ommerValidationMode) { + final HeaderValidationMode ommerValidationMode, + final BodyValidationMode bodyValidationMode) { - if (blockValidator.fastBlockValidation( + if (blockValidator.validateBlockForSyncing( context, block, receipts, block.getBody().getRequests(), headerValidationMode, - ommerValidationMode)) { + ommerValidationMode, + bodyValidationMode)) { context.getBlockchain().appendBlock(block, receipts); return new BlockImportResult(true); } diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/MainnetBlockValidatorTest.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/MainnetBlockValidatorTest.java index 361353ee2b2..40573ee8d6e 100644 --- a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/MainnetBlockValidatorTest.java +++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/MainnetBlockValidatorTest.java @@ -34,6 +34,7 @@ import org.hyperledger.besu.ethereum.mainnet.BlockBodyValidator; import org.hyperledger.besu.ethereum.mainnet.BlockHeaderValidator; import org.hyperledger.besu.ethereum.mainnet.BlockProcessor; +import org.hyperledger.besu.ethereum.mainnet.BodyValidationMode; import org.hyperledger.besu.ethereum.mainnet.HeaderValidationMode; import org.hyperledger.besu.ethereum.trie.MerkleTrieException; import org.hyperledger.besu.ethereum.worldstate.WorldStateArchive; @@ -98,7 +99,8 @@ public void setup() { when(blockHeaderValidator.validateHeader(any(), any(), any(), any())).thenReturn(true); when(blockBodyValidator.validateBody(any(), any(), any(), any(), any(), any())) .thenReturn(true); - when(blockBodyValidator.validateBodyLight(any(), any(), any(), any(), any())).thenReturn(true); + when(blockBodyValidator.validateBodyLight(any(), any(), any(), any(), any(), any())) + .thenReturn(true); when(blockProcessor.processBlock(any(), any(), any())).thenReturn(successfulProcessingResult); when(blockProcessor.processBlock(any(), any(), any(), any())) .thenReturn(successfulProcessingResult); @@ -343,55 +345,65 @@ public void validateAndProcessBlock_withShouldRecordBadBlockNotSet() { } @Test - public void fastBlockValidation_onSuccess() { + public void validateBlockForSyncing_onSuccess() { final boolean isValid = - mainnetBlockValidator.fastBlockValidation( + mainnetBlockValidator.validateBlockForSyncing( protocolContext, block, Collections.emptyList(), block.getBody().getRequests(), HeaderValidationMode.FULL, - HeaderValidationMode.FULL); + HeaderValidationMode.FULL, + BodyValidationMode.FULL); assertThat(isValid).isTrue(); assertNoBadBlocks(); } @Test - public void fastBlockValidation_onFailedHeaderValidation() { - final HeaderValidationMode validationMode = HeaderValidationMode.FULL; + public void validateBlockValidation_onFailedHeaderForSyncing() { + final HeaderValidationMode headerValidationMode = HeaderValidationMode.FULL; when(blockHeaderValidator.validateHeader( - any(BlockHeader.class), eq(protocolContext), eq(validationMode))) + any(BlockHeader.class), eq(protocolContext), eq(headerValidationMode))) .thenReturn(false); + final BodyValidationMode bodyValidationMode = BodyValidationMode.FULL; final boolean isValid = - mainnetBlockValidator.fastBlockValidation( + mainnetBlockValidator.validateBlockForSyncing( protocolContext, block, Collections.emptyList(), block.getBody().getRequests(), - validationMode, - validationMode); + headerValidationMode, + headerValidationMode, + bodyValidationMode); assertThat(isValid).isFalse(); assertBadBlockIsTracked(block); } @Test - public void fastBlockValidation_onFailedBodyValidation() { - final HeaderValidationMode validationMode = HeaderValidationMode.FULL; + public void validateBlockValidation_onFailedBodyForSyncing() { + final HeaderValidationMode headerValidationMode = HeaderValidationMode.FULL; + final BodyValidationMode bodyValidationMode = BodyValidationMode.FULL; when(blockBodyValidator.validateBodyLight( - eq(protocolContext), eq(block), any(), any(), eq(validationMode))) + eq(protocolContext), + eq(block), + any(), + any(), + eq(headerValidationMode), + eq(bodyValidationMode))) .thenReturn(false); final boolean isValid = - mainnetBlockValidator.fastBlockValidation( + mainnetBlockValidator.validateBlockForSyncing( protocolContext, block, Collections.emptyList(), block.getBody().getRequests(), - validationMode, - validationMode); + headerValidationMode, + headerValidationMode, + bodyValidationMode); assertThat(isValid).isFalse(); assertBadBlockIsTracked(block); diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/MainnetBlockBodyValidatorTest.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/MainnetBlockBodyValidatorTest.java index c116d545d80..c412a30756b 100644 --- a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/MainnetBlockBodyValidatorTest.java +++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/MainnetBlockBodyValidatorTest.java @@ -19,14 +19,22 @@ import static org.hyperledger.besu.ethereum.mainnet.HeaderValidationMode.NONE; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.lenient; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; import org.hyperledger.besu.datatypes.Address; import org.hyperledger.besu.datatypes.GWei; +import org.hyperledger.besu.datatypes.Hash; import org.hyperledger.besu.ethereum.core.Block; import org.hyperledger.besu.ethereum.core.BlockDataGenerator; import org.hyperledger.besu.ethereum.core.BlockDataGenerator.BlockOptions; import org.hyperledger.besu.ethereum.core.BlockchainSetupUtil; +import org.hyperledger.besu.ethereum.core.TransactionReceipt; import org.hyperledger.besu.ethereum.core.Withdrawal; import org.hyperledger.besu.ethereum.mainnet.requests.DepositRequestValidator; import org.hyperledger.besu.ethereum.mainnet.requests.RequestsValidatorCoordinator; @@ -93,7 +101,12 @@ void validatesWithdrawals() { assertThat( new MainnetBlockBodyValidator(protocolSchedule) .validateBodyLight( - blockchainSetupUtil.getProtocolContext(), block, emptyList(), any(), NONE)) + blockchainSetupUtil.getProtocolContext(), + block, + emptyList(), + any(), + NONE, + BodyValidationMode.FULL)) .isTrue(); } @@ -117,7 +130,12 @@ void validationFailsIfWithdrawalsValidationFails() { assertThat( new MainnetBlockBodyValidator(protocolSchedule) .validateBodyLight( - blockchainSetupUtil.getProtocolContext(), block, emptyList(), any(), NONE)) + blockchainSetupUtil.getProtocolContext(), + block, + emptyList(), + any(), + NONE, + BodyValidationMode.FULL)) .isFalse(); } @@ -141,7 +159,12 @@ void validationFailsIfWithdrawalsRootValidationFails() { assertThat( new MainnetBlockBodyValidator(protocolSchedule) .validateBodyLight( - blockchainSetupUtil.getProtocolContext(), block, emptyList(), any(), NONE)) + blockchainSetupUtil.getProtocolContext(), + block, + emptyList(), + any(), + NONE, + BodyValidationMode.FULL)) .isFalse(); } @@ -165,7 +188,99 @@ public void validationFailsIfWithdrawalRequestsValidationFails() { assertThat( new MainnetBlockBodyValidator(protocolSchedule) .validateBodyLight( - blockchainSetupUtil.getProtocolContext(), block, emptyList(), any(), NONE)) + blockchainSetupUtil.getProtocolContext(), + block, + emptyList(), + any(), + NONE, + BodyValidationMode.FULL)) .isFalse(); } + + @Test + @SuppressWarnings("unchecked") + public void noneValidationModeDoesNothing() { + final Block block = mock(Block.class); + final List receipts = mock(List.class); + + final MainnetBlockBodyValidator bodyValidator = new MainnetBlockBodyValidator(protocolSchedule); + + assertThat( + bodyValidator.validateBodyLight( + blockchainSetupUtil.getProtocolContext(), + block, + receipts, + Optional.empty(), + NONE, + BodyValidationMode.NONE)) + .isTrue(); + verifyNoInteractions(block); + verifyNoInteractions(receipts); + } + + @Test + public void lightValidationDoesNotCheckTransactionRootOrReceiptRoot() { + final Block block = + blockDataGenerator.block( + new BlockOptions() + .setBlockNumber(1) + .setGasUsed(0) + .hasTransactions(false) + .hasOmmers(false) + .setReceiptsRoot(BodyValidation.receiptsRoot(emptyList())) + .setLogsBloom(LogsBloomFilter.empty()) + .setParentHash(blockchainSetupUtil.getBlockchain().getChainHeadHash()) + .setWithdrawals(Optional.of(withdrawals))); + blockchainSetupUtil.getBlockchain().appendBlock(block, Collections.emptyList()); + + final MainnetBlockBodyValidator bodyValidator = new MainnetBlockBodyValidator(protocolSchedule); + final MainnetBlockBodyValidator bodyValidatorSpy = spy(bodyValidator); + + assertThat( + bodyValidatorSpy.validateBodyLight( + blockchainSetupUtil.getProtocolContext(), + block, + emptyList(), + Optional.empty(), + NONE, + BodyValidationMode.LIGHT)) + .isTrue(); + verify(bodyValidatorSpy, never()).validateReceiptsRoot(any(), any(), any()); + verify(bodyValidatorSpy, never()).validateTransactionsRoot(any(), any(), any()); + } + + @Test + public void fullValidationChecksTransactionRootAndReceiptRoot() { + final Block block = + blockDataGenerator.block( + new BlockOptions() + .setBlockNumber(1) + .setGasUsed(0) + .hasTransactions(false) + .hasOmmers(false) + .setReceiptsRoot(BodyValidation.receiptsRoot(emptyList())) + .setLogsBloom(LogsBloomFilter.empty()) + .setParentHash(blockchainSetupUtil.getBlockchain().getChainHeadHash()) + .setWithdrawals(Optional.of(withdrawals))); + blockchainSetupUtil.getBlockchain().appendBlock(block, Collections.emptyList()); + + final MainnetBlockBodyValidator bodyValidator = new MainnetBlockBodyValidator(protocolSchedule); + final MainnetBlockBodyValidator bodyValidatorSpy = spy(bodyValidator); + + assertThat( + bodyValidatorSpy.validateBodyLight( + blockchainSetupUtil.getProtocolContext(), + block, + emptyList(), + Optional.empty(), + NONE, + BodyValidationMode.FULL)) + .isTrue(); + final Hash receiptsRoot = BodyValidation.receiptsRoot(emptyList()); + final Hash transactionsRoot = BodyValidation.transactionsRoot(emptyList()); + verify(bodyValidatorSpy, times(1)) + .validateReceiptsRoot(block.getHeader(), receiptsRoot, receiptsRoot); + verify(bodyValidatorSpy, times(1)) + .validateTransactionsRoot(block.getHeader(), transactionsRoot, transactionsRoot); + } } diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/PragueRequestsValidatorTest.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/PragueRequestsValidatorTest.java index 833e692d7f4..6c325b70a86 100644 --- a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/PragueRequestsValidatorTest.java +++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/PragueRequestsValidatorTest.java @@ -106,7 +106,8 @@ void shouldValidateRequestsTest() { block, emptyList(), expectedRequests, - NONE)) + NONE, + BodyValidationMode.FULL)) .isFalse(); } } diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/FastSyncDownloadPipelineFactory.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/FastSyncDownloadPipelineFactory.java index 07e964426cc..87032b76e57 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/FastSyncDownloadPipelineFactory.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/FastSyncDownloadPipelineFactory.java @@ -37,6 +37,7 @@ import org.hyperledger.besu.ethereum.eth.sync.range.SyncTargetRangeSource; import org.hyperledger.besu.ethereum.eth.sync.state.SyncState; import org.hyperledger.besu.ethereum.eth.sync.state.SyncTarget; +import org.hyperledger.besu.ethereum.mainnet.BodyValidationMode; import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule; import org.hyperledger.besu.metrics.BesuMetricCategory; import org.hyperledger.besu.plugin.services.MetricsSystem; @@ -117,6 +118,10 @@ public Pipeline createDownloadPipelineForSyncTarget(final SyncT final int downloaderParallelism = syncConfig.getDownloaderParallelism(); final int headerRequestSize = syncConfig.getDownloaderHeaderRequestSize(); final int singleHeaderBufferSize = headerRequestSize * downloaderParallelism; + final BodyValidationMode bodyValidationMode = + protocolSchedule.anyMatch(scheduledProtocolSpec -> scheduledProtocolSpec.spec().isPoS()) + ? BodyValidationMode.NONE + : BodyValidationMode.LIGHT; final SyncTargetRangeSource checkpointRangeSource = new SyncTargetRangeSource( new RangeHeadersFetcher( @@ -148,7 +153,8 @@ public Pipeline createDownloadPipelineForSyncTarget(final SyncT attachedValidationPolicy, ommerValidationPolicy, ethContext, - fastSyncState.getPivotBlockHeader().get()); + fastSyncState.getPivotBlockHeader().get(), + bodyValidationMode); return PipelineBuilder.createPipelineFrom( "fetchCheckpoints", diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/ImportBlocksStep.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/ImportBlocksStep.java index c6945964cf0..20b9d84916a 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/ImportBlocksStep.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/ImportBlocksStep.java @@ -22,6 +22,7 @@ import org.hyperledger.besu.ethereum.eth.sync.ValidationPolicy; import org.hyperledger.besu.ethereum.eth.sync.tasks.exceptions.InvalidBlockException; import org.hyperledger.besu.ethereum.mainnet.BlockImportResult; +import org.hyperledger.besu.ethereum.mainnet.BodyValidationMode; import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule; import java.util.List; @@ -45,6 +46,7 @@ public class ImportBlocksStep implements Consumer> { private long accumulatedTime = 0L; private OptionalLong logStartBlock = OptionalLong.empty(); private final BlockHeader pivotHeader; + private final BodyValidationMode bodyValidationMode; public ImportBlocksStep( final ProtocolSchedule protocolSchedule, @@ -52,13 +54,15 @@ public ImportBlocksStep( final ValidationPolicy headerValidationPolicy, final ValidationPolicy ommerValidationPolicy, final EthContext ethContext, - final BlockHeader pivotHeader) { + final BlockHeader pivotHeader, + final BodyValidationMode bodyValidationMode) { this.protocolSchedule = protocolSchedule; this.protocolContext = protocolContext; this.headerValidationPolicy = headerValidationPolicy; this.ommerValidationPolicy = ommerValidationPolicy; this.ethContext = ethContext; this.pivotHeader = pivotHeader; + this.bodyValidationMode = bodyValidationMode; } @Override @@ -106,20 +110,20 @@ protected static long getBlocksPercent(final long lastBlock, final long totalBlo if (totalBlocks == 0) { return 0; } - final long blocksPercent = (100 * lastBlock / totalBlocks); - return blocksPercent; + return (100 * lastBlock / totalBlocks); } protected boolean importBlock(final BlockWithReceipts blockWithReceipts) { final BlockImporter importer = protocolSchedule.getByBlockHeader(blockWithReceipts.getHeader()).getBlockImporter(); final BlockImportResult blockImportResult = - importer.fastImportBlock( + importer.importBlockForSyncing( protocolContext, blockWithReceipts.getBlock(), blockWithReceipts.getReceipts(), headerValidationPolicy.getValidationModeForNextBlock(), - ommerValidationPolicy.getValidationModeForNextBlock()); + ommerValidationPolicy.getValidationModeForNextBlock(), + bodyValidationMode); return blockImportResult.isImported(); } } diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/ImportBlocksStepTest.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/ImportBlocksStepTest.java index 70c9e10eba6..af4f45f6901 100644 --- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/ImportBlocksStepTest.java +++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/ImportBlocksStepTest.java @@ -33,6 +33,7 @@ import org.hyperledger.besu.ethereum.eth.sync.ValidationPolicy; import org.hyperledger.besu.ethereum.eth.sync.tasks.exceptions.InvalidBlockException; import org.hyperledger.besu.ethereum.mainnet.BlockImportResult; +import org.hyperledger.besu.ethereum.mainnet.BodyValidationMode; import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule; import org.hyperledger.besu.ethereum.mainnet.ProtocolSpec; @@ -72,7 +73,8 @@ public void setUp() { validationPolicy, ommerValidationPolicy, null, - pivotHeader); + pivotHeader, + BodyValidationMode.FULL); } @Test @@ -84,12 +86,13 @@ public void shouldImportBlocks() { .collect(toList()); for (final BlockWithReceipts blockWithReceipts : blocksWithReceipts) { - when(blockImporter.fastImportBlock( + when(blockImporter.importBlockForSyncing( protocolContext, blockWithReceipts.getBlock(), blockWithReceipts.getReceipts(), FULL, - LIGHT)) + LIGHT, + BodyValidationMode.FULL)) .thenReturn(new BlockImportResult(true)); } importBlocksStep.accept(blocksWithReceipts); @@ -105,8 +108,13 @@ public void shouldThrowExceptionWhenValidationFails() { final Block block = gen.block(); final BlockWithReceipts blockWithReceipts = new BlockWithReceipts(block, gen.receipts(block)); - when(blockImporter.fastImportBlock( - protocolContext, block, blockWithReceipts.getReceipts(), FULL, LIGHT)) + when(blockImporter.importBlockForSyncing( + protocolContext, + block, + blockWithReceipts.getReceipts(), + FULL, + LIGHT, + BodyValidationMode.FULL)) .thenReturn(new BlockImportResult(false)); assertThatThrownBy(() -> importBlocksStep.accept(singletonList(blockWithReceipts))) .isInstanceOf(InvalidBlockException.class); From e721237c26b518d9b4f100b695df8ab7290034ee Mon Sep 17 00:00:00 2001 From: Matt Whitehead Date: Fri, 20 Sep 2024 09:38:57 +0100 Subject: [PATCH 22/47] Don't persist IBFT2 proposal blocks, just validate them (#7631) * Don't persist IBFT2 proposal blocks, just validate them Signed-off-by: Matthew Whitehead * Tidy up changelog Signed-off-by: Matthew Whitehead --------- Signed-off-by: Matthew Whitehead Signed-off-by: Matt Whitehead --- CHANGELOG.md | 2 +- .../hyperledger/besu/consensus/common/bft/RoundTimer.java | 2 +- .../besu/consensus/ibft/validation/MessageValidator.java | 8 +++++--- .../consensus/ibft/validation/MessageValidatorTest.java | 4 ++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c1ecca978ee..246df1d91cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,7 +15,7 @@ - Fix mounted data path directory permissions for besu user [#7575](https://github.com/hyperledger/besu/pull/7575) - Fix for `debug_traceCall` to handle transactions without specified gas price. [#7510](https://github.com/hyperledger/besu/pull/7510) - Corrects a regression where custom plugin services are not initialized correctly. [#7625](https://github.com/hyperledger/besu/pull/7625) - +- Fix for IBFT2 chains using the BONSAI DB format [#7631](https://github.com/hyperledger/besu/pull/7631) ## 24.9.1 diff --git a/consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/RoundTimer.java b/consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/RoundTimer.java index 6a8b02991d6..a01dc652cff 100644 --- a/consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/RoundTimer.java +++ b/consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/RoundTimer.java @@ -81,7 +81,7 @@ public synchronized void startTimer(final ConsensusRoundIdentifier round) { // Once we are up to round 2 start logging round expiries if (round.getRoundNumber() >= 2) { LOG.info( - "QBFT round {} expired. Moved to round {} which will expire in {} seconds", + "BFT round {} expired. Moved to round {} which will expire in {} seconds", round.getRoundNumber() - 1, round.getRoundNumber(), (expiryTime / 1000)); diff --git a/consensus/ibft/src/main/java/org/hyperledger/besu/consensus/ibft/validation/MessageValidator.java b/consensus/ibft/src/main/java/org/hyperledger/besu/consensus/ibft/validation/MessageValidator.java index 783861cdfef..1d7b3da9d61 100644 --- a/consensus/ibft/src/main/java/org/hyperledger/besu/consensus/ibft/validation/MessageValidator.java +++ b/consensus/ibft/src/main/java/org/hyperledger/besu/consensus/ibft/validation/MessageValidator.java @@ -78,7 +78,9 @@ public boolean validateProposal(final Proposal msg) { return false; } - if (!validateBlock(msg.getBlock())) { + // We want to validate the block but not persist it yet as it's just a proposal. If it turns + // out to be an accepted block it will be persisted at block import time + if (!validateBlockWithoutPersisting(msg.getBlock())) { return false; } @@ -93,14 +95,14 @@ public boolean validateProposal(final Proposal msg) { msg.getSignedPayload(), msg.getBlock(), blockInterface); } - private boolean validateBlock(final Block block) { + private boolean validateBlockWithoutPersisting(final Block block) { final BlockValidator blockValidator = protocolSchedule.getByBlockHeader(block.getHeader()).getBlockValidator(); final var validationResult = blockValidator.validateAndProcessBlock( - protocolContext, block, HeaderValidationMode.LIGHT, HeaderValidationMode.FULL); + protocolContext, block, HeaderValidationMode.LIGHT, HeaderValidationMode.FULL, false); if (validationResult.isFailed()) { LOG.info( diff --git a/consensus/ibft/src/test/java/org/hyperledger/besu/consensus/ibft/validation/MessageValidatorTest.java b/consensus/ibft/src/test/java/org/hyperledger/besu/consensus/ibft/validation/MessageValidatorTest.java index f7fb7af3e94..2352642b87b 100644 --- a/consensus/ibft/src/test/java/org/hyperledger/besu/consensus/ibft/validation/MessageValidatorTest.java +++ b/consensus/ibft/src/test/java/org/hyperledger/besu/consensus/ibft/validation/MessageValidatorTest.java @@ -113,7 +113,7 @@ public void setup() { when(protocolSpec.getBlockValidator()).thenReturn(blockValidator); when(protocolSchedule.getByBlockHeader(any())).thenReturn(protocolSpec); - when(blockValidator.validateAndProcessBlock(any(), any(), any(), any())) + when(blockValidator.validateAndProcessBlock(any(), any(), any(), any(), eq(false))) .thenReturn(new BlockProcessingResult(Optional.empty())); when(roundChangeCertificateValidator.validateProposalMessageMatchesLatestPrepareCertificate( @@ -168,7 +168,7 @@ public void ifProposalConsistencyChecksFailProposalIsIllegal() { @Test public void blockValidationFailureFailsValidation() { - when(blockValidator.validateAndProcessBlock(any(), any(), any(), any())) + when(blockValidator.validateAndProcessBlock(any(), any(), any(), any(), eq(false))) .thenReturn(new BlockProcessingResult("Failed")); final Proposal proposalMsg = From 19d3ca84b282f4db26f95497187209ea7fb6c72d Mon Sep 17 00:00:00 2001 From: Matt Whitehead Date: Fri, 20 Sep 2024 10:12:11 +0100 Subject: [PATCH 23/47] Dev/test option for short BFT block periods (#7588) * Dev mode for short BFT block periods Signed-off-by: Matthew Whitehead * Refactoring Signed-off-by: Matthew Whitehead * Fix comment Signed-off-by: Matthew Whitehead * Refactor to make BFT block milliseconds an experimental QBFT config option Signed-off-by: Matthew Whitehead * Update Json BFT config options Signed-off-by: Matthew Whitehead --------- Signed-off-by: Matthew Whitehead --- .../controller/IbftBesuControllerBuilder.java | 6 +- .../controller/QbftBesuControllerBuilder.java | 6 +- .../besu/config/BftConfigOptions.java | 7 +++ .../org/hyperledger/besu/config/BftFork.java | 13 +++++ .../besu/config/JsonBftConfigOptions.java | 10 ++++ .../besu/consensus/common/bft/BlockTimer.java | 29 ++++++++-- .../common/bft/MutableBftConfigOptions.java | 17 ++++++ .../besu/consensus/common/bft/RoundTimer.java | 12 ++-- .../consensus/common/bft/RoundTimerTest.java | 3 +- .../ibft/support/TestContextBuilder.java | 3 +- ...ftBlockHeaderValidationRulesetFactory.java | 58 +++++++++++-------- .../ibft/IbftProtocolScheduleBuilder.java | 6 +- ...ockHeaderValidationRulesetFactoryTest.java | 6 +- .../blockcreation/BftBlockCreatorTest.java | 5 +- .../qbft/support/TestContextBuilder.java | 3 +- ...ftBlockHeaderValidationRulesetFactory.java | 50 ++++++++++------ .../qbft/QbftForksSchedulesFactory.java | 1 + .../qbft/QbftProtocolScheduleBuilder.java | 5 +- ...ockHeaderValidationRulesetFactoryTest.java | 6 +- 19 files changed, 181 insertions(+), 65 deletions(-) diff --git a/besu/src/main/java/org/hyperledger/besu/controller/IbftBesuControllerBuilder.java b/besu/src/main/java/org/hyperledger/besu/controller/IbftBesuControllerBuilder.java index b8d4d2645e0..58412029fc3 100644 --- a/besu/src/main/java/org/hyperledger/besu/controller/IbftBesuControllerBuilder.java +++ b/besu/src/main/java/org/hyperledger/besu/controller/IbftBesuControllerBuilder.java @@ -74,6 +74,7 @@ import org.hyperledger.besu.plugin.services.BesuEvents; import org.hyperledger.besu.util.Subscribers; +import java.time.Duration; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -182,7 +183,10 @@ protected MiningCoordinator createMiningCoordinator( Util.publicKeyToAddress(nodeKey.getPublicKey()), proposerSelector, uniqueMessageMulticaster, - new RoundTimer(bftEventQueue, bftConfig.getRequestTimeoutSeconds(), bftExecutors), + new RoundTimer( + bftEventQueue, + Duration.ofSeconds(bftConfig.getRequestTimeoutSeconds()), + bftExecutors), new BlockTimer(bftEventQueue, forksSchedule, bftExecutors, clock), blockCreatorFactory, clock); diff --git a/besu/src/main/java/org/hyperledger/besu/controller/QbftBesuControllerBuilder.java b/besu/src/main/java/org/hyperledger/besu/controller/QbftBesuControllerBuilder.java index 7961305c48e..3d3412d4860 100644 --- a/besu/src/main/java/org/hyperledger/besu/controller/QbftBesuControllerBuilder.java +++ b/besu/src/main/java/org/hyperledger/besu/controller/QbftBesuControllerBuilder.java @@ -84,6 +84,7 @@ import org.hyperledger.besu.plugin.services.BesuEvents; import org.hyperledger.besu.util.Subscribers; +import java.time.Duration; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -222,7 +223,10 @@ protected MiningCoordinator createMiningCoordinator( Util.publicKeyToAddress(nodeKey.getPublicKey()), proposerSelector, uniqueMessageMulticaster, - new RoundTimer(bftEventQueue, qbftConfig.getRequestTimeoutSeconds(), bftExecutors), + new RoundTimer( + bftEventQueue, + Duration.ofSeconds(qbftConfig.getRequestTimeoutSeconds()), + bftExecutors), new BlockTimer(bftEventQueue, qbftForksSchedule, bftExecutors, clock), blockCreatorFactory, clock); diff --git a/config/src/main/java/org/hyperledger/besu/config/BftConfigOptions.java b/config/src/main/java/org/hyperledger/besu/config/BftConfigOptions.java index c94752b598d..58df7be8490 100644 --- a/config/src/main/java/org/hyperledger/besu/config/BftConfigOptions.java +++ b/config/src/main/java/org/hyperledger/besu/config/BftConfigOptions.java @@ -37,6 +37,13 @@ public interface BftConfigOptions { */ int getBlockPeriodSeconds(); + /** + * Gets block period milliseconds. For TESTING only. If set then blockperiodseconds is ignored. + * + * @return the block period milliseconds + */ + long getBlockPeriodMilliseconds(); + /** * Gets request timeout seconds. * diff --git a/config/src/main/java/org/hyperledger/besu/config/BftFork.java b/config/src/main/java/org/hyperledger/besu/config/BftFork.java index 30f8e1c5d5b..fdaa8f2fa9d 100644 --- a/config/src/main/java/org/hyperledger/besu/config/BftFork.java +++ b/config/src/main/java/org/hyperledger/besu/config/BftFork.java @@ -21,6 +21,7 @@ import java.util.Locale; import java.util.Optional; import java.util.OptionalInt; +import java.util.OptionalLong; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.databind.node.ArrayNode; @@ -40,6 +41,9 @@ public class BftFork implements Fork { /** The constant BLOCK_PERIOD_SECONDS_KEY. */ public static final String BLOCK_PERIOD_SECONDS_KEY = "blockperiodseconds"; + /** The constant BLOCK_PERIOD_MILLISECONDS_KEY. */ + public static final String BLOCK_PERIOD_MILLISECONDS_KEY = "xblockperiodmilliseconds"; + /** The constant BLOCK_REWARD_KEY. */ public static final String BLOCK_REWARD_KEY = "blockreward"; @@ -82,6 +86,15 @@ public OptionalInt getBlockPeriodSeconds() { return JsonUtil.getPositiveInt(forkConfigRoot, BLOCK_PERIOD_SECONDS_KEY); } + /** + * Gets block period milliseconds. Experimental for test scenarios only. + * + * @return the block period milliseconds + */ + public OptionalLong getBlockPeriodMilliseconds() { + return JsonUtil.getLong(forkConfigRoot, BLOCK_PERIOD_MILLISECONDS_KEY); + } + /** * Gets block reward wei. * diff --git a/config/src/main/java/org/hyperledger/besu/config/JsonBftConfigOptions.java b/config/src/main/java/org/hyperledger/besu/config/JsonBftConfigOptions.java index 95f2d9f7ce7..b1c8630b399 100644 --- a/config/src/main/java/org/hyperledger/besu/config/JsonBftConfigOptions.java +++ b/config/src/main/java/org/hyperledger/besu/config/JsonBftConfigOptions.java @@ -34,6 +34,7 @@ public class JsonBftConfigOptions implements BftConfigOptions { private static final long DEFAULT_EPOCH_LENGTH = 30_000; private static final int DEFAULT_BLOCK_PERIOD_SECONDS = 1; + private static final int DEFAULT_BLOCK_PERIOD_MILLISECONDS = 0; // Experimental for test only private static final int DEFAULT_ROUND_EXPIRY_SECONDS = 1; // In a healthy network this can be very small. This default limit will allow for suitable // protection for on a typical 20 node validator network with multiple rounds @@ -66,6 +67,12 @@ public int getBlockPeriodSeconds() { bftConfigRoot, "blockperiodseconds", DEFAULT_BLOCK_PERIOD_SECONDS); } + @Override + public long getBlockPeriodMilliseconds() { + return JsonUtil.getLong( + bftConfigRoot, "xblockperiodmilliseconds", DEFAULT_BLOCK_PERIOD_MILLISECONDS); + } + @Override public int getRequestTimeoutSeconds() { return JsonUtil.getInt(bftConfigRoot, "requesttimeoutseconds", DEFAULT_ROUND_EXPIRY_SECONDS); @@ -133,6 +140,9 @@ public Map asMap() { if (bftConfigRoot.has("blockperiodseconds")) { builder.put("blockPeriodSeconds", getBlockPeriodSeconds()); } + if (bftConfigRoot.has("xblockperiodmilliseconds")) { + builder.put("xBlockPeriodMilliSeconds", getBlockPeriodMilliseconds()); + } if (bftConfigRoot.has("requesttimeoutseconds")) { builder.put("requestTimeoutSeconds", getRequestTimeoutSeconds()); } diff --git a/consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/BlockTimer.java b/consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/BlockTimer.java index 5649b69e8f1..49ef94e008c 100644 --- a/consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/BlockTimer.java +++ b/consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/BlockTimer.java @@ -24,9 +24,14 @@ import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + /** Class for starting and keeping organised block timers */ public class BlockTimer { + private static final Logger LOG = LoggerFactory.getLogger(BlockTimer.class); + private final ForksSchedule forksSchedule; private final BftExecutors bftExecutors; private Optional> currentTimerTask; @@ -79,12 +84,26 @@ public synchronized void startTimer( cancelTimer(); final long now = clock.millis(); + final long expiryTime; + + // Experimental option for test scenarios only. Not for production use. + final long blockPeriodMilliseconds = + forksSchedule.getFork(round.getSequenceNumber()).getValue().getBlockPeriodMilliseconds(); - // absolute time when the timer is supposed to expire - final int blockPeriodSeconds = - forksSchedule.getFork(round.getSequenceNumber()).getValue().getBlockPeriodSeconds(); - final long minimumTimeBetweenBlocksMillis = blockPeriodSeconds * 1000L; - final long expiryTime = chainHeadHeader.getTimestamp() * 1_000 + minimumTimeBetweenBlocksMillis; + if (blockPeriodMilliseconds > 0) { + // Experimental mode for setting < 1 second block periods e.g. for CI/CD pipelines + // running tests against Besu + expiryTime = clock.millis() + blockPeriodMilliseconds; + LOG.warn( + "Test-mode only xblockperiodmilliseconds has been set to {} millisecond blocks. Do not use in a production system.", + blockPeriodMilliseconds); + } else { + // absolute time when the timer is supposed to expire + final int blockPeriodSeconds = + forksSchedule.getFork(round.getSequenceNumber()).getValue().getBlockPeriodSeconds(); + final long minimumTimeBetweenBlocksMillis = blockPeriodSeconds * 1000L; + expiryTime = chainHeadHeader.getTimestamp() * 1_000 + minimumTimeBetweenBlocksMillis; + } if (expiryTime > now) { final long delay = expiryTime - now; diff --git a/consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/MutableBftConfigOptions.java b/consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/MutableBftConfigOptions.java index fd406ea5e12..7b27c7b4c44 100644 --- a/consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/MutableBftConfigOptions.java +++ b/consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/MutableBftConfigOptions.java @@ -31,6 +31,7 @@ public class MutableBftConfigOptions implements BftConfigOptions { private long epochLength; private int blockPeriodSeconds; + private long blockPeriodMilliseconds; private int requestTimeoutSeconds; private int gossipedHistoryLimit; private int messageQueueLimit; @@ -48,6 +49,7 @@ public class MutableBftConfigOptions implements BftConfigOptions { public MutableBftConfigOptions(final BftConfigOptions bftConfigOptions) { this.epochLength = bftConfigOptions.getEpochLength(); this.blockPeriodSeconds = bftConfigOptions.getBlockPeriodSeconds(); + this.blockPeriodMilliseconds = bftConfigOptions.getBlockPeriodMilliseconds(); this.requestTimeoutSeconds = bftConfigOptions.getRequestTimeoutSeconds(); this.gossipedHistoryLimit = bftConfigOptions.getGossipedHistoryLimit(); this.messageQueueLimit = bftConfigOptions.getMessageQueueLimit(); @@ -68,6 +70,11 @@ public int getBlockPeriodSeconds() { return blockPeriodSeconds; } + @Override + public long getBlockPeriodMilliseconds() { + return blockPeriodMilliseconds; + } + @Override public int getRequestTimeoutSeconds() { return requestTimeoutSeconds; @@ -131,6 +138,16 @@ public void setBlockPeriodSeconds(final int blockPeriodSeconds) { this.blockPeriodSeconds = blockPeriodSeconds; } + /** + * Sets block period milliseconds. Experimental for test scenarios. Not for use on production + * systems. + * + * @param blockPeriodMilliseconds the block period milliseconds + */ + public void setBlockPeriodMilliseconds(final long blockPeriodMilliseconds) { + this.blockPeriodMilliseconds = blockPeriodMilliseconds; + } + /** * Sets request timeout seconds. * diff --git a/consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/RoundTimer.java b/consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/RoundTimer.java index a01dc652cff..0302943fc12 100644 --- a/consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/RoundTimer.java +++ b/consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/RoundTimer.java @@ -16,6 +16,7 @@ import org.hyperledger.besu.consensus.common.bft.events.RoundExpiry; +import java.time.Duration; import java.util.Optional; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; @@ -31,21 +32,21 @@ public class RoundTimer { private final BftExecutors bftExecutors; private Optional> currentTimerTask; private final BftEventQueue queue; - private final long baseExpiryMillis; + private final Duration baseExpiryPeriod; /** * Construct a RoundTimer with primed executor service ready to start timers * * @param queue The queue in which to put round expiry events - * @param baseExpirySeconds The initial round length for round 0 + * @param baseExpiryPeriod The initial round length for round 0 * @param bftExecutors executor service that timers can be scheduled with */ public RoundTimer( - final BftEventQueue queue, final long baseExpirySeconds, final BftExecutors bftExecutors) { + final BftEventQueue queue, final Duration baseExpiryPeriod, final BftExecutors bftExecutors) { this.queue = queue; this.bftExecutors = bftExecutors; this.currentTimerTask = Optional.empty(); - this.baseExpiryMillis = baseExpirySeconds * 1000; + this.baseExpiryPeriod = baseExpiryPeriod; } /** Cancels the current running round timer if there is one */ @@ -71,7 +72,8 @@ public synchronized boolean isRunning() { public synchronized void startTimer(final ConsensusRoundIdentifier round) { cancelTimer(); - final long expiryTime = baseExpiryMillis * (long) Math.pow(2, round.getRoundNumber()); + final long expiryTime = + baseExpiryPeriod.toMillis() * (long) Math.pow(2, round.getRoundNumber()); final Runnable newTimerRunnable = () -> queue.add(new RoundExpiry(round)); diff --git a/consensus/common/src/test/java/org/hyperledger/besu/consensus/common/bft/RoundTimerTest.java b/consensus/common/src/test/java/org/hyperledger/besu/consensus/common/bft/RoundTimerTest.java index 0ebca51c9e2..8f437395471 100644 --- a/consensus/common/src/test/java/org/hyperledger/besu/consensus/common/bft/RoundTimerTest.java +++ b/consensus/common/src/test/java/org/hyperledger/besu/consensus/common/bft/RoundTimerTest.java @@ -25,6 +25,7 @@ import org.hyperledger.besu.consensus.common.bft.events.RoundExpiry; +import java.time.Duration; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; @@ -46,7 +47,7 @@ public void initialise() { bftExecutors = mock(BftExecutors.class); queue = new BftEventQueue(1000); queue.start(); - timer = new RoundTimer(queue, 1, bftExecutors); + timer = new RoundTimer(queue, Duration.ofSeconds(1), bftExecutors); } @Test diff --git a/consensus/ibft/src/integration-test/java/org/hyperledger/besu/consensus/ibft/support/TestContextBuilder.java b/consensus/ibft/src/integration-test/java/org/hyperledger/besu/consensus/ibft/support/TestContextBuilder.java index 5d2b02b1a7c..8896733548d 100644 --- a/consensus/ibft/src/integration-test/java/org/hyperledger/besu/consensus/ibft/support/TestContextBuilder.java +++ b/consensus/ibft/src/integration-test/java/org/hyperledger/besu/consensus/ibft/support/TestContextBuilder.java @@ -100,6 +100,7 @@ import org.hyperledger.besu.util.Subscribers; import java.time.Clock; +import java.time.Duration; import java.time.Instant; import java.time.ZoneId; import java.util.ArrayList; @@ -403,7 +404,7 @@ private static ControllerAndState createControllerAndFinalState( Util.publicKeyToAddress(nodeKey.getPublicKey()), proposerSelector, multicaster, - new RoundTimer(bftEventQueue, ROUND_TIMER_SEC, bftExecutors), + new RoundTimer(bftEventQueue, Duration.ofSeconds(ROUND_TIMER_SEC), bftExecutors), new BlockTimer(bftEventQueue, forksSchedule, bftExecutors, TestClock.fixed()), blockCreatorFactory, clock); diff --git a/consensus/ibft/src/main/java/org/hyperledger/besu/consensus/ibft/IbftBlockHeaderValidationRulesetFactory.java b/consensus/ibft/src/main/java/org/hyperledger/besu/consensus/ibft/IbftBlockHeaderValidationRulesetFactory.java index 0e71fe81216..2367f90e2be 100644 --- a/consensus/ibft/src/main/java/org/hyperledger/besu/consensus/ibft/IbftBlockHeaderValidationRulesetFactory.java +++ b/consensus/ibft/src/main/java/org/hyperledger/besu/consensus/ibft/IbftBlockHeaderValidationRulesetFactory.java @@ -32,6 +32,7 @@ import org.hyperledger.besu.ethereum.mainnet.headervalidationrules.TimestampBoundedByFutureParameter; import org.hyperledger.besu.ethereum.mainnet.headervalidationrules.TimestampMoreRecentThanParent; +import java.time.Duration; import java.util.Optional; import org.apache.tuweni.units.bigints.UInt256; @@ -45,32 +46,43 @@ private IbftBlockHeaderValidationRulesetFactory() {} * Produces a BlockHeaderValidator configured for assessing bft block headers which are to form * part of the BlockChain (i.e. not proposed blocks, which do not contain commit seals) * - * @param secondsBetweenBlocks the minimum number of seconds which must elapse between blocks. + * @param minimumTimeBetweenBlocks the minimum time which must elapse between blocks. * @param baseFeeMarket an {@link Optional} wrapping {@link BaseFeeMarket} class if appropriate. * @return BlockHeaderValidator configured for assessing bft block headers */ public static BlockHeaderValidator.Builder blockHeaderValidator( - final long secondsBetweenBlocks, final Optional baseFeeMarket) { - return new BlockHeaderValidator.Builder() - .addRule(new AncestryValidationRule()) - .addRule(new GasUsageValidationRule()) - .addRule( - new GasLimitRangeAndDeltaValidationRule( - DEFAULT_MIN_GAS_LIMIT, DEFAULT_MAX_GAS_LIMIT, baseFeeMarket)) - .addRule(new TimestampBoundedByFutureParameter(1)) - .addRule(new TimestampMoreRecentThanParent(secondsBetweenBlocks)) - .addRule( - new ConstantFieldValidationRule<>( - "MixHash", BlockHeader::getMixHash, BftHelpers.EXPECTED_MIX_HASH)) - .addRule( - new ConstantFieldValidationRule<>( - "OmmersHash", BlockHeader::getOmmersHash, Hash.EMPTY_LIST_HASH)) - .addRule( - new ConstantFieldValidationRule<>( - "Difficulty", BlockHeader::getDifficulty, UInt256.ONE)) - .addRule(new ConstantFieldValidationRule<>("Nonce", BlockHeader::getNonce, 0L)) - .addRule(new BftValidatorsValidationRule()) - .addRule(new BftCoinbaseValidationRule()) - .addRule(new BftCommitSealsValidationRule()); + final Duration minimumTimeBetweenBlocks, final Optional baseFeeMarket) { + final BlockHeaderValidator.Builder ruleBuilder = + new BlockHeaderValidator.Builder() + .addRule(new AncestryValidationRule()) + .addRule(new GasUsageValidationRule()) + .addRule( + new GasLimitRangeAndDeltaValidationRule( + DEFAULT_MIN_GAS_LIMIT, DEFAULT_MAX_GAS_LIMIT, baseFeeMarket)) + .addRule(new TimestampBoundedByFutureParameter(1)) + .addRule( + new ConstantFieldValidationRule<>( + "MixHash", BlockHeader::getMixHash, BftHelpers.EXPECTED_MIX_HASH)) + .addRule( + new ConstantFieldValidationRule<>( + "OmmersHash", BlockHeader::getOmmersHash, Hash.EMPTY_LIST_HASH)) + .addRule( + new ConstantFieldValidationRule<>( + "Difficulty", BlockHeader::getDifficulty, UInt256.ONE)) + .addRule(new ConstantFieldValidationRule<>("Nonce", BlockHeader::getNonce, 0L)) + .addRule(new BftValidatorsValidationRule()) + .addRule(new BftCoinbaseValidationRule()) + .addRule(new BftCommitSealsValidationRule()); + + // Currently the minimum acceptable time between blocks is 1 second. The timestamp of an + // Ethereum header is stored as seconds since Unix epoch so blocks being produced more + // frequently than once a second cannot pass this validator. For non-production scenarios + // (e.g. for testing block production much more frequently than once a second) Besu has + // an experimental 'xblockperiodmilliseconds' option for BFT chains. If this is enabled + // we cannot apply the TimestampMoreRecentThanParent validation rule so we do not add it + if (minimumTimeBetweenBlocks.compareTo(Duration.ofSeconds(1)) >= 0) { + ruleBuilder.addRule(new TimestampMoreRecentThanParent(minimumTimeBetweenBlocks.getSeconds())); + } + return ruleBuilder; } } diff --git a/consensus/ibft/src/main/java/org/hyperledger/besu/consensus/ibft/IbftProtocolScheduleBuilder.java b/consensus/ibft/src/main/java/org/hyperledger/besu/consensus/ibft/IbftProtocolScheduleBuilder.java index 0789f2e8981..3adf5718955 100644 --- a/consensus/ibft/src/main/java/org/hyperledger/besu/consensus/ibft/IbftProtocolScheduleBuilder.java +++ b/consensus/ibft/src/main/java/org/hyperledger/besu/consensus/ibft/IbftProtocolScheduleBuilder.java @@ -29,6 +29,7 @@ import org.hyperledger.besu.evm.internal.EvmConfiguration; import org.hyperledger.besu.plugin.services.MetricsSystem; +import java.time.Duration; import java.util.Optional; /** Defines the protocol behaviours for a blockchain using a BFT consensus mechanism. */ @@ -120,6 +121,9 @@ protected BlockHeaderValidator.Builder createBlockHeaderRuleset( Optional.of(feeMarket).filter(FeeMarket::implementsBaseFee).map(BaseFeeMarket.class::cast); return IbftBlockHeaderValidationRulesetFactory.blockHeaderValidator( - config.getBlockPeriodSeconds(), baseFeeMarket); + config.getBlockPeriodMilliseconds() > 0 + ? Duration.ofMillis(config.getBlockPeriodMilliseconds()) + : Duration.ofSeconds(config.getBlockPeriodSeconds()), + baseFeeMarket); } } diff --git a/consensus/ibft/src/test/java/org/hyperledger/besu/consensus/ibft/IbftBlockHeaderValidationRulesetFactoryTest.java b/consensus/ibft/src/test/java/org/hyperledger/besu/consensus/ibft/IbftBlockHeaderValidationRulesetFactoryTest.java index a7deb9e1973..160fc2a2f39 100644 --- a/consensus/ibft/src/test/java/org/hyperledger/besu/consensus/ibft/IbftBlockHeaderValidationRulesetFactoryTest.java +++ b/consensus/ibft/src/test/java/org/hyperledger/besu/consensus/ibft/IbftBlockHeaderValidationRulesetFactoryTest.java @@ -38,6 +38,7 @@ import org.hyperledger.besu.ethereum.mainnet.HeaderValidationMode; import org.hyperledger.besu.ethereum.mainnet.feemarket.FeeMarket; +import java.time.Duration; import java.util.Collection; import java.util.List; import java.util.Optional; @@ -93,7 +94,7 @@ public void bftValidateHeaderPassesWithBaseFee() { final BlockHeaderValidator validator = IbftBlockHeaderValidationRulesetFactory.blockHeaderValidator( - 5, Optional.of(FeeMarket.london(1))) + Duration.ofSeconds(5), Optional.of(FeeMarket.london(1))) .build(); assertThat( @@ -372,7 +373,8 @@ private BlockHeaderTestFixture getPresetHeaderBuilder( } public BlockHeaderValidator getBlockHeaderValidator() { - return IbftBlockHeaderValidationRulesetFactory.blockHeaderValidator(5, Optional.empty()) + return IbftBlockHeaderValidationRulesetFactory.blockHeaderValidator( + Duration.ofSeconds(5), Optional.empty()) .build(); } } diff --git a/consensus/ibft/src/test/java/org/hyperledger/besu/consensus/ibft/blockcreation/BftBlockCreatorTest.java b/consensus/ibft/src/test/java/org/hyperledger/besu/consensus/ibft/blockcreation/BftBlockCreatorTest.java index 8b8406b6385..5469717b13f 100644 --- a/consensus/ibft/src/test/java/org/hyperledger/besu/consensus/ibft/blockcreation/BftBlockCreatorTest.java +++ b/consensus/ibft/src/test/java/org/hyperledger/besu/consensus/ibft/blockcreation/BftBlockCreatorTest.java @@ -64,6 +64,7 @@ import org.hyperledger.besu.testutil.DeterministicEthScheduler; import org.hyperledger.besu.testutil.TestClock; +import java.time.Duration; import java.time.ZoneId; import java.util.Collections; import java.util.List; @@ -105,7 +106,7 @@ public void createdBlockPassesValidationRulesAndHasAppropriateHashAndMixHash() { public BlockHeaderValidator.Builder createBlockHeaderRuleset( final BftConfigOptions config, final FeeMarket feeMarket) { return IbftBlockHeaderValidationRulesetFactory.blockHeaderValidator( - 5, Optional.empty()); + Duration.ofSeconds(5), Optional.empty()); } }; final GenesisConfigOptions configOptions = @@ -200,7 +201,7 @@ public BlockHeaderValidator.Builder createBlockHeaderRuleset( final BlockHeaderValidator rules = IbftBlockHeaderValidationRulesetFactory.blockHeaderValidator( - secondsBetweenBlocks, Optional.empty()) + Duration.ofSeconds(secondsBetweenBlocks), Optional.empty()) .build(); // NOTE: The header will not contain commit seals, so can only do light validation on header. diff --git a/consensus/qbft/src/integration-test/java/org/hyperledger/besu/consensus/qbft/support/TestContextBuilder.java b/consensus/qbft/src/integration-test/java/org/hyperledger/besu/consensus/qbft/support/TestContextBuilder.java index 8906f0de7f6..d90d5a15277 100644 --- a/consensus/qbft/src/integration-test/java/org/hyperledger/besu/consensus/qbft/support/TestContextBuilder.java +++ b/consensus/qbft/src/integration-test/java/org/hyperledger/besu/consensus/qbft/support/TestContextBuilder.java @@ -118,6 +118,7 @@ import java.io.IOException; import java.nio.file.Path; import java.time.Clock; +import java.time.Duration; import java.time.Instant; import java.time.ZoneId; import java.util.ArrayList; @@ -512,7 +513,7 @@ private static ControllerAndState createControllerAndFinalState( Util.publicKeyToAddress(nodeKey.getPublicKey()), proposerSelector, multicaster, - new RoundTimer(bftEventQueue, ROUND_TIMER_SEC, bftExecutors), + new RoundTimer(bftEventQueue, Duration.ofSeconds(ROUND_TIMER_SEC), bftExecutors), new BlockTimer(bftEventQueue, forksSchedule, bftExecutors, TestClock.fixed()), blockCreatorFactory, clock); diff --git a/consensus/qbft/src/main/java/org/hyperledger/besu/consensus/qbft/QbftBlockHeaderValidationRulesetFactory.java b/consensus/qbft/src/main/java/org/hyperledger/besu/consensus/qbft/QbftBlockHeaderValidationRulesetFactory.java index 7320dfaaf7a..ac5ba3ac23a 100644 --- a/consensus/qbft/src/main/java/org/hyperledger/besu/consensus/qbft/QbftBlockHeaderValidationRulesetFactory.java +++ b/consensus/qbft/src/main/java/org/hyperledger/besu/consensus/qbft/QbftBlockHeaderValidationRulesetFactory.java @@ -31,6 +31,7 @@ import org.hyperledger.besu.ethereum.mainnet.headervalidationrules.TimestampBoundedByFutureParameter; import org.hyperledger.besu.ethereum.mainnet.headervalidationrules.TimestampMoreRecentThanParent; +import java.time.Duration; import java.util.Optional; import org.apache.tuweni.units.bigints.UInt256; @@ -44,31 +45,42 @@ private QbftBlockHeaderValidationRulesetFactory() {} * Produces a BlockHeaderValidator configured for assessing bft block headers which are to form * part of the BlockChain (i.e. not proposed blocks, which do not contain commit seals) * - * @param secondsBetweenBlocks the minimum number of seconds which must elapse between blocks. + * @param minimumTimeBetweenBlocks the minimum amount of time that must elapse between blocks. * @param useValidatorContract whether validator selection is using a validator contract * @param baseFeeMarket an {@link Optional} wrapping {@link BaseFeeMarket} class if appropriate. * @return BlockHeaderValidator configured for assessing bft block headers */ public static BlockHeaderValidator.Builder blockHeaderValidator( - final long secondsBetweenBlocks, + final Duration minimumTimeBetweenBlocks, final boolean useValidatorContract, final Optional baseFeeMarket) { - return new BlockHeaderValidator.Builder() - .addRule(new AncestryValidationRule()) - .addRule(new GasUsageValidationRule()) - .addRule( - new GasLimitRangeAndDeltaValidationRule( - DEFAULT_MIN_GAS_LIMIT, DEFAULT_MAX_GAS_LIMIT, baseFeeMarket)) - .addRule(new TimestampBoundedByFutureParameter(1)) - .addRule(new TimestampMoreRecentThanParent(secondsBetweenBlocks)) - .addRule( - new ConstantFieldValidationRule<>( - "MixHash", BlockHeader::getMixHash, BftHelpers.EXPECTED_MIX_HASH)) - .addRule( - new ConstantFieldValidationRule<>( - "Difficulty", BlockHeader::getDifficulty, UInt256.ONE)) - .addRule(new QbftValidatorsValidationRule(useValidatorContract)) - .addRule(new BftCoinbaseValidationRule()) - .addRule(new BftCommitSealsValidationRule()); + BlockHeaderValidator.Builder ruleBuilder = + new BlockHeaderValidator.Builder() + .addRule(new AncestryValidationRule()) + .addRule(new GasUsageValidationRule()) + .addRule( + new GasLimitRangeAndDeltaValidationRule( + DEFAULT_MIN_GAS_LIMIT, DEFAULT_MAX_GAS_LIMIT, baseFeeMarket)) + .addRule(new TimestampBoundedByFutureParameter(1)) + .addRule( + new ConstantFieldValidationRule<>( + "MixHash", BlockHeader::getMixHash, BftHelpers.EXPECTED_MIX_HASH)) + .addRule( + new ConstantFieldValidationRule<>( + "Difficulty", BlockHeader::getDifficulty, UInt256.ONE)) + .addRule(new QbftValidatorsValidationRule(useValidatorContract)) + .addRule(new BftCoinbaseValidationRule()) + .addRule(new BftCommitSealsValidationRule()); + + // Currently the minimum acceptable time between blocks is 1 second. The timestamp of an + // Ethereum header is stored as seconds since Unix epoch so blocks being produced more + // frequently than once a second cannot pass this validator. For non-production scenarios + // (e.g. for testing block production much more frequently than once a second) Besu has + // an experimental 'xblockperiodmilliseconds' option for BFT chains. If this is enabled + // we cannot apply the TimestampMoreRecentThanParent validation rule so we do not add it + if (minimumTimeBetweenBlocks.compareTo(Duration.ofSeconds(1)) >= 0) { + ruleBuilder.addRule(new TimestampMoreRecentThanParent(minimumTimeBetweenBlocks.getSeconds())); + } + return ruleBuilder; } } diff --git a/consensus/qbft/src/main/java/org/hyperledger/besu/consensus/qbft/QbftForksSchedulesFactory.java b/consensus/qbft/src/main/java/org/hyperledger/besu/consensus/qbft/QbftForksSchedulesFactory.java index 90448f62015..0f0d467de37 100644 --- a/consensus/qbft/src/main/java/org/hyperledger/besu/consensus/qbft/QbftForksSchedulesFactory.java +++ b/consensus/qbft/src/main/java/org/hyperledger/besu/consensus/qbft/QbftForksSchedulesFactory.java @@ -49,6 +49,7 @@ private static QbftConfigOptions createQbftConfigOptions( new MutableQbftConfigOptions(lastSpec.getValue()); fork.getBlockPeriodSeconds().ifPresent(bftConfigOptions::setBlockPeriodSeconds); + fork.getBlockPeriodMilliseconds().ifPresent(bftConfigOptions::setBlockPeriodMilliseconds); fork.getBlockRewardWei().ifPresent(bftConfigOptions::setBlockRewardWei); if (fork.isMiningBeneficiaryConfigured()) { diff --git a/consensus/qbft/src/main/java/org/hyperledger/besu/consensus/qbft/QbftProtocolScheduleBuilder.java b/consensus/qbft/src/main/java/org/hyperledger/besu/consensus/qbft/QbftProtocolScheduleBuilder.java index 44c7ddfba8c..e1cbc134b6f 100644 --- a/consensus/qbft/src/main/java/org/hyperledger/besu/consensus/qbft/QbftProtocolScheduleBuilder.java +++ b/consensus/qbft/src/main/java/org/hyperledger/besu/consensus/qbft/QbftProtocolScheduleBuilder.java @@ -33,6 +33,7 @@ import org.hyperledger.besu.evm.internal.EvmConfiguration; import org.hyperledger.besu.plugin.services.MetricsSystem; +import java.time.Duration; import java.util.Optional; /** Defines the protocol behaviours for a blockchain using a QBFT consensus mechanism. */ @@ -164,7 +165,9 @@ protected BlockHeaderValidator.Builder createBlockHeaderRuleset( Optional.of(feeMarket).filter(FeeMarket::implementsBaseFee).map(BaseFeeMarket.class::cast); return QbftBlockHeaderValidationRulesetFactory.blockHeaderValidator( - qbftConfigOptions.getBlockPeriodSeconds(), + qbftConfigOptions.getBlockPeriodMilliseconds() > 0 + ? Duration.ofMillis(qbftConfigOptions.getBlockPeriodMilliseconds()) + : Duration.ofSeconds(qbftConfigOptions.getBlockPeriodSeconds()), qbftConfigOptions.isValidatorContractMode(), baseFeeMarket); } diff --git a/consensus/qbft/src/test/java/org/hyperledger/besu/consensus/qbft/QbftBlockHeaderValidationRulesetFactoryTest.java b/consensus/qbft/src/test/java/org/hyperledger/besu/consensus/qbft/QbftBlockHeaderValidationRulesetFactoryTest.java index 4771cf91cbd..ae1fbc0f19b 100644 --- a/consensus/qbft/src/test/java/org/hyperledger/besu/consensus/qbft/QbftBlockHeaderValidationRulesetFactoryTest.java +++ b/consensus/qbft/src/test/java/org/hyperledger/besu/consensus/qbft/QbftBlockHeaderValidationRulesetFactoryTest.java @@ -34,6 +34,7 @@ import org.hyperledger.besu.ethereum.mainnet.HeaderValidationMode; import org.hyperledger.besu.ethereum.mainnet.feemarket.FeeMarket; +import java.time.Duration; import java.util.Collection; import java.util.List; import java.util.Optional; @@ -92,7 +93,7 @@ public void bftValidateHeaderPassesWithBaseFee() { final BlockHeaderValidator validator = QbftBlockHeaderValidationRulesetFactory.blockHeaderValidator( - 5, false, Optional.of(FeeMarket.london(1))) + Duration.ofSeconds(5), false, Optional.of(FeeMarket.london(1))) .build(); assertThat( @@ -366,7 +367,8 @@ blockHeader, parentHeader, protocolContext(validators), HeaderValidationMode.FUL } public BlockHeaderValidator getBlockHeaderValidator() { - return QbftBlockHeaderValidationRulesetFactory.blockHeaderValidator(5, false, Optional.empty()) + return QbftBlockHeaderValidationRulesetFactory.blockHeaderValidator( + Duration.ofSeconds(5), false, Optional.empty()) .build(); } } From 3dbe60617249446222fa786e9bb82ea3311a361a Mon Sep 17 00:00:00 2001 From: Fabio Di Fabio Date: Fri, 20 Sep 2024 15:10:59 +0200 Subject: [PATCH 24/47] Wait for Besu to be up before running Goss Docker test 02 (#7655) Signed-off-by: Fabio Di Fabio --- docker/tests/02/goss_wait.yaml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 docker/tests/02/goss_wait.yaml diff --git a/docker/tests/02/goss_wait.yaml b/docker/tests/02/goss_wait.yaml new file mode 100644 index 00000000000..f6b397c6188 --- /dev/null +++ b/docker/tests/02/goss_wait.yaml @@ -0,0 +1,7 @@ +--- +# runtime docker tests for interfaces & ports +port: + tcp:30303: + listening: true + ip: + - 0.0.0.0 From 676e1f8c1344edd3009eba6f22a46287b4e98bdb Mon Sep 17 00:00:00 2001 From: Fabio Di Fabio Date: Fri, 20 Sep 2024 15:52:12 +0200 Subject: [PATCH 25/47] Rebalance GHA runners to reduce ATs failure and speedup unit tests (#7656) Signed-off-by: Fabio Di Fabio --- .github/workflows/acceptance-tests.yml | 2 +- .github/workflows/pre-review.yml | 2 +- .github/workflows/reference-tests.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/acceptance-tests.yml b/.github/workflows/acceptance-tests.yml index a8f6981d896..27d0020b2c5 100644 --- a/.github/workflows/acceptance-tests.yml +++ b/.github/workflows/acceptance-tests.yml @@ -12,7 +12,7 @@ concurrency: env: GRADLE_OPTS: "-Xmx7g" - total-runners: 12 + total-runners: 14 jobs: acceptanceTestEthereum: diff --git a/.github/workflows/pre-review.yml b/.github/workflows/pre-review.yml index cba13f1ebda..35e8956f1db 100644 --- a/.github/workflows/pre-review.yml +++ b/.github/workflows/pre-review.yml @@ -12,7 +12,7 @@ concurrency: env: GRADLE_OPTS: "-Xmx6g -Dorg.gradle.parallel=true" - total-runners: 8 + total-runners: 10 jobs: repolint: diff --git a/.github/workflows/reference-tests.yml b/.github/workflows/reference-tests.yml index 4e458e057e3..435cbba0f8b 100644 --- a/.github/workflows/reference-tests.yml +++ b/.github/workflows/reference-tests.yml @@ -8,7 +8,7 @@ on: env: GRADLE_OPTS: "-Xmx6g -Dorg.gradle.daemon=false -Dorg.gradle.parallel=true -Dorg.gradle.caching=true" - total-runners: 10 + total-runners: 8 concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} From f1da4e77e6fc7bd9eefc61b0f82d367962debb1b Mon Sep 17 00:00:00 2001 From: Fabio Di Fabio Date: Fri, 20 Sep 2024 16:31:37 +0200 Subject: [PATCH 26/47] Rebalance GHA runners to reduce ATs failure and speedup unit tests [part 2] (#7658) Signed-off-by: Fabio Di Fabio --- .github/workflows/acceptance-tests.yml | 2 +- .github/workflows/pre-review.yml | 2 +- .github/workflows/reference-tests.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/acceptance-tests.yml b/.github/workflows/acceptance-tests.yml index 27d0020b2c5..e1549b2357d 100644 --- a/.github/workflows/acceptance-tests.yml +++ b/.github/workflows/acceptance-tests.yml @@ -24,7 +24,7 @@ jobs: strategy: fail-fast: true matrix: - runner_index: [0,1,2,3,4,5,6,7,8,9,10,11] + runner_index: [0,1,2,3,4,5,6,7,8,9,10,11,12,13] steps: - name: Checkout Repo uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 diff --git a/.github/workflows/pre-review.yml b/.github/workflows/pre-review.yml index 35e8956f1db..93bfcfa9f50 100644 --- a/.github/workflows/pre-review.yml +++ b/.github/workflows/pre-review.yml @@ -83,7 +83,7 @@ jobs: strategy: fail-fast: true matrix: - runner_index: [0,1,2,3,4,5,6,7] + runner_index: [0,1,2,3,4,5,6,7,8,9] steps: - name: Checkout Repo uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 diff --git a/.github/workflows/reference-tests.yml b/.github/workflows/reference-tests.yml index 435cbba0f8b..d27114ebc1e 100644 --- a/.github/workflows/reference-tests.yml +++ b/.github/workflows/reference-tests.yml @@ -24,7 +24,7 @@ jobs: strategy: fail-fast: true matrix: - runner_index: [1,2,3,4,5,6,7,8,9,10] + runner_index: [1,2,3,4,5,6,7,8] steps: - name: Checkout Repo uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 From 3e0e5cdc1ffa0888ebba96e0edb3a9bdf18eb17e Mon Sep 17 00:00:00 2001 From: Fabio Di Fabio Date: Fri, 20 Sep 2024 17:11:56 +0200 Subject: [PATCH 27/47] Fix reading tx-pool-min-score option from configuration file (#7623) Signed-off-by: Fabio Di Fabio --- CHANGELOG.md | 1 + .../util/TomlConfigurationDefaultProvider.java | 6 +++++- .../options/TransactionPoolOptionsTest.java | 18 ++++++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 246df1d91cd..96e1511eead 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ - Fix for `debug_traceCall` to handle transactions without specified gas price. [#7510](https://github.com/hyperledger/besu/pull/7510) - Corrects a regression where custom plugin services are not initialized correctly. [#7625](https://github.com/hyperledger/besu/pull/7625) - Fix for IBFT2 chains using the BONSAI DB format [#7631](https://github.com/hyperledger/besu/pull/7631) +- Fix reading `tx-pool-min-score` option from configuration file [#7623](https://github.com/hyperledger/besu/pull/7623) ## 24.9.1 diff --git a/besu/src/main/java/org/hyperledger/besu/cli/util/TomlConfigurationDefaultProvider.java b/besu/src/main/java/org/hyperledger/besu/cli/util/TomlConfigurationDefaultProvider.java index ca76b40b686..636be329d43 100644 --- a/besu/src/main/java/org/hyperledger/besu/cli/util/TomlConfigurationDefaultProvider.java +++ b/besu/src/main/java/org/hyperledger/besu/cli/util/TomlConfigurationDefaultProvider.java @@ -120,7 +120,11 @@ private String getConfigurationValue(final OptionSpec optionSpec) { } private boolean isNumericType(final Class type) { - return type.equals(Integer.class) + return type.equals(Byte.class) + || type.equals(byte.class) + || type.equals(Short.class) + || type.equals(short.class) + || type.equals(Integer.class) || type.equals(int.class) || type.equals(Long.class) || type.equals(long.class) diff --git a/besu/src/test/java/org/hyperledger/besu/cli/options/TransactionPoolOptionsTest.java b/besu/src/test/java/org/hyperledger/besu/cli/options/TransactionPoolOptionsTest.java index eb48a3f2a5c..37acbe167ff 100644 --- a/besu/src/test/java/org/hyperledger/besu/cli/options/TransactionPoolOptionsTest.java +++ b/besu/src/test/java/org/hyperledger/besu/cli/options/TransactionPoolOptionsTest.java @@ -427,6 +427,24 @@ public void minScoreWorks() { Byte.toString(minScore)); } + @Test + public void minScoreWorksConfigFile() throws IOException { + final byte minScore = -10; + final Path tempConfigFilePath = + createTempFile( + "config", + String.format( + """ + tx-pool-min-score=%s + """, + minScore)); + + internalTestSuccess( + config -> assertThat(config.getMinScore()).isEqualTo(minScore), + "--config-file", + tempConfigFilePath.toString()); + } + @Test public void minScoreNonByteValueReturnError() { final var overflowMinScore = Integer.toString(-300); From 6e246ca4b0be04fe14f67a25cde895c127feeec4 Mon Sep 17 00:00:00 2001 From: Cooper Mosawi Date: Sat, 21 Sep 2024 05:13:16 +1200 Subject: [PATCH 28/47] fix opentelemetry (#7649) Signed-off-by: Blue Co-authored-by: Fabio Di Fabio --- docs/tracing/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tracing/README.md b/docs/tracing/README.md index 77deadd16aa..3a3f9fa435f 100644 --- a/docs/tracing/README.md +++ b/docs/tracing/README.md @@ -1,6 +1,6 @@ # Tracing -Hyperledger Besu integrates with the [open-telemetry](https://open-telemetry.io) project to integrate tracing reporting. +Hyperledger Besu integrates with the [open-telemetry](https://opentelemetry.io/) project to integrate tracing reporting. This allows to report all JSON-RPC traffic as traces. From 1751a77f98cc6cdf218cd80f429e15ccd8e01e67 Mon Sep 17 00:00:00 2001 From: daniellehrner Date: Sat, 21 Sep 2024 13:28:01 +0200 Subject: [PATCH 29/47] 7702 validation checks v2 (#7653) * yParity is valid up to 2**256 as well Signed-off-by: Daniel Lehrner --- .../besu/crypto/AbstractSECP256.java | 2 +- .../besu/crypto/CodeDelegationSignature.java | 15 ++++++++--- .../besu/crypto/SignatureAlgorithm.java | 2 +- .../crypto/CodeDelegationSignatureTest.java | 27 +++++++++++++------ .../CodeDelegationTransactionDecoder.java | 2 +- 5 files changed, 33 insertions(+), 15 deletions(-) diff --git a/crypto/algorithms/src/main/java/org/hyperledger/besu/crypto/AbstractSECP256.java b/crypto/algorithms/src/main/java/org/hyperledger/besu/crypto/AbstractSECP256.java index ce376512668..bd450b206e9 100644 --- a/crypto/algorithms/src/main/java/org/hyperledger/besu/crypto/AbstractSECP256.java +++ b/crypto/algorithms/src/main/java/org/hyperledger/besu/crypto/AbstractSECP256.java @@ -214,7 +214,7 @@ public SECPSignature createSignature(final BigInteger r, final BigInteger s, fin @Override public CodeDelegationSignature createCodeDelegationSignature( - final BigInteger r, final BigInteger s, final long yParity) { + final BigInteger r, final BigInteger s, final BigInteger yParity) { return CodeDelegationSignature.create(r, s, yParity); } diff --git a/crypto/algorithms/src/main/java/org/hyperledger/besu/crypto/CodeDelegationSignature.java b/crypto/algorithms/src/main/java/org/hyperledger/besu/crypto/CodeDelegationSignature.java index 4bb2e4653e2..06ec72bf0a9 100644 --- a/crypto/algorithms/src/main/java/org/hyperledger/besu/crypto/CodeDelegationSignature.java +++ b/crypto/algorithms/src/main/java/org/hyperledger/besu/crypto/CodeDelegationSignature.java @@ -42,18 +42,25 @@ public CodeDelegationSignature(final BigInteger r, final BigInteger s, final byt * @return the new CodeDelegationSignature */ public static CodeDelegationSignature create( - final BigInteger r, final BigInteger s, final long yParity) { + final BigInteger r, final BigInteger s, final BigInteger yParity) { checkNotNull(r); checkNotNull(s); if (r.compareTo(TWO_POW_256) >= 0) { - throw new IllegalArgumentException("Invalid 'r' value, should be < 2^256 but got " + r); + throw new IllegalArgumentException( + "Invalid 'r' value, should be < 2^256 but got " + r.toString(16)); } if (s.compareTo(TWO_POW_256) >= 0) { - throw new IllegalArgumentException("Invalid 's' value, should be < 2^256 but got " + s); + throw new IllegalArgumentException( + "Invalid 's' value, should be < 2^256 but got " + s.toString(16)); } - return new CodeDelegationSignature(r, s, (byte) yParity); + if (yParity.compareTo(TWO_POW_256) >= 0) { + throw new IllegalArgumentException( + "Invalid 'yParity' value, should be < 2^256 but got " + yParity.toString(16)); + } + + return new CodeDelegationSignature(r, s, yParity.byteValue()); } } diff --git a/crypto/algorithms/src/main/java/org/hyperledger/besu/crypto/SignatureAlgorithm.java b/crypto/algorithms/src/main/java/org/hyperledger/besu/crypto/SignatureAlgorithm.java index 8e19b608544..4bf8d89c825 100644 --- a/crypto/algorithms/src/main/java/org/hyperledger/besu/crypto/SignatureAlgorithm.java +++ b/crypto/algorithms/src/main/java/org/hyperledger/besu/crypto/SignatureAlgorithm.java @@ -224,7 +224,7 @@ Optional recoverPublicKeyFromSignature( * @return the code delegation signature */ CodeDelegationSignature createCodeDelegationSignature( - final BigInteger r, final BigInteger s, final long yParity); + final BigInteger r, final BigInteger s, final BigInteger yParity); /** * Decode secp signature. diff --git a/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/CodeDelegationSignatureTest.java b/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/CodeDelegationSignatureTest.java index 1cc66966a78..332aa14893f 100644 --- a/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/CodeDelegationSignatureTest.java +++ b/crypto/algorithms/src/test/java/org/hyperledger/besu/crypto/CodeDelegationSignatureTest.java @@ -29,19 +29,19 @@ class CodeDelegationSignatureTest { void testValidInputs() { BigInteger r = BigInteger.ONE; BigInteger s = BigInteger.TEN; - long yParity = 1L; + BigInteger yParity = BigInteger.ONE; CodeDelegationSignature result = CodeDelegationSignature.create(r, s, yParity); assertThat(r).isEqualTo(result.getR()); assertThat(s).isEqualTo(result.getS()); - assertThat((byte) yParity).isEqualTo(result.getRecId()); + assertThat(yParity.byteValue()).isEqualTo(result.getRecId()); } @Test void testNullRValue() { BigInteger s = BigInteger.TEN; - long yParity = 0L; + BigInteger yParity = BigInteger.ZERO; assertThatExceptionOfType(NullPointerException.class) .isThrownBy(() -> CodeDelegationSignature.create(null, s, yParity)); @@ -50,7 +50,7 @@ void testNullRValue() { @Test void testNullSValue() { BigInteger r = BigInteger.ONE; - long yParity = 0L; + BigInteger yParity = BigInteger.ZERO; assertThatExceptionOfType(NullPointerException.class) .isThrownBy(() -> CodeDelegationSignature.create(r, null, yParity)); @@ -60,7 +60,7 @@ void testNullSValue() { void testRValueExceedsTwoPow256() { BigInteger r = TWO_POW_256; BigInteger s = BigInteger.TEN; - long yParity = 0L; + BigInteger yParity = BigInteger.ZERO; assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> CodeDelegationSignature.create(r, s, yParity)) @@ -71,23 +71,34 @@ void testRValueExceedsTwoPow256() { void testSValueExceedsTwoPow256() { BigInteger r = BigInteger.ONE; BigInteger s = TWO_POW_256; - long yParity = 0L; + BigInteger yParity = BigInteger.ZERO; assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> CodeDelegationSignature.create(r, s, yParity)) .withMessageContainingAll("Invalid 's' value, should be < 2^256"); } + @Test + void testYParityExceedsTwoPow256() { + BigInteger r = BigInteger.ONE; + BigInteger s = BigInteger.TWO; + BigInteger yParity = TWO_POW_256; + + assertThatExceptionOfType(IllegalArgumentException.class) + .isThrownBy(() -> CodeDelegationSignature.create(r, s, yParity)) + .withMessageContainingAll("Invalid 'yParity' value, should be < 2^256"); + } + @Test void testValidYParityZero() { BigInteger r = BigInteger.ONE; BigInteger s = BigInteger.TEN; - long yParity = 0L; + BigInteger yParity = BigInteger.ZERO; CodeDelegationSignature result = CodeDelegationSignature.create(r, s, yParity); assertThat(r).isEqualTo(result.getR()); assertThat(s).isEqualTo(result.getS()); - assertThat((byte) yParity).isEqualTo(result.getRecId()); + assertThat(yParity.byteValue()).isEqualTo(result.getRecId()); } } diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/encoding/CodeDelegationTransactionDecoder.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/encoding/CodeDelegationTransactionDecoder.java index d3ef60bfc41..6448940d8d5 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/encoding/CodeDelegationTransactionDecoder.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/encoding/CodeDelegationTransactionDecoder.java @@ -81,7 +81,7 @@ public static CodeDelegation decodeInnerPayload(final RLPInput input) { final Address address = Address.wrap(input.readBytes()); final long nonce = input.readLongScalar(); - final long yParity = input.readUnsignedIntScalar(); + final BigInteger yParity = input.readUInt256Scalar().toUnsignedBigInteger(); final BigInteger r = input.readUInt256Scalar().toUnsignedBigInteger(); final BigInteger s = input.readUInt256Scalar().toUnsignedBigInteger(); From 9d689b940134b4f7a9b80020829d506417c2065e Mon Sep 17 00:00:00 2001 From: Sally MacFarlane Date: Sun, 22 Sep 2024 06:45:09 +1000 Subject: [PATCH 30/47] remove integration tests related to privacy (#7645) * remove integration tests related to privacy Signed-off-by: Sally MacFarlane --------- Signed-off-by: Sally MacFarlane --- .../hyperledger/besu/enclave/EnclaveTest.java | 215 --------------- .../enclave/TlsCertificateDefinition.java | 52 ---- .../besu/enclave/TlsEnabledEnclaveTest.java | 144 ----------- .../enclave/TlsEnabledHttpServerFactory.java | 109 -------- .../hyperledger/besu/enclave/TlsHelpers.java | 98 ------- ...vGetPrivateTransactionIntegrationTest.java | 192 -------------- ...acyPrecompiledContractIntegrationTest.java | 244 ------------------ testutil/src/main/resources/enclave_key_0.key | 1 - 8 files changed, 1055 deletions(-) delete mode 100644 enclave/src/integration-test/java/org/hyperledger/besu/enclave/EnclaveTest.java delete mode 100644 enclave/src/integration-test/java/org/hyperledger/besu/enclave/TlsCertificateDefinition.java delete mode 100644 enclave/src/integration-test/java/org/hyperledger/besu/enclave/TlsEnabledEnclaveTest.java delete mode 100644 enclave/src/integration-test/java/org/hyperledger/besu/enclave/TlsEnabledHttpServerFactory.java delete mode 100644 enclave/src/integration-test/java/org/hyperledger/besu/enclave/TlsHelpers.java delete mode 100644 ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/fork/frontier/PrivGetPrivateTransactionIntegrationTest.java delete mode 100644 ethereum/core/src/integration-test/java/org/hyperledger/besu/ethereum/mainnet/precompiles/privacy/PrivacyPrecompiledContractIntegrationTest.java delete mode 100644 testutil/src/main/resources/enclave_key_0.key diff --git a/enclave/src/integration-test/java/org/hyperledger/besu/enclave/EnclaveTest.java b/enclave/src/integration-test/java/org/hyperledger/besu/enclave/EnclaveTest.java deleted file mode 100644 index b9b657e6689..00000000000 --- a/enclave/src/integration-test/java/org/hyperledger/besu/enclave/EnclaveTest.java +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.enclave; - -import static java.nio.charset.StandardCharsets.UTF_8; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.catchThrowable; - -import org.hyperledger.besu.enclave.types.PrivacyGroup; -import org.hyperledger.besu.enclave.types.ReceiveResponse; -import org.hyperledger.besu.enclave.types.SendResponse; -import org.hyperledger.enclave.testutil.EnclaveEncryptorType; -import org.hyperledger.enclave.testutil.EnclaveKeyConfiguration; -import org.hyperledger.enclave.testutil.TesseraTestHarness; -import org.hyperledger.enclave.testutil.TesseraTestHarnessFactory; - -import java.net.URI; -import java.net.URISyntaxException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.List; -import java.util.Optional; -import java.util.concurrent.TimeUnit; - -import com.google.common.collect.Lists; -import io.vertx.core.Vertx; -import org.awaitility.Awaitility; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.io.TempDir; - -public class EnclaveTest { - - @TempDir private static Path folder; - - private static final String PAYLOAD = "a wonderful transaction"; - private static final String MOCK_KEY = "iOCzoGo5kwtZU0J41Z9xnGXHN6ZNukIa9MspvHtu3Jk="; - private Enclave enclave; - private Vertx vertx; - private EnclaveFactory factory; - - private TesseraTestHarness testHarness; - - @BeforeEach - public void setUp() throws Exception { - vertx = Vertx.vertx(); - factory = new EnclaveFactory(vertx); - - testHarness = - TesseraTestHarnessFactory.create( - "enclave", - Files.createTempDirectory(folder, "enclave"), - new EnclaveKeyConfiguration( - new String[] {"enclave_key_0.pub"}, - new String[] {"enclave_key_0.key"}, - EnclaveEncryptorType.NOOP), - Optional.empty()); - - testHarness.start(); - - enclave = factory.createVertxEnclave(testHarness.clientUrl()); - } - - @AfterEach - public void tearDown() { - testHarness.close(); - vertx.close(); - } - - @Test - public void testUpCheck() { - assertThat(enclave.upCheck()).isTrue(); - } - - @Test - public void testReceiveThrowsWhenPayloadDoesNotExist() { - final String publicKey = testHarness.getDefaultPublicKey(); - - final Throwable t = catchThrowable(() -> enclave.receive(MOCK_KEY, publicKey)); - - assertThat(t.getMessage()).isEqualTo("Message with hash was not found"); - } - - @Test - public void testSendAndReceive() { - final List publicKeys = testHarness.getPublicKeys(); - - final SendResponse sr = - enclave.send(PAYLOAD, publicKeys.get(0), Lists.newArrayList(publicKeys.get(0))); - - final ReceiveResponse rr = enclave.receive(sr.getKey(), publicKeys.get(0)); - assertThat(rr).isNotNull(); - assertThat(new String(rr.getPayload(), UTF_8)).isEqualTo(PAYLOAD); - assertThat(rr.getPrivacyGroupId()).isNotNull(); - } - - @Test - public void testSendWithPrivacyGroupAndReceive() { - final List publicKeys = testHarness.getPublicKeys(); - - final PrivacyGroup privacyGroupResponse = - enclave.createPrivacyGroup(publicKeys, publicKeys.get(0), "", ""); - - final SendResponse sr = - enclave.send(PAYLOAD, publicKeys.get(0), privacyGroupResponse.getPrivacyGroupId()); - - final ReceiveResponse rr = enclave.receive(sr.getKey(), publicKeys.get(0)); - assertThat(rr).isNotNull(); - assertThat(new String(rr.getPayload(), UTF_8)).isEqualTo(PAYLOAD); - assertThat(rr.getPrivacyGroupId()).isNotNull(); - } - - @Test - public void testCreateAndDeletePrivacyGroup() { - final List publicKeys = testHarness.getPublicKeys(); - final String name = "testName"; - final String description = "testDesc"; - - final PrivacyGroup privacyGroupResponse = - enclave.createPrivacyGroup(publicKeys, publicKeys.get(0), name, description); - - assertThat(privacyGroupResponse.getPrivacyGroupId()).isNotNull(); - assertThat(privacyGroupResponse.getName()).isEqualTo(name); - assertThat(privacyGroupResponse.getDescription()).isEqualTo(description); - assertThat(privacyGroupResponse.getType()).isEqualByComparingTo(PrivacyGroup.Type.PANTHEON); - - final String response = - enclave.deletePrivacyGroup(privacyGroupResponse.getPrivacyGroupId(), publicKeys.get(0)); - - assertThat(privacyGroupResponse.getPrivacyGroupId()).isEqualTo(response); - } - - @Test - public void testCreateFindDeleteFindPrivacyGroup() { - final List publicKeys = testHarness.getPublicKeys(); - final String name = "name"; - final String description = "desc"; - - final PrivacyGroup privacyGroupResponse = - enclave.createPrivacyGroup(publicKeys, publicKeys.get(0), name, description); - - assertThat(privacyGroupResponse.getPrivacyGroupId()).isNotNull(); - assertThat(privacyGroupResponse.getName()).isEqualTo(name); - assertThat(privacyGroupResponse.getDescription()).isEqualTo(description); - assertThat(privacyGroupResponse.getType()).isEqualTo(PrivacyGroup.Type.PANTHEON); - - Awaitility.await() - .atMost(5, TimeUnit.SECONDS) - .untilAsserted( - () -> { - final PrivacyGroup[] findPrivacyGroupResponse = enclave.findPrivacyGroup(publicKeys); - - assertThat(findPrivacyGroupResponse.length).isEqualTo(1); - assertThat(findPrivacyGroupResponse[0].getPrivacyGroupId()) - .isEqualTo(privacyGroupResponse.getPrivacyGroupId()); - }); - - final String response = - enclave.deletePrivacyGroup(privacyGroupResponse.getPrivacyGroupId(), publicKeys.get(0)); - - assertThat(privacyGroupResponse.getPrivacyGroupId()).isEqualTo(response); - - Awaitility.await() - .atMost(5, TimeUnit.SECONDS) - .untilAsserted( - () -> { - final PrivacyGroup[] findPrivacyGroupResponse = enclave.findPrivacyGroup(publicKeys); - - assertThat(findPrivacyGroupResponse.length).isEqualTo(0); - }); - } - - @Test - public void testCreateDeleteRetrievePrivacyGroup() { - final List publicKeys = testHarness.getPublicKeys(); - final String name = "name"; - final String description = "desc"; - - final PrivacyGroup privacyGroupResponse = - enclave.createPrivacyGroup(publicKeys, publicKeys.get(0), name, description); - - assertThat(privacyGroupResponse.getPrivacyGroupId()).isNotNull(); - assertThat(privacyGroupResponse.getName()).isEqualTo(name); - assertThat(privacyGroupResponse.getDescription()).isEqualTo(description); - assertThat(privacyGroupResponse.getType()).isEqualTo(PrivacyGroup.Type.PANTHEON); - - final PrivacyGroup retrievePrivacyGroup = - enclave.retrievePrivacyGroup(privacyGroupResponse.getPrivacyGroupId()); - - assertThat(retrievePrivacyGroup).usingRecursiveComparison().isEqualTo(privacyGroupResponse); - - final String response = - enclave.deletePrivacyGroup(privacyGroupResponse.getPrivacyGroupId(), publicKeys.get(0)); - - assertThat(privacyGroupResponse.getPrivacyGroupId()).isEqualTo(response); - } - - @Test - public void upcheckReturnsFalseIfNoResponseReceived() throws URISyntaxException { - assertThat(factory.createVertxEnclave(new URI("http://8.8.8.8:65535")).upCheck()).isFalse(); - } -} diff --git a/enclave/src/integration-test/java/org/hyperledger/besu/enclave/TlsCertificateDefinition.java b/enclave/src/integration-test/java/org/hyperledger/besu/enclave/TlsCertificateDefinition.java deleted file mode 100644 index ad1271e9200..00000000000 --- a/enclave/src/integration-test/java/org/hyperledger/besu/enclave/TlsCertificateDefinition.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.enclave; - -import java.io.File; -import java.net.URL; -import java.nio.file.Path; - -import com.google.common.io.Resources; - -public class TlsCertificateDefinition { - - private final File pkcs12File; - private final String password; - - public static TlsCertificateDefinition loadFromResource( - final String resourcePath, final String password) { - try { - final URL sslCertificate = Resources.getResource(resourcePath); - final Path keystorePath = Path.of(sslCertificate.getPath()); - - return new TlsCertificateDefinition(keystorePath.toFile(), password); - } catch (final Exception e) { - throw new RuntimeException("Failed to load TLS certificates", e); - } - } - - public TlsCertificateDefinition(final File pkcs12File, final String password) { - this.pkcs12File = pkcs12File; - this.password = password; - } - - public File getPkcs12File() { - return pkcs12File; - } - - public String getPassword() { - return password; - } -} diff --git a/enclave/src/integration-test/java/org/hyperledger/besu/enclave/TlsEnabledEnclaveTest.java b/enclave/src/integration-test/java/org/hyperledger/besu/enclave/TlsEnabledEnclaveTest.java deleted file mode 100644 index b5947793060..00000000000 --- a/enclave/src/integration-test/java/org/hyperledger/besu/enclave/TlsEnabledEnclaveTest.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.enclave; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.fail; -import static org.hyperledger.besu.enclave.TlsHelpers.populateFingerprintFile; - -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; -import java.nio.charset.Charset; -import java.nio.file.Files; -import java.nio.file.Path; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.security.cert.CertificateException; -import java.util.Optional; - -import io.vertx.core.Vertx; -import io.vertx.core.http.HttpServer; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -public class TlsEnabledEnclaveTest { - - private TlsEnabledHttpServerFactory serverFactory; - private Vertx vertx; - - final TlsCertificateDefinition httpServerCert = - TlsCertificateDefinition.loadFromResource("tls/cert1.pfx", "password"); - final TlsCertificateDefinition besuCert = - TlsCertificateDefinition.loadFromResource("tls/cert2.pfx", "password2"); - - public void shutdown() { - vertx.close(); - } - - @BeforeEach - public void setup() { - serverFactory = new TlsEnabledHttpServerFactory(); - this.vertx = Vertx.vertx(); - } - - @AfterEach - public void cleanup() { - serverFactory.shutdown(); - this.shutdown(); - } - - private Enclave createEnclave( - final int httpServerPort, final Path workDir, final boolean tlsEnabled) throws IOException { - - final Path serverFingerprintFile = workDir.resolve("server_known_clients"); - final Path besuCertPasswordFile = workDir.resolve("password_file"); - try { - populateFingerprintFile(serverFingerprintFile, httpServerCert, Optional.of(httpServerPort)); - Files.write(besuCertPasswordFile, besuCert.getPassword().getBytes(Charset.defaultCharset())); - - final EnclaveFactory factory = new EnclaveFactory(vertx); - if (tlsEnabled) { - final URI httpServerUri = new URI("https://localhost:" + httpServerPort); - return factory.createVertxEnclave( - httpServerUri, - besuCert.getPkcs12File().toPath(), - besuCertPasswordFile, - serverFingerprintFile); - } else { - return factory.createVertxEnclave(new URI("http://localhost:" + httpServerPort)); - } - } catch (KeyStoreException | NoSuchAlgorithmException | CertificateException e) { - fail("unable to populate fingerprint file"); - return null; - } catch (URISyntaxException e) { - fail("unable to create URI"); - return null; - } - } - - @Test - public void nonTlsEnclaveCannotConnectToTlsServer() throws IOException { - - Path workDir = Files.createTempDirectory("test-certs"); - - // Note: the HttpServer always responds with a JsonRpcSuccess, result="I'm up". - final HttpServer httpServer = serverFactory.create(httpServerCert, besuCert, workDir, true); - - final Enclave enclave = createEnclave(httpServer.actualPort(), workDir, false); - - assertThat(enclave.upCheck()).isEqualTo(false); - } - - @Test - public void nonTlsEnclaveCanConnectToNonTlsServer() throws IOException { - - Path workDir = Files.createTempDirectory("test-certs"); - - // Note: the HttpServer always responds with a JsonRpcSuccess, result="I'm up". - final HttpServer httpServer = serverFactory.create(httpServerCert, besuCert, workDir, false); - - final Enclave enclave = createEnclave(httpServer.actualPort(), workDir, false); - - assertThat(enclave.upCheck()).isEqualTo(true); - } - - @Test - public void tlsEnclaveCannotConnectToNonTlsServer() throws IOException { - - Path workDir = Files.createTempDirectory("test-certs"); - - // Note: the HttpServer always responds with a JsonRpcSuccess, result="I'm up!". - final HttpServer httpServer = serverFactory.create(httpServerCert, besuCert, workDir, false); - - final Enclave enclave = createEnclave(httpServer.actualPort(), workDir, true); - - assertThat(enclave.upCheck()).isEqualTo(false); - } - - @Test - public void tlsEnclaveCanConnectToTlsServer() throws IOException { - - Path workDir = Files.createTempDirectory("test-certs"); - - // Note: the HttpServer always responds with a JsonRpcSuccess, result="I'm up". - final HttpServer httpServer = serverFactory.create(httpServerCert, besuCert, workDir, true); - - final Enclave enclave = createEnclave(httpServer.actualPort(), workDir, true); - - assertThat(enclave.upCheck()).isEqualTo(true); - } -} diff --git a/enclave/src/integration-test/java/org/hyperledger/besu/enclave/TlsEnabledHttpServerFactory.java b/enclave/src/integration-test/java/org/hyperledger/besu/enclave/TlsEnabledHttpServerFactory.java deleted file mode 100644 index 7c67aeb7b9e..00000000000 --- a/enclave/src/integration-test/java/org/hyperledger/besu/enclave/TlsEnabledHttpServerFactory.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.enclave; - -import static org.hyperledger.besu.enclave.TlsHelpers.populateFingerprintFile; - -import java.io.IOException; -import java.nio.file.Path; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.security.cert.CertificateException; -import java.util.List; -import java.util.Optional; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutionException; - -import com.google.common.collect.Lists; -import io.netty.handler.codec.http.HttpHeaderValues; -import io.vertx.core.Vertx; -import io.vertx.core.http.ClientAuth; -import io.vertx.core.http.HttpMethod; -import io.vertx.core.http.HttpServer; -import io.vertx.core.http.HttpServerOptions; -import io.vertx.core.http.HttpServerResponse; -import io.vertx.core.net.PfxOptions; -import io.vertx.ext.web.Router; -import io.vertx.ext.web.RoutingContext; -import org.apache.tuweni.net.tls.VertxTrustOptions; - -class TlsEnabledHttpServerFactory { - - private final Vertx vertx; - private final List serversCreated = Lists.newArrayList(); - - TlsEnabledHttpServerFactory() { - this.vertx = Vertx.vertx(); - } - - void shutdown() { - serversCreated.forEach(HttpServer::close); - vertx.close(); - } - - HttpServer create( - final TlsCertificateDefinition serverCert, - final TlsCertificateDefinition acceptedClientCerts, - final Path workDir, - final boolean tlsEnabled) { - try { - - final Path serverFingerprintFile = workDir.resolve("server_known_clients"); - populateFingerprintFile(serverFingerprintFile, acceptedClientCerts, Optional.empty()); - - final HttpServerOptions web3HttpServerOptions = new HttpServerOptions(); - web3HttpServerOptions.setPort(0); - if (tlsEnabled) { - web3HttpServerOptions.setSsl(true); - web3HttpServerOptions.setClientAuth(ClientAuth.REQUIRED); - web3HttpServerOptions.setTrustOptions( - VertxTrustOptions.allowlistClients(serverFingerprintFile)); - web3HttpServerOptions.setPfxKeyCertOptions( - new PfxOptions() - .setPath(serverCert.getPkcs12File().toString()) - .setPassword(serverCert.getPassword())); - } - final Router router = Router.router(vertx); - router - .route(HttpMethod.GET, "/upcheck") - .produces(HttpHeaderValues.APPLICATION_JSON.toString()) - .handler(TlsEnabledHttpServerFactory::handleRequest); - - final HttpServer mockOrionHttpServer = vertx.createHttpServer(web3HttpServerOptions); - - final CompletableFuture serverConfigured = new CompletableFuture<>(); - mockOrionHttpServer.requestHandler(router).listen(result -> serverConfigured.complete(true)); - - serverConfigured.get(); - - serversCreated.add(mockOrionHttpServer); - return mockOrionHttpServer; - } catch (final KeyStoreException - | NoSuchAlgorithmException - | CertificateException - | IOException - | ExecutionException - | InterruptedException e) { - throw new RuntimeException("Failed to construct a TLS Enabled Server", e); - } - } - - private static void handleRequest(final RoutingContext context) { - final HttpServerResponse response = context.response(); - if (!response.closed()) { - response.end("I'm up!"); - } - } -} diff --git a/enclave/src/integration-test/java/org/hyperledger/besu/enclave/TlsHelpers.java b/enclave/src/integration-test/java/org/hyperledger/besu/enclave/TlsHelpers.java deleted file mode 100644 index 09002f81151..00000000000 --- a/enclave/src/integration-test/java/org/hyperledger/besu/enclave/TlsHelpers.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.enclave; - -import org.hyperledger.besu.crypto.MessageDigestFactory; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.nio.file.Files; -import java.nio.file.Path; -import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.security.cert.CertificateEncodingException; -import java.security.cert.CertificateException; -import java.security.cert.X509Certificate; -import java.util.Enumeration; -import java.util.List; -import java.util.Locale; -import java.util.Optional; -import java.util.StringJoiner; - -import com.google.common.collect.Lists; - -public class TlsHelpers { - - private TlsHelpers() {} - - private static KeyStore loadP12KeyStore(final File pkcsFile, final String password) - throws KeyStoreException, NoSuchAlgorithmException, CertificateException { - final KeyStore store = KeyStore.getInstance("pkcs12"); - try (final InputStream keystoreStream = new FileInputStream(pkcsFile)) { - store.load(keystoreStream, password.toCharArray()); - } catch (IOException e) { - throw new RuntimeException("Unable to load keystore.", e); - } - return store; - } - - public static void populateFingerprintFile( - final Path knownClientsPath, - final TlsCertificateDefinition certDef, - final Optional serverPortToAppendToHostname) - throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException { - - final List certs = getCertsFromPkcs12(certDef); - final StringBuilder fingerprintsToAdd = new StringBuilder(); - final String portFragment = serverPortToAppendToHostname.map(port -> ":" + port).orElse(""); - for (final X509Certificate cert : certs) { - final String fingerprint = generateFingerprint(cert); - fingerprintsToAdd.append(String.format("localhost%s %s%n", portFragment, fingerprint)); - fingerprintsToAdd.append(String.format("127.0.0.1%s %s%n", portFragment, fingerprint)); - } - Files.writeString(knownClientsPath, fingerprintsToAdd.toString()); - } - - @SuppressWarnings("JdkObsolete") // java.util.Enumeration is baked into the Keystore API - public static List getCertsFromPkcs12(final TlsCertificateDefinition certDef) - throws KeyStoreException, NoSuchAlgorithmException, CertificateException { - final List results = Lists.newArrayList(); - - final KeyStore p12 = loadP12KeyStore(certDef.getPkcs12File(), certDef.getPassword()); - final Enumeration aliases = p12.aliases(); - while (aliases.hasMoreElements()) { - results.add((X509Certificate) p12.getCertificate(aliases.nextElement())); - } - return results; - } - - private static String generateFingerprint(final X509Certificate cert) - throws NoSuchAlgorithmException, CertificateEncodingException { - final MessageDigest md = MessageDigestFactory.create(MessageDigestFactory.SHA256_ALG); - md.update(cert.getEncoded()); - final byte[] digest = md.digest(); - - final StringJoiner joiner = new StringJoiner(":"); - for (final byte b : digest) { - joiner.add(String.format("%02X", b)); - } - - return joiner.toString().toLowerCase(Locale.ROOT); - } -} diff --git a/ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/fork/frontier/PrivGetPrivateTransactionIntegrationTest.java b/ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/fork/frontier/PrivGetPrivateTransactionIntegrationTest.java deleted file mode 100644 index 9bb10629f31..00000000000 --- a/ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/fork/frontier/PrivGetPrivateTransactionIntegrationTest.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.ethereum.api.jsonrpc.methods.fork.frontier; - -import static java.nio.charset.StandardCharsets.UTF_8; -import static org.assertj.core.api.Assertions.assertThat; -import static org.hyperledger.besu.ethereum.core.PrivateTransactionDataFixture.privateMarkerTransaction; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; - -import org.hyperledger.besu.crypto.KeyPair; -import org.hyperledger.besu.crypto.SignatureAlgorithm; -import org.hyperledger.besu.crypto.SignatureAlgorithmFactory; -import org.hyperledger.besu.datatypes.Address; -import org.hyperledger.besu.datatypes.Hash; -import org.hyperledger.besu.datatypes.Wei; -import org.hyperledger.besu.enclave.Enclave; -import org.hyperledger.besu.enclave.EnclaveFactory; -import org.hyperledger.besu.enclave.types.SendResponse; -import org.hyperledger.besu.ethereum.api.jsonrpc.internal.JsonRpcRequest; -import org.hyperledger.besu.ethereum.api.jsonrpc.internal.JsonRpcRequestContext; -import org.hyperledger.besu.ethereum.api.jsonrpc.internal.privacy.methods.PrivacyIdProvider; -import org.hyperledger.besu.ethereum.api.jsonrpc.internal.privacy.methods.priv.PrivGetPrivateTransaction; -import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse; -import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.privacy.PrivateTransactionLegacyResult; -import org.hyperledger.besu.ethereum.chain.Blockchain; -import org.hyperledger.besu.ethereum.chain.TransactionLocation; -import org.hyperledger.besu.ethereum.core.BlockHeader; -import org.hyperledger.besu.ethereum.core.Transaction; -import org.hyperledger.besu.ethereum.privacy.PrivacyController; -import org.hyperledger.besu.ethereum.privacy.PrivateTransaction; -import org.hyperledger.besu.ethereum.privacy.RestrictedDefaultPrivacyController; -import org.hyperledger.besu.ethereum.privacy.storage.PrivateStateStorage; -import org.hyperledger.besu.ethereum.rlp.BytesValueRLPOutput; -import org.hyperledger.besu.plugin.data.Restriction; -import org.hyperledger.enclave.testutil.EnclaveEncryptorType; -import org.hyperledger.enclave.testutil.EnclaveKeyConfiguration; -import org.hyperledger.enclave.testutil.TesseraTestHarness; -import org.hyperledger.enclave.testutil.TesseraTestHarnessFactory; - -import java.math.BigInteger; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.Base64; -import java.util.Optional; - -import com.google.common.collect.Lists; -import io.vertx.core.Vertx; -import org.apache.tuweni.bytes.Bytes; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.io.TempDir; - -public class PrivGetPrivateTransactionIntegrationTest { - - @TempDir private static Path folder; - private static final String ENCLAVE_PUBLIC_KEY = "A1aVtMxLCUHmBVHXoZzzBgPbW/wj5axDpW9X8l91SGo="; - - private final PrivacyIdProvider privacyIdProvider = (user) -> ENCLAVE_PUBLIC_KEY; - private final PrivateStateStorage privateStateStorage = mock(PrivateStateStorage.class); - private final Blockchain blockchain = mock(Blockchain.class); - - private final Address sender = - Address.fromHexString("0x0000000000000000000000000000000000000003"); - - private final SignatureAlgorithm signatureAlgorithm = SignatureAlgorithmFactory.getInstance(); - - private final KeyPair KEY_PAIR = - signatureAlgorithm.createKeyPair( - signatureAlgorithm.createPrivateKey( - new BigInteger( - "8f2a55949038a9610f50fb23b5883af3b4ecb3c3bb792cbcefbd1542c692be63", 16))); - - private final PrivateTransaction privateTransaction = - PrivateTransaction.builder() - .nonce(0) - .gasPrice(Wei.of(1000)) - .gasLimit(3000000) - .to(null) - .value(Wei.ZERO) - .payload( - Bytes.fromHexString( - "0x608060405234801561001057600080fd5b5060d08061001f60003960" - + "00f3fe60806040526004361060485763ffffffff7c01000000" - + "00000000000000000000000000000000000000000000000000" - + "60003504166360fe47b18114604d5780636d4ce63c14607557" - + "5b600080fd5b348015605857600080fd5b5060736004803603" - + "6020811015606d57600080fd5b50356099565b005b34801560" - + "8057600080fd5b506087609e565b6040805191825251908190" - + "0360200190f35b600055565b6000549056fea165627a7a7230" - + "5820cb1d0935d14b589300b12fcd0ab849a7e9019c81da24d6" - + "daa4f6b2f003d1b0180029")) - .sender(sender) - .chainId(BigInteger.valueOf(2018)) - .privateFrom(Bytes.wrap(ENCLAVE_PUBLIC_KEY.getBytes(UTF_8))) - .privateFor( - Lists.newArrayList( - Bytes.wrap("A1aVtMxLCUHmBVHXoZzzBgPbW/wj5axDpW9X8l91SGo=".getBytes(UTF_8)))) - .restriction(Restriction.RESTRICTED) - .signAndBuild(KEY_PAIR); - - private Vertx vertx = Vertx.vertx(); - private TesseraTestHarness testHarness; - private Enclave enclave; - private PrivacyController privacyController; - - @BeforeEach - public void setUp() throws Exception { - vertx = Vertx.vertx(); - - testHarness = - TesseraTestHarnessFactory.create( - "enclave", - Files.createTempDirectory(folder, "enclave"), - new EnclaveKeyConfiguration( - new String[] {"enclave_key_0.pub"}, - new String[] {"enclave_key_0.key"}, - EnclaveEncryptorType.NOOP), - Optional.empty()); - - testHarness.start(); - - final EnclaveFactory factory = new EnclaveFactory(vertx); - enclave = factory.createVertxEnclave(testHarness.clientUrl()); - - privacyController = - new RestrictedDefaultPrivacyController( - blockchain, privateStateStorage, enclave, null, null, null, null, null); - } - - @AfterEach - public void tearDown() { - testHarness.close(); - vertx.close(); - } - - @Test - public void returnsStoredPrivateTransaction() { - final PrivGetPrivateTransaction privGetPrivateTransaction = - new PrivGetPrivateTransaction(privacyController, privacyIdProvider); - - final Hash blockHash = Hash.ZERO; - final Transaction pmt = spy(privateMarkerTransaction()); - when(blockchain.getTransactionByHash(eq(pmt.getHash()))).thenReturn(Optional.of(pmt)); - when(blockchain.getTransactionLocation(eq(pmt.getHash()))) - .thenReturn(Optional.of(new TransactionLocation(blockHash, 0))); - - final BlockHeader blockHeader = mock(BlockHeader.class); - when(blockHeader.getHash()).thenReturn(blockHash); - when(blockchain.getBlockHeader(eq(blockHash))).thenReturn(Optional.of(blockHeader)); - - final BytesValueRLPOutput bvrlp = new BytesValueRLPOutput(); - privateTransaction.writeTo(bvrlp); - - final String payload = Base64.getEncoder().encodeToString(bvrlp.encoded().toArrayUnsafe()); - final ArrayList to = Lists.newArrayList("A1aVtMxLCUHmBVHXoZzzBgPbW/wj5axDpW9X8l91SGo="); - final SendResponse sendResponse = enclave.send(payload, ENCLAVE_PUBLIC_KEY, to); - - final Bytes hexKey = Bytes.fromBase64String(sendResponse.getKey()); - when(pmt.getPayload()).thenReturn(hexKey); - - final Object[] params = new Object[] {pmt.getHash()}; - - final JsonRpcRequestContext request = - new JsonRpcRequestContext(new JsonRpcRequest("1", "priv_getPrivateTransaction", params)); - - final JsonRpcSuccessResponse response = - (JsonRpcSuccessResponse) privGetPrivateTransaction.response(request); - final PrivateTransactionLegacyResult result = - (PrivateTransactionLegacyResult) response.getResult(); - - assertThat(new PrivateTransactionLegacyResult(this.privateTransaction)) - .usingRecursiveComparison() - .isEqualTo(result); - } -} diff --git a/ethereum/core/src/integration-test/java/org/hyperledger/besu/ethereum/mainnet/precompiles/privacy/PrivacyPrecompiledContractIntegrationTest.java b/ethereum/core/src/integration-test/java/org/hyperledger/besu/ethereum/mainnet/precompiles/privacy/PrivacyPrecompiledContractIntegrationTest.java deleted file mode 100644 index a5ee5f068ee..00000000000 --- a/ethereum/core/src/integration-test/java/org/hyperledger/besu/ethereum/mainnet/precompiles/privacy/PrivacyPrecompiledContractIntegrationTest.java +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.hyperledger.besu.ethereum.mainnet.precompiles.privacy; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.catchThrowable; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyBoolean; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.ArgumentMatchers.nullable; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import org.hyperledger.besu.datatypes.Address; -import org.hyperledger.besu.datatypes.Hash; -import org.hyperledger.besu.enclave.Enclave; -import org.hyperledger.besu.enclave.EnclaveFactory; -import org.hyperledger.besu.enclave.types.SendResponse; -import org.hyperledger.besu.ethereum.core.Block; -import org.hyperledger.besu.ethereum.core.BlockDataGenerator; -import org.hyperledger.besu.ethereum.core.MutableWorldState; -import org.hyperledger.besu.ethereum.core.PrivateTransactionDataFixture; -import org.hyperledger.besu.ethereum.core.ProcessableBlockHeader; -import org.hyperledger.besu.ethereum.mainnet.PrivateStateUtils; -import org.hyperledger.besu.ethereum.privacy.PrivateStateGenesisAllocator; -import org.hyperledger.besu.ethereum.privacy.PrivateStateRootResolver; -import org.hyperledger.besu.ethereum.privacy.PrivateTransaction; -import org.hyperledger.besu.ethereum.privacy.PrivateTransactionProcessor; -import org.hyperledger.besu.ethereum.privacy.storage.PrivacyGroupHeadBlockMap; -import org.hyperledger.besu.ethereum.privacy.storage.PrivateMetadataUpdater; -import org.hyperledger.besu.ethereum.privacy.storage.PrivateStateStorage; -import org.hyperledger.besu.ethereum.processing.TransactionProcessingResult; -import org.hyperledger.besu.ethereum.rlp.BytesValueRLPOutput; -import org.hyperledger.besu.ethereum.worldstate.WorldStateArchive; -import org.hyperledger.besu.evm.frame.MessageFrame; -import org.hyperledger.besu.evm.gascalculator.SpuriousDragonGasCalculator; -import org.hyperledger.besu.evm.operation.BlockHashOperation.BlockHashLookup; -import org.hyperledger.besu.evm.precompile.PrecompiledContract; -import org.hyperledger.besu.evm.tracing.OperationTracer; -import org.hyperledger.besu.evm.worldstate.WorldUpdater; -import org.hyperledger.enclave.testutil.EnclaveEncryptorType; -import org.hyperledger.enclave.testutil.EnclaveKeyConfiguration; -import org.hyperledger.enclave.testutil.TesseraTestHarness; -import org.hyperledger.enclave.testutil.TesseraTestHarnessFactory; - -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.Collections; -import java.util.List; -import java.util.Optional; - -import com.google.common.collect.Lists; -import io.vertx.core.Vertx; -import org.apache.tuweni.bytes.Bytes; -import org.apache.tuweni.bytes.Bytes32; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.io.TempDir; - -public class PrivacyPrecompiledContractIntegrationTest { - - // this tempDir is deliberately static - @TempDir private static Path folder; - - private static final Bytes VALID_PRIVATE_TRANSACTION_RLP = - Bytes.fromHexString( - "0xf90113800182520894095e7baea6a6c7c4c2dfeb977efac326af552d87" - + "a0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" - + "ffff801ba048b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d" - + "495a36649353a01fffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab94" - + "9f53faa07bd2c804ac41316156744d784c4355486d425648586f5a7a7a4267" - + "5062572f776a3561784470573958386c393153476f3df85aac41316156744d" - + "784c4355486d425648586f5a7a7a42675062572f776a356178447057395838" - + "6c393153476f3dac4b6f32625671442b6e4e6c4e594c35454537793349644f" - + "6e766966746a69697a706a52742b4854754642733d8a726573747269637465" - + "64"); - private static final String DEFAULT_OUTPUT = "0x01"; - - private static Enclave enclave; - private static MessageFrame messageFrame; - - private static TesseraTestHarness testHarness; - private static WorldStateArchive worldStateArchive; - private static PrivateStateStorage privateStateStorage; - private static final Vertx vertx = Vertx.vertx(); - - private PrivateTransactionProcessor mockPrivateTxProcessor() { - final PrivateTransactionProcessor mockPrivateTransactionProcessor = - mock(PrivateTransactionProcessor.class); - final TransactionProcessingResult result = - TransactionProcessingResult.successful( - null, 0, 0, Bytes.fromHexString(DEFAULT_OUTPUT), null); - when(mockPrivateTransactionProcessor.processTransaction( - nullable(WorldUpdater.class), - nullable(WorldUpdater.class), - nullable(ProcessableBlockHeader.class), - nullable(Hash.class), - nullable(PrivateTransaction.class), - nullable(Address.class), - nullable(OperationTracer.class), - nullable(BlockHashLookup.class), - nullable(Bytes.class))) - .thenReturn(result); - - return mockPrivateTransactionProcessor; - } - - @BeforeAll - public static void setUpOnce() throws Exception { - - testHarness = - TesseraTestHarnessFactory.create( - "enclave", - Files.createTempDirectory(folder, "enclave"), - new EnclaveKeyConfiguration( - new String[] {"enclave_key_0.pub"}, - new String[] {"enclave_key_1.key"}, - EnclaveEncryptorType.NOOP), - Optional.empty()); - - testHarness.start(); - - final EnclaveFactory factory = new EnclaveFactory(vertx); - enclave = factory.createVertxEnclave(testHarness.clientUrl()); - messageFrame = mock(MessageFrame.class); - final BlockDataGenerator blockGenerator = new BlockDataGenerator(); - final Block genesis = blockGenerator.genesisBlock(); - final Block block = - blockGenerator.block( - new BlockDataGenerator.BlockOptions().setParentHash(genesis.getHeader().getHash())); - when(messageFrame.getBlockValues()).thenReturn(block.getHeader()); - final PrivateMetadataUpdater privateMetadataUpdater = mock(PrivateMetadataUpdater.class); - when(privateMetadataUpdater.getPrivateBlockMetadata(any())).thenReturn(null); - when(privateMetadataUpdater.getPrivacyGroupHeadBlockMap()) - .thenReturn(PrivacyGroupHeadBlockMap.empty()); - when(messageFrame.getContextVariable( - eq(PrivateStateUtils.KEY_IS_PERSISTING_PRIVATE_STATE), anyBoolean())) - .thenReturn(false); - when(messageFrame.getContextVariable(eq(PrivateStateUtils.KEY_PRIVATE_METADATA_UPDATER))) - .thenReturn(privateMetadataUpdater); - when(messageFrame.hasContextVariable(eq(PrivateStateUtils.KEY_PRIVATE_METADATA_UPDATER))) - .thenReturn(true); - - worldStateArchive = mock(WorldStateArchive.class); - final MutableWorldState mutableWorldState = mock(MutableWorldState.class); - when(mutableWorldState.updater()).thenReturn(mock(WorldUpdater.class)); - when(worldStateArchive.getMutable()).thenReturn(mutableWorldState); - when(worldStateArchive.getMutable(any(), any())).thenReturn(Optional.of(mutableWorldState)); - - privateStateStorage = mock(PrivateStateStorage.class); - final PrivateStateStorage.Updater storageUpdater = mock(PrivateStateStorage.Updater.class); - when(privateStateStorage.getPrivacyGroupHeadBlockMap(any())) - .thenReturn(Optional.of(PrivacyGroupHeadBlockMap.empty())); - when(storageUpdater.putPrivateBlockMetadata( - nullable(Bytes32.class), nullable(Bytes32.class), any())) - .thenReturn(storageUpdater); - when(storageUpdater.putTransactionReceipt( - nullable(Bytes32.class), nullable(Bytes32.class), any())) - .thenReturn(storageUpdater); - when(privateStateStorage.updater()).thenReturn(storageUpdater); - } - - @AfterAll - public static void tearDownOnce() { - testHarness.stop(); - vertx.close(); - } - - @Test - public void testUpCheck() { - assertThat(enclave.upCheck()).isTrue(); - } - - @Test - public void testSendAndReceive() { - final List publicKeys = testHarness.getPublicKeys(); - - final PrivateTransaction privateTransaction = - PrivateTransactionDataFixture.privateContractDeploymentTransactionBesu(publicKeys.get(0)); - final BytesValueRLPOutput bytesValueRLPOutput = new BytesValueRLPOutput(); - privateTransaction.writeTo(bytesValueRLPOutput); - - final String s = bytesValueRLPOutput.encoded().toBase64String(); - final SendResponse sr = - enclave.send(s, publicKeys.get(0), Lists.newArrayList(publicKeys.get(0))); - - final PrivacyPrecompiledContract privacyPrecompiledContract = - new PrivacyPrecompiledContract( - new SpuriousDragonGasCalculator(), - enclave, - worldStateArchive, - new PrivateStateRootResolver(privateStateStorage), - new PrivateStateGenesisAllocator( - false, (privacyGroupId, blockNumber) -> Collections::emptyList), - false, - "IntegrationTest"); - - privacyPrecompiledContract.setPrivateTransactionProcessor(mockPrivateTxProcessor()); - - final PrecompiledContract.PrecompileContractResult result = - privacyPrecompiledContract.computePrecompile( - Bytes.fromBase64String(sr.getKey()), messageFrame); - final Bytes actual = result.getOutput(); - - assertThat(actual).isEqualTo(Bytes.fromHexString(DEFAULT_OUTPUT)); - } - - @Test - public void testNoPrivateKeyError() throws RuntimeException { - final List publicKeys = testHarness.getPublicKeys(); - publicKeys.add("noPrivateKey"); - - final String s = VALID_PRIVATE_TRANSACTION_RLP.toBase64String(); - - final Throwable thrown = catchThrowable(() -> enclave.send(s, publicKeys.get(0), publicKeys)); - - assertThat(thrown).hasMessageContaining("Index 9 out of bounds for length 9"); - } - - @Test - public void testWrongPrivateKeyError() throws RuntimeException { - final List publicKeys = testHarness.getPublicKeys(); - publicKeys.add("noPrivateKenoPrivateKenoPrivateKenoPrivateK"); - - final String s = VALID_PRIVATE_TRANSACTION_RLP.toBase64String(); - - final Throwable thrown = catchThrowable(() -> enclave.send(s, publicKeys.get(0), publicKeys)); - - assertThat(thrown).hasMessageContaining("Recipient not found for key:"); - } -} diff --git a/testutil/src/main/resources/enclave_key_0.key b/testutil/src/main/resources/enclave_key_0.key deleted file mode 100644 index eaae9b0867c..00000000000 --- a/testutil/src/main/resources/enclave_key_0.key +++ /dev/null @@ -1 +0,0 @@ -{"data":{"bytes":"hBsuQsGJzx4QHmFmBkNoI7YGnTmaZP4P+wBOdu56ljk="},"type":"unlocked"} \ No newline at end of file From 874cba016db3ef3c64df9d2ccf0b2b4a32d5d0f8 Mon Sep 17 00:00:00 2001 From: Matt Whitehead Date: Mon, 23 Sep 2024 11:58:47 +0100 Subject: [PATCH 31/47] Update protobuf to 32.25.5 to resolve CVE-2024-7254 (#7664) Signed-off-by: Matthew Whitehead --- gradle/verification-metadata.xml | 36 ++++++++++++++++++++++++++++++++ gradle/versions.gradle | 2 ++ 2 files changed, 38 insertions(+) diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index 3778a2d60ad..7f6a58b66e7 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -1023,6 +1023,11 @@ + + + + + @@ -1033,6 +1038,11 @@ + + + + + @@ -1049,6 +1059,14 @@ + + + + + + + + @@ -1062,6 +1080,14 @@ + + + + + + + + @@ -1080,6 +1106,11 @@ + + + + + @@ -1090,6 +1121,11 @@ + + + + + diff --git a/gradle/versions.gradle b/gradle/versions.gradle index b7a286e69a3..634c29b1e13 100644 --- a/gradle/versions.gradle +++ b/gradle/versions.gradle @@ -25,6 +25,8 @@ dependencyManagement { dependency 'com.github.ben-manes.caffeine:caffeine:3.1.8' + dependency 'com.google.protobuf:protobuf-java:3.25.5' + dependency 'com.github.oshi:oshi-core:6.6.3' dependency 'com.google.auto.service:auto-service:1.1.1' From 0d6395515890280c29ee2402c03b1ee81bde3bab Mon Sep 17 00:00:00 2001 From: Rafael Matias Date: Mon, 23 Sep 2024 14:34:20 +0200 Subject: [PATCH 32/47] Docker: Only switch user if the current user is root (#7654) * Update entrypoint script for Dockerfile to only switch user if its running as root Signed-off-by: Rafael Matias * make root user check at the beginning Signed-off-by: Rafael Matias --------- Signed-off-by: Rafael Matias --- besu/src/main/scripts/besu-entry.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/besu/src/main/scripts/besu-entry.sh b/besu/src/main/scripts/besu-entry.sh index ed3687b2291..ee11bfbffc2 100755 --- a/besu/src/main/scripts/besu-entry.sh +++ b/besu/src/main/scripts/besu-entry.sh @@ -14,6 +14,14 @@ ## SPDX-License-Identifier: Apache-2.0 ## +# Construct the command as a single string +COMMAND="/opt/besu/bin/besu $@" + +# Check if current user is not root. If not, run the command as is. +if [ "$(id -u)" -ne 0 ]; then + exec /bin/bash -c "$COMMAND" +fi + # Run Besu first to get paths needing permission adjustment output=$(/opt/besu/bin/besu --print-paths-and-exit $BESU_USER_NAME "$@") @@ -41,9 +49,5 @@ echo "$output" | while IFS=: read -r prefix path accessType; do fi done -# Finally, run Besu with the actual arguments passed to the container -# Construct the command as a single string -COMMAND="/opt/besu/bin/besu $@" - # Switch to the besu user and execute the command -exec su -s /bin/bash $BESU_USER_NAME -c "$COMMAND" +exec su -s /bin/bash "$BESU_USER_NAME" -c "$COMMAND" From 4f07e76a6c26b294bcc8f50deefefc78438636dd Mon Sep 17 00:00:00 2001 From: Matilda-Clerke Date: Tue, 24 Sep 2024 13:04:03 +1000 Subject: [PATCH 33/47] 7311: Add feature toggle for enabling use of the peertask system where available (#7633) Signed-off-by: Matilda Clerke --- .../options/unstable/SynchronizerOptions.java | 18 +++++++++++++++++- besu/src/test/resources/everything_config.toml | 1 + .../eth/sync/SynchronizerConfiguration.java | 18 ++++++++++++++++-- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/besu/src/main/java/org/hyperledger/besu/cli/options/unstable/SynchronizerOptions.java b/besu/src/main/java/org/hyperledger/besu/cli/options/unstable/SynchronizerOptions.java index 95bbe0a2b1f..816d9df00a1 100644 --- a/besu/src/main/java/org/hyperledger/besu/cli/options/unstable/SynchronizerOptions.java +++ b/besu/src/main/java/org/hyperledger/besu/cli/options/unstable/SynchronizerOptions.java @@ -314,6 +314,13 @@ public void parseBlockPropagationRange(final String arg) { description = "Snap sync enabled for BFT chains (default: ${DEFAULT-VALUE})") private Boolean snapsyncBftEnabled = SnapSyncConfiguration.DEFAULT_SNAP_SYNC_BFT_ENABLED; + @CommandLine.Option( + names = {"--Xpeertask-system-enabled"}, + hidden = true, + description = + "Temporary feature toggle to enable using the new peertask system (default: ${DEFAULT-VALUE})") + private final Boolean isPeerTaskSystemEnabled = false; + private SynchronizerOptions() {} /** @@ -334,6 +341,15 @@ public boolean isSnapSyncBftEnabled() { return snapsyncBftEnabled; } + /** + * Flag to indicate whether the peer task system should be used where available + * + * @return true if the peer task system should be used where available + */ + public boolean isPeerTaskSystemEnabled() { + return isPeerTaskSystemEnabled; + } + /** * Create synchronizer options. * @@ -420,7 +436,7 @@ public SynchronizerConfiguration.Builder toDomainObject() { .isSnapSyncBftEnabled(snapsyncBftEnabled) .build()); builder.checkpointPostMergeEnabled(checkpointPostMergeSyncEnabled); - + builder.isPeerTaskSystemEnabled(isPeerTaskSystemEnabled); return builder; } diff --git a/besu/src/test/resources/everything_config.toml b/besu/src/test/resources/everything_config.toml index e3d7a3f28d3..d28152b47cd 100644 --- a/besu/src/test/resources/everything_config.toml +++ b/besu/src/test/resources/everything_config.toml @@ -226,6 +226,7 @@ Xsecp256k1-native-enabled=false Xaltbn128-native-enabled=false Xsnapsync-server-enabled=true Xbonsai-full-flat-db-enabled=true +Xpeertask-system-enabled=false # compatibility flags compatibility-eth64-forkid-enabled=false diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/SynchronizerConfiguration.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/SynchronizerConfiguration.java index d46da85dc48..d72f76c213c 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/SynchronizerConfiguration.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/SynchronizerConfiguration.java @@ -85,6 +85,7 @@ public class SynchronizerConfiguration { private final int maxTrailingPeers; private final long worldStateMinMillisBeforeStalling; private final long propagationManagerGetBlockTimeoutMillis; + private final boolean isPeerTaskSystemEnabled; private SynchronizerConfiguration( final int syncPivotDistance, @@ -108,7 +109,8 @@ private SynchronizerConfiguration( final int computationParallelism, final int maxTrailingPeers, final long propagationManagerGetBlockTimeoutMillis, - final boolean checkpointPostMergeEnabled) { + final boolean checkpointPostMergeEnabled, + final boolean isPeerTaskSystemEnabled) { this.syncPivotDistance = syncPivotDistance; this.fastSyncFullValidationRate = fastSyncFullValidationRate; this.syncMinimumPeerCount = syncMinimumPeerCount; @@ -131,6 +133,7 @@ private SynchronizerConfiguration( this.maxTrailingPeers = maxTrailingPeers; this.propagationManagerGetBlockTimeoutMillis = propagationManagerGetBlockTimeoutMillis; this.checkpointPostMergeEnabled = checkpointPostMergeEnabled; + this.isPeerTaskSystemEnabled = isPeerTaskSystemEnabled; } public static Builder builder() { @@ -256,6 +259,10 @@ public long getPropagationManagerGetBlockTimeoutMillis() { return propagationManagerGetBlockTimeoutMillis; } + public boolean isPeerTaskSystemEnabled() { + return isPeerTaskSystemEnabled; + } + public static class Builder { private SyncMode syncMode = SyncMode.FULL; private int syncMinimumPeerCount = DEFAULT_SYNC_MINIMUM_PEERS; @@ -280,6 +287,7 @@ public static class Builder { DEFAULT_WORLD_STATE_MAX_REQUESTS_WITHOUT_PROGRESS; private long worldStateMinMillisBeforeStalling = DEFAULT_WORLD_STATE_MIN_MILLIS_BEFORE_STALLING; private int worldStateTaskCacheSize = DEFAULT_WORLD_STATE_TASK_CACHE_SIZE; + private boolean isPeerTaskSystemEnabled = false; private long propagationManagerGetBlockTimeoutMillis = DEFAULT_PROPAGATION_MANAGER_GET_BLOCK_TIMEOUT_MILLIS; @@ -406,6 +414,11 @@ public Builder checkpointPostMergeEnabled(final boolean checkpointPostMergeEnabl return this; } + public Builder isPeerTaskSystemEnabled(final boolean isPeerTaskSystemEnabled) { + this.isPeerTaskSystemEnabled = isPeerTaskSystemEnabled; + return this; + } + public SynchronizerConfiguration build() { return new SynchronizerConfiguration( syncPivotDistance, @@ -429,7 +442,8 @@ public SynchronizerConfiguration build() { computationParallelism, maxTrailingPeers, propagationManagerGetBlockTimeoutMillis, - checkpointPostMergeEnabled); + checkpointPostMergeEnabled, + isPeerTaskSystemEnabled); } } } From 04ba15aa922659a1516589612c6057301804c4d5 Mon Sep 17 00:00:00 2001 From: Glory Agatevure Date: Tue, 24 Sep 2024 06:06:16 +0100 Subject: [PATCH 34/47] Add consolidationRequestContract in jsonGenesisConfig (#7647) * Include consolidationRequestContract in jsonGenesisConfigOptions Signed-off-by: gconnect * Update changelog and ran spotlessApply Signed-off-by: gconnect * Rename consolidationRequestPredeployAddress to consolidationRequestContractAddress Signed-off-by: gconnect * Create request contract addresses class Signed-off-by: gconnect * Update method calls Signed-off-by: gconnect * Refactor RequestContractAddresses class and update method calls and test Signed-off-by: gconnect --------- Signed-off-by: gconnect Co-authored-by: Gabriel-Trintinalia --- CHANGELOG.md | 2 + .../besu/config/GenesisConfigOptions.java | 7 +++ .../besu/config/JsonGenesisConfigOptions.java | 11 ++++ .../besu/config/StubGenesisConfigOptions.java | 5 ++ .../besu/config/GenesisConfigOptionsTest.java | 27 ++++++++ .../mainnet/MainnetProtocolSpecs.java | 16 ++--- .../ConsolidationRequestProcessor.java | 9 ++- .../requests/MainnetRequestsValidator.java | 21 ++++--- .../requests/RequestContractAddresses.java | 61 +++++++++++++++++++ .../mainnet/PragueRequestsValidatorTest.java | 11 +++- 10 files changed, 148 insertions(+), 22 deletions(-) create mode 100644 ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/requests/RequestContractAddresses.java diff --git a/CHANGELOG.md b/CHANGELOG.md index 96e1511eead..5ce29955d12 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # Changelog ## [Unreleased] +- Add configuration of Consolidation Request Contract Address via genesis configuration [#7647](https://github.com/hyperledger/besu/pull/7647) + ### Upcoming Breaking Changes - k8s (KUBERNETES) Nat method is now deprecated and will be removed in a future release diff --git a/config/src/main/java/org/hyperledger/besu/config/GenesisConfigOptions.java b/config/src/main/java/org/hyperledger/besu/config/GenesisConfigOptions.java index d6323ee9bfb..07ddd0d7eac 100644 --- a/config/src/main/java/org/hyperledger/besu/config/GenesisConfigOptions.java +++ b/config/src/main/java/org/hyperledger/besu/config/GenesisConfigOptions.java @@ -539,4 +539,11 @@ default boolean isConsensusMigration() { * @return the deposit address */ Optional

getDepositContractAddress(); + + /** + * The consolidation request contract address + * + * @return the consolidation request contract address + */ + Optional
getConsolidationRequestContractAddress(); } diff --git a/config/src/main/java/org/hyperledger/besu/config/JsonGenesisConfigOptions.java b/config/src/main/java/org/hyperledger/besu/config/JsonGenesisConfigOptions.java index 67114b29bf3..83b1f48fb48 100644 --- a/config/src/main/java/org/hyperledger/besu/config/JsonGenesisConfigOptions.java +++ b/config/src/main/java/org/hyperledger/besu/config/JsonGenesisConfigOptions.java @@ -52,6 +52,8 @@ public class JsonGenesisConfigOptions implements GenesisConfigOptions { private static final String WITHDRAWAL_REQUEST_CONTRACT_ADDRESS_KEY = "withdrawalrequestcontractaddress"; private static final String DEPOSIT_CONTRACT_ADDRESS_KEY = "depositcontractaddress"; + private static final String CONSOLIDATION_REQUEST_CONTRACT_ADDRESS_KEY = + "consolidationrequestcontractaddress"; private final ObjectNode configRoot; private final Map configOverrides = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); @@ -453,6 +455,13 @@ public Optional
getDepositContractAddress() { return inputAddress.map(Address::fromHexString); } + @Override + public Optional
getConsolidationRequestContractAddress() { + Optional inputAddress = + JsonUtil.getString(configRoot, CONSOLIDATION_REQUEST_CONTRACT_ADDRESS_KEY); + return inputAddress.map(Address::fromHexString); + } + @Override public Map asMap() { final ImmutableMap.Builder builder = ImmutableMap.builder(); @@ -504,6 +513,8 @@ public Map asMap() { getWithdrawalRequestContractAddress() .ifPresent(l -> builder.put("withdrawalRequestContractAddress", l)); getDepositContractAddress().ifPresent(l -> builder.put("depositContractAddress", l)); + getConsolidationRequestContractAddress() + .ifPresent(l -> builder.put("consolidationRequestContractAddress", l)); if (isClique()) { builder.put("clique", getCliqueConfigOptions().asMap()); diff --git a/config/src/main/java/org/hyperledger/besu/config/StubGenesisConfigOptions.java b/config/src/main/java/org/hyperledger/besu/config/StubGenesisConfigOptions.java index efe56a086d0..ee9584fd3a4 100644 --- a/config/src/main/java/org/hyperledger/besu/config/StubGenesisConfigOptions.java +++ b/config/src/main/java/org/hyperledger/besu/config/StubGenesisConfigOptions.java @@ -467,6 +467,11 @@ public Optional
getDepositContractAddress() { return Optional.empty(); } + @Override + public Optional
getConsolidationRequestContractAddress() { + return Optional.empty(); + } + /** * Homestead block stub genesis config options. * diff --git a/config/src/test/java/org/hyperledger/besu/config/GenesisConfigOptionsTest.java b/config/src/test/java/org/hyperledger/besu/config/GenesisConfigOptionsTest.java index 219ea4fcf8a..69494a9c9c4 100644 --- a/config/src/test/java/org/hyperledger/besu/config/GenesisConfigOptionsTest.java +++ b/config/src/test/java/org/hyperledger/besu/config/GenesisConfigOptionsTest.java @@ -382,6 +382,33 @@ void asMapIncludesDepositContractAddress() { .containsValue(Address.ZERO); } + @Test + void shouldGetConsolidationRequestContractAddress() { + final GenesisConfigOptions config = + fromConfigOptions( + singletonMap( + "consolidationRequestContractAddress", + "0x00000000219ab540356cbb839cbe05303d7705fa")); + assertThat(config.getConsolidationRequestContractAddress()) + .hasValue(Address.fromHexString("0x00000000219ab540356cbb839cbe05303d7705fa")); + } + + @Test + void shouldNotHaveConsolidationRequestContractAddressWhenEmpty() { + final GenesisConfigOptions config = fromConfigOptions(emptyMap()); + assertThat(config.getConsolidationRequestContractAddress()).isEmpty(); + } + + @Test + void asMapIncludesConsolidationRequestContractAddress() { + final GenesisConfigOptions config = + fromConfigOptions(Map.of("consolidationRequestContractAddress", "0x0")); + + assertThat(config.asMap()) + .containsOnlyKeys("consolidationRequestContractAddress") + .containsValue(Address.ZERO); + } + private GenesisConfigOptions fromConfigOptions(final Map configOptions) { final ObjectNode rootNode = JsonUtil.createEmptyObjectNode(); final ObjectNode options = JsonUtil.objectNodeFromMap(configOptions); diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSpecs.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSpecs.java index e6d7a88cbdf..b5b2f678d67 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSpecs.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSpecs.java @@ -14,10 +14,8 @@ */ package org.hyperledger.besu.ethereum.mainnet; -import static org.hyperledger.besu.ethereum.mainnet.requests.DepositRequestProcessor.DEFAULT_DEPOSIT_CONTRACT_ADDRESS; import static org.hyperledger.besu.ethereum.mainnet.requests.MainnetRequestsValidator.pragueRequestsProcessors; import static org.hyperledger.besu.ethereum.mainnet.requests.MainnetRequestsValidator.pragueRequestsValidator; -import static org.hyperledger.besu.ethereum.mainnet.requests.WithdrawalRequestProcessor.DEFAULT_WITHDRAWAL_REQUEST_CONTRACT_ADDRESS; import org.hyperledger.besu.config.GenesisConfigOptions; import org.hyperledger.besu.config.PowAlgorithm; @@ -41,6 +39,7 @@ import org.hyperledger.besu.ethereum.mainnet.feemarket.BaseFeeMarket; import org.hyperledger.besu.ethereum.mainnet.feemarket.FeeMarket; import org.hyperledger.besu.ethereum.mainnet.parallelization.MainnetParallelBlockProcessor; +import org.hyperledger.besu.ethereum.mainnet.requests.RequestContractAddresses; import org.hyperledger.besu.ethereum.privacy.PrivateTransactionProcessor; import org.hyperledger.besu.ethereum.privacy.PrivateTransactionValidator; import org.hyperledger.besu.ethereum.privacy.storage.PrivateMetadataUpdater; @@ -767,12 +766,8 @@ static ProtocolSpecBuilder pragueDefinition( final boolean isParallelTxProcessingEnabled, final MetricsSystem metricsSystem) { - final Address withdrawalRequestContractAddress = - genesisConfigOptions - .getWithdrawalRequestContractAddress() - .orElse(DEFAULT_WITHDRAWAL_REQUEST_CONTRACT_ADDRESS); - final Address depositContractAddress = - genesisConfigOptions.getDepositContractAddress().orElse(DEFAULT_DEPOSIT_CONTRACT_ADDRESS); + RequestContractAddresses requestContractAddresses = + RequestContractAddresses.fromGenesis(genesisConfigOptions); return cancunDefinition( chainId, @@ -794,10 +789,9 @@ static ProtocolSpecBuilder pragueDefinition( .precompileContractRegistryBuilder(MainnetPrecompiledContractRegistries::prague) // EIP-7002 Withdrawals / EIP-6610 Deposits / EIP-7685 Requests - .requestsValidator(pragueRequestsValidator(depositContractAddress)) + .requestsValidator(pragueRequestsValidator(requestContractAddresses)) // EIP-7002 Withdrawals / EIP-6610 Deposits / EIP-7685 Requests - .requestProcessorCoordinator( - pragueRequestsProcessors(withdrawalRequestContractAddress, depositContractAddress)) + .requestProcessorCoordinator(pragueRequestsProcessors(requestContractAddresses)) // change to accept EIP-7702 transactions .transactionValidatorFactoryBuilder( diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/requests/ConsolidationRequestProcessor.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/requests/ConsolidationRequestProcessor.java index 0a48d8278c9..641720670fb 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/requests/ConsolidationRequestProcessor.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/requests/ConsolidationRequestProcessor.java @@ -22,13 +22,18 @@ public class ConsolidationRequestProcessor extends AbstractSystemCallRequestProcessor { - public static final Address CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS = + public static final Address CONSOLIDATION_REQUEST_CONTRACT_ADDRESS = Address.fromHexString("0x00b42dbF2194e931E80326D950320f7d9Dbeac02"); private static final int ADDRESS_BYTES = 20; private static final int PUBLIC_KEY_BYTES = 48; private static final int CONSOLIDATION_REQUEST_BYTES_SIZE = ADDRESS_BYTES + PUBLIC_KEY_BYTES + PUBLIC_KEY_BYTES; + private final Address consolidationRequestContractAddress; + + public ConsolidationRequestProcessor(final Address consolidationRequestContractAddress) { + this.consolidationRequestContractAddress = consolidationRequestContractAddress; + } /** * Gets the call address for consolidation requests. @@ -37,7 +42,7 @@ public class ConsolidationRequestProcessor */ @Override protected Address getCallAddress() { - return CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS; + return consolidationRequestContractAddress; } /** diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/requests/MainnetRequestsValidator.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/requests/MainnetRequestsValidator.java index 6e61a0343c3..9c86d18f7ad 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/requests/MainnetRequestsValidator.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/requests/MainnetRequestsValidator.java @@ -14,27 +14,34 @@ */ package org.hyperledger.besu.ethereum.mainnet.requests; -import org.hyperledger.besu.datatypes.Address; import org.hyperledger.besu.datatypes.RequestType; public class MainnetRequestsValidator { public static RequestsValidatorCoordinator pragueRequestsValidator( - final Address depositContractAddress) { + final RequestContractAddresses requestContractAddresses) { return new RequestsValidatorCoordinator.Builder() .addValidator(RequestType.WITHDRAWAL, new WithdrawalRequestValidator()) .addValidator(RequestType.CONSOLIDATION, new ConsolidationRequestValidator()) - .addValidator(RequestType.DEPOSIT, new DepositRequestValidator(depositContractAddress)) + .addValidator( + RequestType.DEPOSIT, + new DepositRequestValidator(requestContractAddresses.getDepositContractAddress())) .build(); } public static RequestProcessorCoordinator pragueRequestsProcessors( - final Address withdrawalRequestContractAddress, final Address depositContractAddress) { + final RequestContractAddresses requestContractAddresses) { return new RequestProcessorCoordinator.Builder() .addProcessor( RequestType.WITHDRAWAL, - new WithdrawalRequestProcessor(withdrawalRequestContractAddress)) - .addProcessor(RequestType.CONSOLIDATION, new ConsolidationRequestProcessor()) - .addProcessor(RequestType.DEPOSIT, new DepositRequestProcessor(depositContractAddress)) + new WithdrawalRequestProcessor( + requestContractAddresses.getWithdrawalRequestContractAddress())) + .addProcessor( + RequestType.CONSOLIDATION, + new ConsolidationRequestProcessor( + requestContractAddresses.getConsolidationRequestContractAddress())) + .addProcessor( + RequestType.DEPOSIT, + new DepositRequestProcessor(requestContractAddresses.getDepositContractAddress())) .build(); } } diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/requests/RequestContractAddresses.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/requests/RequestContractAddresses.java new file mode 100644 index 00000000000..b75677dda79 --- /dev/null +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/requests/RequestContractAddresses.java @@ -0,0 +1,61 @@ +/* + * Copyright contributors to Hyperledger Besu. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ +package org.hyperledger.besu.ethereum.mainnet.requests; + +import static org.hyperledger.besu.ethereum.mainnet.requests.ConsolidationRequestProcessor.CONSOLIDATION_REQUEST_CONTRACT_ADDRESS; +import static org.hyperledger.besu.ethereum.mainnet.requests.DepositRequestProcessor.DEFAULT_DEPOSIT_CONTRACT_ADDRESS; +import static org.hyperledger.besu.ethereum.mainnet.requests.WithdrawalRequestProcessor.DEFAULT_WITHDRAWAL_REQUEST_CONTRACT_ADDRESS; + +import org.hyperledger.besu.config.GenesisConfigOptions; +import org.hyperledger.besu.datatypes.Address; + +public class RequestContractAddresses { + private final Address withdrawalRequestContractAddress; + private final Address depositContractAddress; + private final Address consolidationRequestContractAddress; + + public RequestContractAddresses( + final Address withdrawalRequestContractAddress, + final Address depositContractAddress, + final Address consolidationRequestContractAddress) { + this.withdrawalRequestContractAddress = withdrawalRequestContractAddress; + this.depositContractAddress = depositContractAddress; + this.consolidationRequestContractAddress = consolidationRequestContractAddress; + } + + public static RequestContractAddresses fromGenesis( + final GenesisConfigOptions genesisConfigOptions) { + return new RequestContractAddresses( + genesisConfigOptions + .getWithdrawalRequestContractAddress() + .orElse(DEFAULT_WITHDRAWAL_REQUEST_CONTRACT_ADDRESS), + genesisConfigOptions.getDepositContractAddress().orElse(DEFAULT_DEPOSIT_CONTRACT_ADDRESS), + genesisConfigOptions + .getConsolidationRequestContractAddress() + .orElse(CONSOLIDATION_REQUEST_CONTRACT_ADDRESS)); + } + + public Address getWithdrawalRequestContractAddress() { + return withdrawalRequestContractAddress; + } + + public Address getDepositContractAddress() { + return depositContractAddress; + } + + public Address getConsolidationRequestContractAddress() { + return consolidationRequestContractAddress; + } +} diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/PragueRequestsValidatorTest.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/PragueRequestsValidatorTest.java index 6c325b70a86..6158ba44c37 100644 --- a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/PragueRequestsValidatorTest.java +++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/PragueRequestsValidatorTest.java @@ -17,8 +17,10 @@ import static java.util.Collections.emptyList; import static org.assertj.core.api.Assertions.assertThat; import static org.hyperledger.besu.ethereum.mainnet.HeaderValidationMode.NONE; +import static org.hyperledger.besu.ethereum.mainnet.requests.ConsolidationRequestProcessor.CONSOLIDATION_REQUEST_CONTRACT_ADDRESS; import static org.hyperledger.besu.ethereum.mainnet.requests.DepositRequestProcessor.DEFAULT_DEPOSIT_CONTRACT_ADDRESS; import static org.hyperledger.besu.ethereum.mainnet.requests.MainnetRequestsValidator.pragueRequestsValidator; +import static org.hyperledger.besu.ethereum.mainnet.requests.WithdrawalRequestProcessor.DEFAULT_WITHDRAWAL_REQUEST_CONTRACT_ADDRESS; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.lenient; @@ -31,6 +33,7 @@ import org.hyperledger.besu.ethereum.core.BlockchainSetupUtil; import org.hyperledger.besu.ethereum.core.Request; import org.hyperledger.besu.ethereum.core.WithdrawalRequest; +import org.hyperledger.besu.ethereum.mainnet.requests.RequestContractAddresses; import org.hyperledger.besu.ethereum.mainnet.requests.RequestsValidatorCoordinator; import org.hyperledger.besu.evm.log.LogsBloomFilter; @@ -52,9 +55,13 @@ class PragueRequestsValidatorTest { @Mock private ProtocolSchedule protocolSchedule; @Mock private ProtocolSpec protocolSpec; @Mock private WithdrawalsValidator withdrawalsValidator; + private final RequestContractAddresses requestContractAddresses = + new RequestContractAddresses( + DEFAULT_WITHDRAWAL_REQUEST_CONTRACT_ADDRESS, + DEFAULT_DEPOSIT_CONTRACT_ADDRESS, + CONSOLIDATION_REQUEST_CONTRACT_ADDRESS); - RequestsValidatorCoordinator requestValidator = - pragueRequestsValidator(DEFAULT_DEPOSIT_CONTRACT_ADDRESS); + RequestsValidatorCoordinator requestValidator = pragueRequestsValidator(requestContractAddresses); @BeforeEach public void setUp() { From 2aa3848950c86bbe720531539bdb990ab1fcaa7b Mon Sep 17 00:00:00 2001 From: Fabio Di Fabio Date: Tue, 24 Sep 2024 11:49:17 +0200 Subject: [PATCH 35/47] Enable logging during unit tests (#7672) Signed-off-by: Fabio Di Fabio --- testutil/src/main/resources/{log4j2.xml => log4j2-test.xml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename testutil/src/main/resources/{log4j2.xml => log4j2-test.xml} (100%) diff --git a/testutil/src/main/resources/log4j2.xml b/testutil/src/main/resources/log4j2-test.xml similarity index 100% rename from testutil/src/main/resources/log4j2.xml rename to testutil/src/main/resources/log4j2-test.xml From e0518c6d94bf1ae4f0e3742a9e3e51aac7e15fb3 Mon Sep 17 00:00:00 2001 From: Gabriel-Trintinalia Date: Tue, 24 Sep 2024 20:50:19 +1000 Subject: [PATCH 36/47] Force besu to stop on plugin initialization errors (#7662) Signed-off-by: Gabriel-Trintinalia --- CHANGELOG.md | 1 + .../dsl/node/ThreadBesuNodeRunner.java | 3 +- .../acceptance/plugins/TestPicoCLIPlugin.java | 51 +++- .../services/BesuPluginContextImplTest.java | 266 +++++++++++++++--- .../org/hyperledger/besu/cli/BesuCommand.java | 6 +- .../besu/cli/DefaultCommandValues.java | 3 + .../stable/PluginsConfigurationOptions.java | 30 +- .../besu/services/BesuPluginContextImpl.java | 91 ++++-- .../besu/cli/PluginsOptionsTest.java | 51 +++- .../src/test/resources/everything_config.toml | 3 +- .../core/plugins/PluginConfiguration.java | 18 +- 11 files changed, 424 insertions(+), 99 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ce29955d12..bb867af945e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - k8s (KUBERNETES) Nat method is now deprecated and will be removed in a future release ### Breaking Changes +- Besu will now fail to start if any plugins encounter errors during initialization. To allow Besu to continue running despite plugin errors, use the `--plugin-continue-on-error` option. [#7662](https://github.com/hyperledger/besu/pull/7662) ### Additions and Improvements - Remove privacy test classes support [#7569](https://github.com/hyperledger/besu/pull/7569) diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ThreadBesuNodeRunner.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ThreadBesuNodeRunner.java index 5d78f1460c4..90de0b0e952 100644 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ThreadBesuNodeRunner.java +++ b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ThreadBesuNodeRunner.java @@ -503,8 +503,9 @@ public BesuPluginContextImpl providePluginContext( besuPluginContext.addService(PermissioningService.class, permissioningService); besuPluginContext.addService(PrivacyPluginService.class, new PrivacyPluginServiceImpl()); - besuPluginContext.registerPlugins( + besuPluginContext.initialize( new PluginConfiguration.Builder().pluginsDir(pluginsPath).build()); + besuPluginContext.registerPlugins(); commandLine.parseArgs(extraCLIOptions.toArray(new String[0])); // register built-in plugins diff --git a/acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/TestPicoCLIPlugin.java b/acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/TestPicoCLIPlugin.java index 0db5281537c..375fbd490ec 100644 --- a/acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/TestPicoCLIPlugin.java +++ b/acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/TestPicoCLIPlugin.java @@ -1,5 +1,5 @@ /* - * Copyright ConsenSys AG. + * Copyright contributors to Hyperledger Besu. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -32,16 +32,25 @@ public class TestPicoCLIPlugin implements BesuPlugin { private static final Logger LOG = LoggerFactory.getLogger(TestPicoCLIPlugin.class); + private static final String UNSET = "UNSET"; + private static final String FAIL_REGISTER = "FAILREGISTER"; + private static final String FAIL_BEFORE_EXTERNAL_SERVICES = "FAILBEFOREEXTERNALSERVICES"; + private static final String FAIL_START = "FAILSTART"; + private static final String FAIL_AFTER_EXTERNAL_SERVICE_POST_MAIN_LOOP = + "FAILAFTEREXTERNALSERVICEPOSTMAINLOOP"; + private static final String FAIL_STOP = "FAILSTOP"; + private static final String PLUGIN_LIFECYCLE_PREFIX = "pluginLifecycle."; + @Option( names = {"--Xplugin-test-option"}, hidden = true, - defaultValue = "UNSET") + defaultValue = UNSET) String testOption = System.getProperty("testPicoCLIPlugin.testOption"); @Option( names = {"--plugin-test-stable-option"}, hidden = true, - defaultValue = "UNSET") + defaultValue = UNSET) String stableOption = ""; private String state = "uninited"; @@ -52,7 +61,7 @@ public void register(final BesuContext context) { LOG.info("Registering. Test Option is '{}'", testOption); state = "registering"; - if ("FAILREGISTER".equals(testOption)) { + if (FAIL_REGISTER.equals(testOption)) { state = "failregister"; throw new RuntimeException("I was told to fail at registration"); } @@ -66,12 +75,26 @@ public void register(final BesuContext context) { state = "registered"; } + @Override + public void beforeExternalServices() { + LOG.info("Before external services. Test Option is '{}'", testOption); + state = "beforeExternalServices"; + + if (FAIL_BEFORE_EXTERNAL_SERVICES.equals(testOption)) { + state = "failbeforeExternalServices"; + throw new RuntimeException("I was told to fail before external services"); + } + + writeSignal("beforeExternalServices"); + state = "beforeExternalServicesFinished"; + } + @Override public void start() { LOG.info("Starting. Test Option is '{}'", testOption); state = "starting"; - if ("FAILSTART".equals(testOption)) { + if (FAIL_START.equals(testOption)) { state = "failstart"; throw new RuntimeException("I was told to fail at startup"); } @@ -80,12 +103,26 @@ public void start() { state = "started"; } + @Override + public void afterExternalServicePostMainLoop() { + LOG.info("After external services post main loop. Test Option is '{}'", testOption); + state = "afterExternalServicePostMainLoop"; + + if (FAIL_AFTER_EXTERNAL_SERVICE_POST_MAIN_LOOP.equals(testOption)) { + state = "failafterExternalServicePostMainLoop"; + throw new RuntimeException("I was told to fail after external services post main loop"); + } + + writeSignal("afterExternalServicePostMainLoop"); + state = "afterExternalServicePostMainLoopFinished"; + } + @Override public void stop() { LOG.info("Stopping. Test Option is '{}'", testOption); state = "stopping"; - if ("FAILSTOP".equals(testOption)) { + if (FAIL_STOP.equals(testOption)) { state = "failstop"; throw new RuntimeException("I was told to fail at stop"); } @@ -103,7 +140,7 @@ public String getState() { @SuppressWarnings("ResultOfMethodCallIgnored") private void writeSignal(final String signal) { try { - final File callbackFile = new File(callbackDir, "pluginLifecycle." + signal); + final File callbackFile = new File(callbackDir, PLUGIN_LIFECYCLE_PREFIX + signal); if (!callbackFile.getParentFile().exists()) { callbackFile.getParentFile().mkdirs(); callbackFile.getParentFile().deleteOnExit(); diff --git a/acceptance-tests/test-plugins/src/test/java/org/hyperledger/besu/services/BesuPluginContextImplTest.java b/acceptance-tests/test-plugins/src/test/java/org/hyperledger/besu/services/BesuPluginContextImplTest.java index 7e277041776..a6d167665ff 100644 --- a/acceptance-tests/test-plugins/src/test/java/org/hyperledger/besu/services/BesuPluginContextImplTest.java +++ b/acceptance-tests/test-plugins/src/test/java/org/hyperledger/besu/services/BesuPluginContextImplTest.java @@ -1,5 +1,5 @@ /* - * Copyright ConsenSys AG. + * Copyright contributors to Hyperledger Besu. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -40,8 +40,31 @@ public class BesuPluginContextImplTest { private static final Path DEFAULT_PLUGIN_DIRECTORY = Paths.get("."); + private static final String TEST_PICO_CLI_PLUGIN = "TestPicoCLIPlugin"; + private static final String TEST_PICO_CLI_PLUGIN_TEST_OPTION = "testPicoCLIPlugin.testOption"; + private static final String FAIL_REGISTER = "FAILREGISTER"; + private static final String FAIL_START = "FAILSTART"; + private static final String FAIL_STOP = "FAILSTOP"; + private static final String FAIL_BEFORE_EXTERNAL_SERVICES = "FAILBEFOREEXTERNALSERVICES"; + private static final String FAIL_BEFORE_MAIN_LOOP = "FAILBEFOREMAINLOOP"; + private static final String FAIL_AFTER_EXTERNAL_SERVICE_POST_MAIN_LOOP = + "FAILAFTEREXTERNALSERVICEPOSTMAINLOOP"; + private static final String NON_EXISTENT_PLUGIN = "NonExistentPlugin"; + private static final String REGISTERED = "registered"; + private static final String STARTED = "started"; + private static final String STOPPED = "stopped"; + private static final String FAIL_START_STATE = "failstart"; + private static final String FAIL_STOP_STATE = "failstop"; + private BesuPluginContextImpl contextImpl; + private static final PluginConfiguration DEFAULT_CONFIGURATION = + PluginConfiguration.builder() + .pluginsDir(DEFAULT_PLUGIN_DIRECTORY) + .externalPluginsEnabled(true) + .continueOnPluginError(true) + .build(); + @BeforeAll public static void createFakePluginDir() throws IOException { if (System.getProperty("besu.plugins.dir") == null) { @@ -53,7 +76,7 @@ public static void createFakePluginDir() throws IOException { @AfterEach public void clearTestPluginState() { - System.clearProperty("testPicoCLIPlugin.testOption"); + System.clearProperty(TEST_PICO_CLI_PLUGIN_TEST_OPTION); } @BeforeEach @@ -64,31 +87,31 @@ void setup() { @Test public void verifyEverythingGoesSmoothly() { assertThat(contextImpl.getRegisteredPlugins()).isEmpty(); - contextImpl.registerPlugins( - PluginConfiguration.builder().pluginsDir(DEFAULT_PLUGIN_DIRECTORY).build()); + contextImpl.initialize(DEFAULT_CONFIGURATION); + contextImpl.registerPlugins(); assertThat(contextImpl.getRegisteredPlugins()).isNotEmpty(); final Optional testPluginOptional = findTestPlugin(contextImpl.getRegisteredPlugins(), TestPicoCLIPlugin.class); assertThat(testPluginOptional).isPresent(); final TestPicoCLIPlugin testPicoCLIPlugin = testPluginOptional.get(); - assertThat(testPicoCLIPlugin.getState()).isEqualTo("registered"); + assertThat(testPicoCLIPlugin.getState()).isEqualTo(REGISTERED); contextImpl.beforeExternalServices(); contextImpl.startPlugins(); - assertThat(testPicoCLIPlugin.getState()).isEqualTo("started"); + assertThat(testPicoCLIPlugin.getState()).isEqualTo(STARTED); contextImpl.stopPlugins(); - assertThat(testPicoCLIPlugin.getState()).isEqualTo("stopped"); + assertThat(testPicoCLIPlugin.getState()).isEqualTo(STOPPED); } @Test public void registrationErrorsHandledSmoothly() { - System.setProperty("testPicoCLIPlugin.testOption", "FAILREGISTER"); + System.setProperty(TEST_PICO_CLI_PLUGIN_TEST_OPTION, FAIL_REGISTER); assertThat(contextImpl.getRegisteredPlugins()).isEmpty(); - contextImpl.registerPlugins( - PluginConfiguration.builder().pluginsDir(DEFAULT_PLUGIN_DIRECTORY).build()); + contextImpl.initialize(DEFAULT_CONFIGURATION); + contextImpl.registerPlugins(); assertThat(contextImpl.getRegisteredPlugins()).isNotInstanceOfAny(TestPicoCLIPlugin.class); contextImpl.beforeExternalServices(); @@ -103,11 +126,11 @@ public void registrationErrorsHandledSmoothly() { @Test public void startErrorsHandledSmoothly() { - System.setProperty("testPicoCLIPlugin.testOption", "FAILSTART"); + System.setProperty(TEST_PICO_CLI_PLUGIN_TEST_OPTION, FAIL_START); assertThat(contextImpl.getRegisteredPlugins()).isEmpty(); - contextImpl.registerPlugins( - PluginConfiguration.builder().pluginsDir(DEFAULT_PLUGIN_DIRECTORY).build()); + contextImpl.initialize(DEFAULT_CONFIGURATION); + contextImpl.registerPlugins(); assertThat(contextImpl.getRegisteredPlugins()) .extracting("class") .contains(TestPicoCLIPlugin.class); @@ -116,11 +139,11 @@ public void startErrorsHandledSmoothly() { findTestPlugin(contextImpl.getRegisteredPlugins(), TestPicoCLIPlugin.class); assertThat(testPluginOptional).isPresent(); final TestPicoCLIPlugin testPicoCLIPlugin = testPluginOptional.get(); - assertThat(testPicoCLIPlugin.getState()).isEqualTo("registered"); + assertThat(testPicoCLIPlugin.getState()).isEqualTo(REGISTERED); contextImpl.beforeExternalServices(); contextImpl.startPlugins(); - assertThat(testPicoCLIPlugin.getState()).isEqualTo("failstart"); + assertThat(testPicoCLIPlugin.getState()).isEqualTo(FAIL_START_STATE); assertThat(contextImpl.getRegisteredPlugins()).isNotInstanceOfAny(TestPicoCLIPlugin.class); contextImpl.stopPlugins(); @@ -129,11 +152,11 @@ public void startErrorsHandledSmoothly() { @Test public void stopErrorsHandledSmoothly() { - System.setProperty("testPicoCLIPlugin.testOption", "FAILSTOP"); + System.setProperty(TEST_PICO_CLI_PLUGIN_TEST_OPTION, FAIL_STOP); assertThat(contextImpl.getRegisteredPlugins()).isEmpty(); - contextImpl.registerPlugins( - PluginConfiguration.builder().pluginsDir(DEFAULT_PLUGIN_DIRECTORY).build()); + contextImpl.initialize(DEFAULT_CONFIGURATION); + contextImpl.registerPlugins(); assertThat(contextImpl.getRegisteredPlugins()) .extracting("class") .contains(TestPicoCLIPlugin.class); @@ -142,22 +165,20 @@ public void stopErrorsHandledSmoothly() { findTestPlugin(contextImpl.getRegisteredPlugins(), TestPicoCLIPlugin.class); assertThat(testPluginOptional).isPresent(); final TestPicoCLIPlugin testPicoCLIPlugin = testPluginOptional.get(); - assertThat(testPicoCLIPlugin.getState()).isEqualTo("registered"); + assertThat(testPicoCLIPlugin.getState()).isEqualTo(REGISTERED); contextImpl.beforeExternalServices(); contextImpl.startPlugins(); - assertThat(testPicoCLIPlugin.getState()).isEqualTo("started"); + assertThat(testPicoCLIPlugin.getState()).isEqualTo(STARTED); contextImpl.stopPlugins(); - assertThat(testPicoCLIPlugin.getState()).isEqualTo("failstop"); + assertThat(testPicoCLIPlugin.getState()).isEqualTo(FAIL_STOP_STATE); } @Test public void lifecycleExceptions() throws Throwable { - final ThrowableAssert.ThrowingCallable registerPlugins = - () -> - contextImpl.registerPlugins( - PluginConfiguration.builder().pluginsDir(DEFAULT_PLUGIN_DIRECTORY).build()); + contextImpl.initialize(DEFAULT_CONFIGURATION); + final ThrowableAssert.ThrowingCallable registerPlugins = () -> contextImpl.registerPlugins(); assertThatExceptionOfType(IllegalStateException.class).isThrownBy(contextImpl::startPlugins); assertThatExceptionOfType(IllegalStateException.class).isThrownBy(contextImpl::stopPlugins); @@ -179,30 +200,27 @@ public void lifecycleExceptions() throws Throwable { @Test public void shouldRegisterAllPluginsWhenNoPluginsOption() { - final PluginConfiguration config = - PluginConfiguration.builder().pluginsDir(DEFAULT_PLUGIN_DIRECTORY).build(); - assertThat(contextImpl.getRegisteredPlugins()).isEmpty(); - contextImpl.registerPlugins(config); + contextImpl.initialize(DEFAULT_CONFIGURATION); + contextImpl.registerPlugins(); final Optional testPluginOptional = findTestPlugin(contextImpl.getRegisteredPlugins(), TestPicoCLIPlugin.class); assertThat(testPluginOptional).isPresent(); final TestPicoCLIPlugin testPicoCLIPlugin = testPluginOptional.get(); - assertThat(testPicoCLIPlugin.getState()).isEqualTo("registered"); + assertThat(testPicoCLIPlugin.getState()).isEqualTo(REGISTERED); } @Test public void shouldRegisterOnlySpecifiedPluginWhenPluginsOptionIsSet() { - final PluginConfiguration config = createConfigurationForSpecificPlugin("TestPicoCLIPlugin"); - assertThat(contextImpl.getRegisteredPlugins()).isEmpty(); - contextImpl.registerPlugins(config); + contextImpl.initialize(createConfigurationForSpecificPlugin(TEST_PICO_CLI_PLUGIN)); + contextImpl.registerPlugins(); final Optional requestedPlugin = findTestPlugin(contextImpl.getRegisteredPlugins(), TestPicoCLIPlugin.class); assertThat(requestedPlugin).isPresent(); - assertThat(requestedPlugin.get().getState()).isEqualTo("registered"); + assertThat(requestedPlugin.get().getState()).isEqualTo(REGISTERED); final Optional nonRequestedPlugin = findTestPlugin(contextImpl.getRegisteredPlugins(), TestBesuEventsPlugin.class); @@ -212,9 +230,9 @@ public void shouldRegisterOnlySpecifiedPluginWhenPluginsOptionIsSet() { @Test public void shouldNotRegisterUnspecifiedPluginsWhenPluginsOptionIsSet() { - final PluginConfiguration config = createConfigurationForSpecificPlugin("TestPicoCLIPlugin"); assertThat(contextImpl.getRegisteredPlugins()).isEmpty(); - contextImpl.registerPlugins(config); + contextImpl.initialize(createConfigurationForSpecificPlugin(TEST_PICO_CLI_PLUGIN)); + contextImpl.registerPlugins(); final Optional nonRequestedPlugin = findTestPlugin(contextImpl.getRegisteredPlugins(), TestBesuEventsPlugin.class); @@ -223,13 +241,12 @@ public void shouldNotRegisterUnspecifiedPluginsWhenPluginsOptionIsSet() { @Test void shouldThrowExceptionIfExplicitlySpecifiedPluginNotFound() { - PluginConfiguration config = createConfigurationForSpecificPlugin("NonExistentPlugin"); - + contextImpl.initialize(createConfigurationForSpecificPlugin(NON_EXISTENT_PLUGIN)); String exceptionMessage = - assertThrows(NoSuchElementException.class, () -> contextImpl.registerPlugins(config)) + assertThrows(NoSuchElementException.class, () -> contextImpl.registerPlugins()) .getMessage(); final String expectedMessage = - "The following requested plugins were not found: NonExistentPlugin"; + "The following requested plugins were not found: " + NON_EXISTENT_PLUGIN; assertThat(exceptionMessage).isEqualTo(expectedMessage); assertThat(contextImpl.getRegisteredPlugins()).isEmpty(); } @@ -241,19 +258,180 @@ void shouldNotRegisterAnyPluginsIfExternalPluginsDisabled() { .pluginsDir(DEFAULT_PLUGIN_DIRECTORY) .externalPluginsEnabled(false) .build(); - contextImpl.registerPlugins(config); + contextImpl.initialize(config); + contextImpl.registerPlugins(); assertThat(contextImpl.getRegisteredPlugins().isEmpty()).isTrue(); } @Test void shouldRegisterPluginsIfExternalPluginsEnabled() { + contextImpl.initialize(DEFAULT_CONFIGURATION); + contextImpl.registerPlugins(); + assertThat(contextImpl.getRegisteredPlugins().isEmpty()).isFalse(); + } + + @Test + void shouldHaltOnRegisterErrorWhenFlagIsFalse() { + System.setProperty(TEST_PICO_CLI_PLUGIN_TEST_OPTION, FAIL_REGISTER); + PluginConfiguration config = PluginConfiguration.builder() + .requestedPlugins(List.of(new PluginInfo(TEST_PICO_CLI_PLUGIN))) .pluginsDir(DEFAULT_PLUGIN_DIRECTORY) - .externalPluginsEnabled(true) + .continueOnPluginError(false) .build(); - contextImpl.registerPlugins(config); - assertThat(contextImpl.getRegisteredPlugins().isEmpty()).isFalse(); + + contextImpl.initialize(config); + + String errorMessage = + String.format("Error registering plugin of type %s", TestPicoCLIPlugin.class.getName()); + assertThatExceptionOfType(RuntimeException.class) + .isThrownBy(() -> contextImpl.registerPlugins()) + .withMessageContaining(errorMessage); + } + + @Test + void shouldNotHaltOnRegisterErrorWhenFlagIsTrue() { + System.setProperty(TEST_PICO_CLI_PLUGIN_TEST_OPTION, FAIL_REGISTER); + + PluginConfiguration config = + PluginConfiguration.builder() + .pluginsDir(DEFAULT_PLUGIN_DIRECTORY) + .continueOnPluginError(true) + .build(); + + contextImpl.initialize(config); + contextImpl.registerPlugins(); + assertThat(contextImpl.getRegisteredPlugins()).isNotInstanceOfAny(TestPicoCLIPlugin.class); + } + + @Test + void shouldHaltOnBeforeExternalServicesErrorWhenFlagIsFalse() { + System.setProperty(TEST_PICO_CLI_PLUGIN_TEST_OPTION, FAIL_BEFORE_EXTERNAL_SERVICES); + + PluginConfiguration config = + PluginConfiguration.builder() + .requestedPlugins(List.of(new PluginInfo(TEST_PICO_CLI_PLUGIN))) + .pluginsDir(DEFAULT_PLUGIN_DIRECTORY) + .continueOnPluginError(false) + .build(); + + contextImpl.initialize(config); + contextImpl.registerPlugins(); + + String errorMessage = + String.format( + "Error calling `beforeExternalServices` on plugin of type %s", + TestPicoCLIPlugin.class.getName()); + assertThatExceptionOfType(RuntimeException.class) + .isThrownBy(() -> contextImpl.beforeExternalServices()) + .withMessageContaining(errorMessage); + } + + @Test + void shouldNotHaltOnBeforeExternalServicesErrorWhenFlagIsTrue() { + System.setProperty(TEST_PICO_CLI_PLUGIN_TEST_OPTION, FAIL_BEFORE_EXTERNAL_SERVICES); + + PluginConfiguration config = + PluginConfiguration.builder() + .requestedPlugins(List.of(new PluginInfo(TEST_PICO_CLI_PLUGIN))) + .pluginsDir(DEFAULT_PLUGIN_DIRECTORY) + .continueOnPluginError(true) + .build(); + + contextImpl.initialize(config); + contextImpl.registerPlugins(); + contextImpl.beforeExternalServices(); + + assertThat(contextImpl.getRegisteredPlugins()).isNotInstanceOfAny(TestPicoCLIPlugin.class); + } + + @Test + void shouldHaltOnBeforeMainLoopErrorWhenFlagIsFalse() { + System.setProperty(TEST_PICO_CLI_PLUGIN_TEST_OPTION, FAIL_START); + + PluginConfiguration config = + PluginConfiguration.builder() + .requestedPlugins(List.of(new PluginInfo(TEST_PICO_CLI_PLUGIN))) + .pluginsDir(DEFAULT_PLUGIN_DIRECTORY) + .continueOnPluginError(false) + .build(); + + contextImpl.initialize(config); + contextImpl.registerPlugins(); + contextImpl.beforeExternalServices(); + + String errorMessage = + String.format("Error starting plugin of type %s", TestPicoCLIPlugin.class.getName()); + assertThatExceptionOfType(RuntimeException.class) + .isThrownBy(() -> contextImpl.startPlugins()) + .withMessageContaining(errorMessage); + } + + @Test + void shouldNotHaltOnBeforeMainLoopErrorWhenFlagIsTrue() { + System.setProperty(TEST_PICO_CLI_PLUGIN_TEST_OPTION, FAIL_BEFORE_MAIN_LOOP); + + PluginConfiguration config = + PluginConfiguration.builder() + .requestedPlugins(List.of(new PluginInfo(TEST_PICO_CLI_PLUGIN))) + .pluginsDir(DEFAULT_PLUGIN_DIRECTORY) + .continueOnPluginError(true) + .build(); + + contextImpl.initialize(config); + contextImpl.registerPlugins(); + contextImpl.beforeExternalServices(); + contextImpl.startPlugins(); + + assertThat(contextImpl.getRegisteredPlugins()).isNotInstanceOfAny(TestPicoCLIPlugin.class); + } + + @Test + void shouldHaltOnAfterExternalServicePostMainLoopErrorWhenFlagIsFalse() { + System.setProperty( + TEST_PICO_CLI_PLUGIN_TEST_OPTION, FAIL_AFTER_EXTERNAL_SERVICE_POST_MAIN_LOOP); + + PluginConfiguration config = + PluginConfiguration.builder() + .requestedPlugins(List.of(new PluginInfo(TEST_PICO_CLI_PLUGIN))) + .pluginsDir(DEFAULT_PLUGIN_DIRECTORY) + .continueOnPluginError(false) + .build(); + + contextImpl.initialize(config); + contextImpl.registerPlugins(); + contextImpl.beforeExternalServices(); + contextImpl.startPlugins(); + + String errorMessage = + String.format( + "Error calling `afterExternalServicePostMainLoop` on plugin of type %s", + TestPicoCLIPlugin.class.getName()); + assertThatExceptionOfType(RuntimeException.class) + .isThrownBy(() -> contextImpl.afterExternalServicesMainLoop()) + .withMessageContaining(errorMessage); + } + + @Test + void shouldNotHaltOnAfterExternalServicePostMainLoopErrorWhenFlagIsTrue() { + System.setProperty( + TEST_PICO_CLI_PLUGIN_TEST_OPTION, FAIL_AFTER_EXTERNAL_SERVICE_POST_MAIN_LOOP); + + PluginConfiguration config = + PluginConfiguration.builder() + .requestedPlugins(List.of(new PluginInfo(TEST_PICO_CLI_PLUGIN))) + .pluginsDir(DEFAULT_PLUGIN_DIRECTORY) + .continueOnPluginError(true) + .build(); + + contextImpl.initialize(config); + contextImpl.registerPlugins(); + contextImpl.beforeExternalServices(); + contextImpl.startPlugins(); + contextImpl.afterExternalServicesMainLoop(); + + assertThat(contextImpl.getRegisteredPlugins()).isNotInstanceOfAny(TestPicoCLIPlugin.class); } private PluginConfiguration createConfigurationForSpecificPlugin(final String pluginName) { diff --git a/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java b/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java index 79879538bd5..e93518cad43 100644 --- a/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java +++ b/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java @@ -118,7 +118,6 @@ import org.hyperledger.besu.ethereum.core.MiningParametersMetrics; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.core.VersionMetadata; -import org.hyperledger.besu.ethereum.core.plugins.PluginConfiguration; import org.hyperledger.besu.ethereum.eth.sync.SyncMode; import org.hyperledger.besu.ethereum.eth.sync.SynchronizerConfiguration; import org.hyperledger.besu.ethereum.eth.transactions.ImmutableTransactionPoolConfiguration; @@ -1080,9 +1079,8 @@ private IExecutionStrategy createExecuteTask(final IExecutionStrategy nextStep) private IExecutionStrategy createPluginRegistrationTask(final IExecutionStrategy nextStep) { return parseResult -> { - PluginConfiguration configuration = - PluginsConfigurationOptions.fromCommandLine(parseResult.commandSpec().commandLine()); - besuPluginContext.registerPlugins(configuration); + besuPluginContext.initialize(PluginsConfigurationOptions.fromCommandLine(commandLine)); + besuPluginContext.registerPlugins(); commandLine.setExecutionStrategy(nextStep); return commandLine.execute(parseResult.originalArgs().toArray(new String[0])); }; diff --git a/besu/src/main/java/org/hyperledger/besu/cli/DefaultCommandValues.java b/besu/src/main/java/org/hyperledger/besu/cli/DefaultCommandValues.java index ba05f455246..8f83c71a787 100644 --- a/besu/src/main/java/org/hyperledger/besu/cli/DefaultCommandValues.java +++ b/besu/src/main/java/org/hyperledger/besu/cli/DefaultCommandValues.java @@ -128,6 +128,9 @@ public interface DefaultCommandValues { /** The constant DEFAULT_PLUGINS_OPTION_NAME. */ String DEFAULT_PLUGINS_OPTION_NAME = "--plugins"; + /** The constant DEFAULT_CONTINUE_ON_PLUGIN_ERROR_OPTION_NAME. */ + String DEFAULT_CONTINUE_ON_PLUGIN_ERROR_OPTION_NAME = "--plugin-continue-on-error"; + /** The constant DEFAULT_PLUGINS_EXTERNAL_ENABLED_OPTION_NAME. */ String DEFAULT_PLUGINS_EXTERNAL_ENABLED_OPTION_NAME = "--Xplugins-external-enabled"; diff --git a/besu/src/main/java/org/hyperledger/besu/cli/options/stable/PluginsConfigurationOptions.java b/besu/src/main/java/org/hyperledger/besu/cli/options/stable/PluginsConfigurationOptions.java index 47df831c577..25893fff895 100644 --- a/besu/src/main/java/org/hyperledger/besu/cli/options/stable/PluginsConfigurationOptions.java +++ b/besu/src/main/java/org/hyperledger/besu/cli/options/stable/PluginsConfigurationOptions.java @@ -14,6 +14,7 @@ */ package org.hyperledger.besu.cli.options.stable; +import static org.hyperledger.besu.cli.DefaultCommandValues.DEFAULT_CONTINUE_ON_PLUGIN_ERROR_OPTION_NAME; import static org.hyperledger.besu.cli.DefaultCommandValues.DEFAULT_PLUGINS_EXTERNAL_ENABLED_OPTION_NAME; import static org.hyperledger.besu.cli.DefaultCommandValues.DEFAULT_PLUGINS_OPTION_NAME; @@ -27,7 +28,7 @@ import picocli.CommandLine; -/** The Plugins Options options. */ +/** The Plugins options. */ public class PluginsConfigurationOptions implements CLIOptions { @CommandLine.Option( @@ -44,9 +45,17 @@ public class PluginsConfigurationOptions implements CLIOptions