diff --git a/.github/workflows/flow-artifact-determinism.yaml b/.github/workflows/flow-artifact-determinism.yaml
index f638b1c915bd..7c6c71f9ff49 100644
--- a/.github/workflows/flow-artifact-determinism.yaml
+++ b/.github/workflows/flow-artifact-determinism.yaml
@@ -35,7 +35,7 @@ on:
default: "21.0.4"
push:
branches:
- - develop
+ - main
- 'release/**'
tags:
- 'v*.*.*'
diff --git a/.github/workflows/node-flow-build-application.yaml b/.github/workflows/node-flow-build-application.yaml
index 8630c2aa0358..befc83899548 100644
--- a/.github/workflows/node-flow-build-application.yaml
+++ b/.github/workflows/node-flow-build-application.yaml
@@ -50,7 +50,6 @@ on:
default: "temurin"
push:
branches:
- - develop
- main
- 'release/*'
@@ -124,7 +123,7 @@ jobs:
with:
workflow: .github/workflows/node-flow-deploy-release-artifact.yaml
repo: hashgraph/hedera-services # ensure we are executing in the hashgraph org
- ref: develop # ensure we are always using the workflow definition from the develop branch
+ ref: main # ensure we are always using the workflow definition from the main branch
token: ${{ secrets.GH_ACCESS_TOKEN }}
inputs: '{
"ref": "${{ steps.workflow-inputs.outputs.input-ref }}",
diff --git a/.github/workflows/node-flow-deploy-release-artifact.yaml b/.github/workflows/node-flow-deploy-release-artifact.yaml
index 50e13ca7da0d..a66aff48bee5 100644
--- a/.github/workflows/node-flow-deploy-release-artifact.yaml
+++ b/.github/workflows/node-flow-deploy-release-artifact.yaml
@@ -41,6 +41,11 @@ defaults:
run:
shell: bash
+permissions:
+ id-token: write
+ contents: read
+ actions: read
+
jobs:
prepare-tag-release:
name: Prepare Release [Tag]
@@ -150,28 +155,52 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: '0'
- ref: develop
+ ref: main
token: ${{ secrets.GH_ACCESS_TOKEN }}
- - name: Trigger ZXF Prepare Extended Test Suite
+ - name: Check Prep XTS Job State
+ id: check-xts-job
if: ${{ needs.release-branch.result == 'success' }}
+ env:
+ GH_TOKEN: ${{ github.token }}
+ run: |
+ JOB_ENABLED="true"
+ JOB_STATE=$(gh workflow list --all --json name,state | jq -r '.[]|select(.name=="ZXF: Prepare Extended Test Suite")|.state')
+ [[ "${JOB_STATE}" == "disabled_manually" ]] && JOB_ENABLED="false"
+ echo "enabled=${JOB_ENABLED}" >> $GITHUB_OUTPUT
+
+ - name: Trigger ZXF Prepare Extended Test Suite
+ if: ${{ needs.release-branch.result == 'success' && steps.check-xts-job.outputs.enabled == 'true' }}
uses: step-security/workflow-dispatch@4d1049025980f72b1327cbfdeecb07fe7a20f577 # v1.2.4
with:
workflow: .github/workflows/zxf-prepare-extended-test-suite.yaml
repo: hashgraph/hedera-services # ensure we are executing in the hashgraph org
- ref: develop # ensure we are always using the workflow definition from the develop branch
+ ref: main # ensure we are always using the workflow definition from the main branch
token: ${{ secrets.GH_ACCESS_TOKEN }}
inputs: '{ "ref": "${{ inputs.ref }}" }'
- - name: Trigger ZXF Deploy Integration
+ - name: Check Integration Job State
+ id: check-integration-job
if: ${{ needs.release-branch.result == 'success' &&
+ (inputs.author != '' && inputs.msg != '' && inputs.sha != '') &&
+ !cancelled() }}
+ env:
+ GH_TOKEN: ${{ github.token }}
+ run: |
+ JOB_ENABLED="true"
+ JOB_STATE=$(gh workflow list --all --json name,state | jq -r '.[]|select(.name=="ZXF: [Node] Deploy Integration Network Release")|.state')
+ [[ "${JOB_STATE}" == "disabled_manually" ]] && JOB_ENABLED="false"
+ echo "enabled=${JOB_ENABLED}" >> $GITHUB_OUTPUT
+
+ - name: Trigger ZXF Deploy Integration
+ if: ${{ needs.release-branch.result == 'success' && steps.check-integration-job.outputs.enabled == 'true' &&
(inputs.author != '' && inputs.msg != '' && inputs.sha != '') &&
!cancelled() }}
uses: step-security/workflow-dispatch@4d1049025980f72b1327cbfdeecb07fe7a20f577 # v1.2.4
with:
workflow: .github/workflows/node-zxf-deploy-integration.yaml
repo: hashgraph/hedera-services # ensure we are executing in the hashgraph org
- ref: develop # ensure we are always using the workflow definition from the develop branch
+ ref: main # ensure we are always using the workflow definition from the main branch
token: ${{ secrets.GH_ACCESS_TOKEN }}
inputs: '{
"ref": "${{ inputs.ref }}",
@@ -195,7 +224,7 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
token: ${{ secrets.GH_ACCESS_TOKEN }}
- ref: develop
+ ref: main
fetch-depth: '0'
- name: Checkout Hedera Protobufs Code
diff --git a/.github/workflows/node-zxc-build-release-artifact.yaml b/.github/workflows/node-zxc-build-release-artifact.yaml
index bd079e5fc89c..5aded7a22df4 100644
--- a/.github/workflows/node-zxc-build-release-artifact.yaml
+++ b/.github/workflows/node-zxc-build-release-artifact.yaml
@@ -179,13 +179,13 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup Java
- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0
+ uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4.6.0
with:
distribution: ${{ inputs.java-distribution }}
java-version: ${{ inputs.java-version }}
- name: Setup Gradle
- uses: gradle/actions/setup-gradle@cc4fc85e6b35bafd578d5ffbc76a5518407e1af0 # v4.2.1
+ uses: gradle/actions/setup-gradle@0bdd871935719febd78681f197cd39af5b6e16a6 # v4.2.2
with:
gradle-version: ${{ inputs.gradle-version }}
@@ -284,13 +284,13 @@ jobs:
if: ${{ inputs.dry-run-enabled != true && !cancelled() && !failure() }}
- name: Setup Java
- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0
+ uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4.6.0
with:
distribution: ${{ inputs.java-distribution }}
java-version: ${{ inputs.java-version }}
- name: Setup Gradle
- uses: gradle/actions/setup-gradle@cc4fc85e6b35bafd578d5ffbc76a5518407e1af0 # v4.2.1
+ uses: gradle/actions/setup-gradle@0bdd871935719febd78681f197cd39af5b6e16a6 # v4.2.2
with:
gradle-version: ${{ inputs.gradle-version }}
@@ -714,13 +714,13 @@ jobs:
if: ${{ inputs.dry-run-enabled != true && !cancelled() && !failure() }}
- name: Setup Java
- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0
+ uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4.6.0
with:
distribution: ${{ inputs.java-distribution }}
java-version: ${{ inputs.java-version }}
- name: Setup Gradle
- uses: gradle/actions/setup-gradle@cc4fc85e6b35bafd578d5ffbc76a5518407e1af0 # v4.2.1
+ uses: gradle/actions/setup-gradle@0bdd871935719febd78681f197cd39af5b6e16a6 # v4.2.2
with:
gradle-version: ${{ inputs.gradle-version }}
diff --git a/.github/workflows/node-zxc-compile-application-code.yaml b/.github/workflows/node-zxc-compile-application-code.yaml
index 258bac714ab0..70fc3377f7e4 100644
--- a/.github/workflows/node-zxc-compile-application-code.yaml
+++ b/.github/workflows/node-zxc-compile-application-code.yaml
@@ -176,13 +176,13 @@ jobs:
run: git fetch --unshallow --no-recurse-submodules
- name: Setup Java
- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0
+ uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4.6.0
with:
distribution: ${{ inputs.java-distribution }}
java-version: ${{ inputs.java-version }}
- name: Setup Gradle
- uses: gradle/actions/setup-gradle@cc4fc85e6b35bafd578d5ffbc76a5518407e1af0 # v4.2.1
+ uses: gradle/actions/setup-gradle@0bdd871935719febd78681f197cd39af5b6e16a6 # v4.2.2
with:
cache-read-only: false
diff --git a/.github/workflows/node-zxcron-develop-fsts-regression.yaml b/.github/workflows/node-zxcron-main-fsts-regression.yaml
similarity index 97%
rename from .github/workflows/node-zxcron-develop-fsts-regression.yaml
rename to .github/workflows/node-zxcron-main-fsts-regression.yaml
index df2b6a3d7352..ff7b86573758 100644
--- a/.github/workflows/node-zxcron-develop-fsts-regression.yaml
+++ b/.github/workflows/node-zxcron-main-fsts-regression.yaml
@@ -14,7 +14,7 @@
# limitations under the License.
##
-name: "ZXCron: [Node] Develop JRS Tests"
+name: "ZXCron: [Node] Main JRS Tests"
on:
workflow_dispatch:
diff --git a/.github/workflows/node-zxf-snyk-monitor.yaml b/.github/workflows/node-zxf-snyk-monitor.yaml
index 3c6fa5cef88e..a86e0d52f997 100644
--- a/.github/workflows/node-zxf-snyk-monitor.yaml
+++ b/.github/workflows/node-zxf-snyk-monitor.yaml
@@ -19,7 +19,7 @@ name: "ZXF: Snyk Monitor"
on:
push:
branches:
- - develop
+ - main
workflow_dispatch:
permissions:
@@ -40,13 +40,13 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup Java
- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0
+ uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4.6.0
with:
distribution: temurin
java-version: 21
- name: Setup Gradle
- uses: gradle/actions/setup-gradle@cc4fc85e6b35bafd578d5ffbc76a5518407e1af0 # v4.2.1
+ uses: gradle/actions/setup-gradle@0bdd871935719febd78681f197cd39af5b6e16a6 # v4.2.2
with:
build-root-directory: hedera-node
gradle-version: wrapper
diff --git a/.github/workflows/platform-zxcron-develop-jrs-regression.yaml b/.github/workflows/platform-zxcron-main-jrs-regression.yaml
similarity index 97%
rename from .github/workflows/platform-zxcron-develop-jrs-regression.yaml
rename to .github/workflows/platform-zxcron-main-jrs-regression.yaml
index 6cfc2218a2c0..82de7cc2dde5 100644
--- a/.github/workflows/platform-zxcron-develop-jrs-regression.yaml
+++ b/.github/workflows/platform-zxcron-main-jrs-regression.yaml
@@ -14,7 +14,7 @@
# limitations under the License.
##
-name: "ZXCron: [Platform] Develop JRS Regression"
+name: "ZXCron: [Platform] Main JRS Regression"
on:
schedule:
- cron: '30 5 * * *'
diff --git a/.github/workflows/zxc-jrs-regression.yaml b/.github/workflows/zxc-jrs-regression.yaml
index d8e1f7c1844f..e42b76a6046d 100644
--- a/.github/workflows/zxc-jrs-regression.yaml
+++ b/.github/workflows/zxc-jrs-regression.yaml
@@ -336,13 +336,13 @@ jobs:
node-version: 18
- name: Setup Java
- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0
+ uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4.6.0
with:
distribution: ${{ inputs.java-distribution }}
java-version: ${{ inputs.java-version }}
- name: Setup Gradle
- uses: gradle/actions/setup-gradle@cc4fc85e6b35bafd578d5ffbc76a5518407e1af0 # v4.2.1
+ uses: gradle/actions/setup-gradle@0bdd871935719febd78681f197cd39af5b6e16a6 # v4.2.2
with:
gradle-version: ${{ inputs.gradle-version }}
gradle-home-cache-strict-match: false
@@ -486,8 +486,8 @@ jobs:
fi
if [[ -n "${HEDERA_TESTS_ENABLED}" && "${HEDERA_TESTS_ENABLED}" = true ]]; then
- # Override for the develop branch
- if [[ "${SLACK_BRANCH}" != "develop" ]]; then
+ # Override for the main branch
+ if [[ "${SLACK_BRANCH}" != "main" ]]; then
SLACK_SUMMARY="hedera-gcp-${SLACK_BRANCH}-summary"
SLACK_RESULTS="hedera-gcp-${SLACK_BRANCH}-regression"
else
diff --git a/.github/workflows/zxc-verify-docker-build-determinism.yaml b/.github/workflows/zxc-verify-docker-build-determinism.yaml
index 5c4c1d0876a1..83c7bcfe4df1 100644
--- a/.github/workflows/zxc-verify-docker-build-determinism.yaml
+++ b/.github/workflows/zxc-verify-docker-build-determinism.yaml
@@ -118,14 +118,14 @@ jobs:
echo "file=${BASELINE_FILE}" >> "${GITHUB_OUTPUT}"
- name: Setup Java
- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0
+ uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4.6.0
if: ${{ steps.baseline.outputs.exists == 'false' && !failure() && !cancelled() }}
with:
distribution: ${{ inputs.java-distribution }}
java-version: ${{ inputs.java-version }}
- name: Setup Gradle
- uses: gradle/actions/setup-gradle@cc4fc85e6b35bafd578d5ffbc76a5518407e1af0 # v4.2.1
+ uses: gradle/actions/setup-gradle@0bdd871935719febd78681f197cd39af5b6e16a6 # v4.2.2
if: ${{ steps.baseline.outputs.exists == 'false' && !failure() && !cancelled() }}
with:
cache-disabled: true
diff --git a/.github/workflows/zxc-verify-gradle-build-determinism.yaml b/.github/workflows/zxc-verify-gradle-build-determinism.yaml
index 76f00b1f7972..119e0e923e5a 100644
--- a/.github/workflows/zxc-verify-gradle-build-determinism.yaml
+++ b/.github/workflows/zxc-verify-gradle-build-determinism.yaml
@@ -78,13 +78,13 @@ jobs:
ref: ${{ inputs.ref }}
- name: Setup Java
- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0
+ uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4.6.0
with:
distribution: ${{ inputs.java-distribution }}
java-version: ${{ inputs.java-version }}
- name: Setup Gradle
- uses: gradle/actions/setup-gradle@cc4fc85e6b35bafd578d5ffbc76a5518407e1af0 # v4.2.1
+ uses: gradle/actions/setup-gradle@0bdd871935719febd78681f197cd39af5b6e16a6 # v4.2.2
with:
cache-disabled: true
@@ -175,13 +175,13 @@ jobs:
python-version: 3.9
- name: Setup Java
- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0
+ uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4.6.0
with:
distribution: ${{ inputs.java-distribution }}
java-version: ${{ inputs.java-version }}
- name: Setup Gradle
- uses: gradle/actions/setup-gradle@cc4fc85e6b35bafd578d5ffbc76a5518407e1af0 # v4.2.1
+ uses: gradle/actions/setup-gradle@0bdd871935719febd78681f197cd39af5b6e16a6 # v4.2.2
with:
cache-disabled: true
diff --git a/.github/workflows/zxcron-extended-test-suite.yaml b/.github/workflows/zxcron-extended-test-suite.yaml
index 53b467047dfa..49be04128ab8 100644
--- a/.github/workflows/zxcron-extended-test-suite.yaml
+++ b/.github/workflows/zxcron-extended-test-suite.yaml
@@ -57,12 +57,12 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: '0'
- ref: develop
+ ref: main
token: ${{ secrets.GH_ACCESS_TOKEN }}
# Check if the xts-candidate tag exists
# the command git branch --contains xts-tag-commit | grep --quiet
- # will return an exit code of 1 if the tagged commit is not found on the develop
+ # will return an exit code of 1 if the tagged commit is not found on the main
# branch.
- name: Check for tags
id: check-tags-exist
@@ -93,9 +93,9 @@ jobs:
gh run cancel ${{ github.run_id }}
fi
- # Check if the tag exists on the develop branch
+ # Check if the tag exists on the main branch
set +e
- git branch --contains "${XTS_COMMIT}" | grep --quiet develop >/dev/null 2>&1
+ git branch --contains "${XTS_COMMIT}" | grep --quiet main >/dev/null 2>&1
BRANCH_ON_DEVELOP="${?}"
set -e
@@ -103,7 +103,7 @@ jobs:
AUTHOR_NAME=$(git log -1 --format='%an' "${XTS_COMMIT}")
AUTHOR_EMAIL=$(git log -1 --format='%ae' "${XTS_COMMIT}")
- # If the tag exists on the Develop Branch set the output variables as appropriate
+ # If the tag exists on the Main Branch set the output variables as appropriate
# Otherwise cancel out
if [[ "${BRANCH_ON_DEVELOP}" -eq 0 ]]; then
echo "xts-tag-exists=true" >> $GITHUB_OUTPUT
@@ -260,7 +260,7 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: '0'
- ref: develop
+ ref: main
token: ${{ secrets.GH_ACCESS_TOKEN }}
- name: Collect run logs in a log file
diff --git a/.github/workflows/zxcron-promote-build-candidate.yaml b/.github/workflows/zxcron-promote-build-candidate.yaml
index 7976fe9bf686..8cbf7e23598d 100644
--- a/.github/workflows/zxcron-promote-build-candidate.yaml
+++ b/.github/workflows/zxcron-promote-build-candidate.yaml
@@ -52,7 +52,7 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: '0'
- ref: develop
+ ref: main
token: ${{ secrets.GH_ACCESS_TOKEN }}
- name: Find Build Candidates
@@ -74,8 +74,8 @@ jobs:
gh run cancel ${{ github.run_id }}
fi
- # Verify the commit is on develop and continue
- if git branch --contains "${CANDIDATE_COMMIT}" | grep --quiet develop >/dev/null 2>&1; then
+ # Verify the commit is on main and continue
+ if git branch --contains "${CANDIDATE_COMMIT}" | grep --quiet main >/dev/null 2>&1; then
git push --delete origin $(git tag --list "${TAG_PATTERN}")
git tag --delete $(git tag --list "${TAG_PATTERN}")
echo "build-candidate-exists=true" >> "${GITHUB_OUTPUT}"
diff --git a/.github/workflows/zxf-collect-workflow-logs.yaml b/.github/workflows/zxf-collect-workflow-logs.yaml
index 14d12a8e4a35..113fe7f82c35 100644
--- a/.github/workflows/zxf-collect-workflow-logs.yaml
+++ b/.github/workflows/zxf-collect-workflow-logs.yaml
@@ -50,7 +50,7 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: '0'
- ref: develop
+ ref: main
token: ${{ secrets.GH_ACCESS_TOKEN }}
- name: Get run logs
diff --git a/.github/workflows/zxf-prepare-extended-test-suite.yaml b/.github/workflows/zxf-prepare-extended-test-suite.yaml
index e3f021b98eb5..d0dce64f6081 100644
--- a/.github/workflows/zxf-prepare-extended-test-suite.yaml
+++ b/.github/workflows/zxf-prepare-extended-test-suite.yaml
@@ -50,7 +50,7 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: '0'
- ref: 'develop'
+ ref: 'main'
token: ${{ secrets.GH_ACCESS_TOKEN }}
- name: Validate Input Ref
@@ -58,10 +58,10 @@ jobs:
env:
COMMIT_ID: ${{ inputs.ref }}
run: |
- if git merge-base --is-ancestor "${COMMIT_ID}" develop >/dev/null 2>&1; then
+ if git merge-base --is-ancestor "${COMMIT_ID}" main >/dev/null 2>&1; then
echo "commit_on_dev=true" >> $GITHUB_OUTPUT
else
- echo "::error title=Branch Alignment::The provided commit (${COMMIT_ID}) is not present on the develop branch."
+ echo "::error title=Branch Alignment::The provided commit (${COMMIT_ID}) is not present on the main branch."
exit 1
fi
diff --git a/docs/branch-naming-conventions.md b/docs/branch-naming-conventions.md
index c77ccb33ac26..841bc329a4d8 100644
--- a/docs/branch-naming-conventions.md
+++ b/docs/branch-naming-conventions.md
@@ -20,18 +20,19 @@ naming standard.
### Permanent & Default Branches
-The repository will contain two permanent branches as per the GitFlow Workflow `main` and `develop`
-branches.
+The repository will contain one permanent branch, `main`, per the Hashgraph Continuous Integration
+Test and Release workflow
**Default Branches**
-The default branch for a repository will be `develop` as per the branching workflow.
+The default branch for a repository will be `main` as per the Hashgraph Continuous Integration
+Test and Release workflow.
### Branch to Issue Relationship
Aside from the permanent or release branches, no short-lived (feature, hotfix, bugfix) branch should
be created without being associated to an issue number. No short-lived branch should be merged into
-`develop` or `main` without an associated and approved pull request.
+`main` without an associated and approved pull request.
### Feature Branch Naming
diff --git a/docs/continuous-integration-testing-overview.md b/docs/continuous-integration-testing-overview.md
index 036a82d983de..6afc43f6e52c 100644
--- a/docs/continuous-integration-testing-overview.md
+++ b/docs/continuous-integration-testing-overview.md
@@ -20,11 +20,11 @@ two major components of CITR: MATS and XTS.
MATS is the Minimal Acceptable Test Suite; this suite of tests is run against every pull request (PR) that is opened in
the `hashgraph/hedera-services` repository.
-XTS is the eXtended Test Suite; this suite of tests is run against the latest commit on the develop branch every three
+XTS is the eXtended Test Suite; this suite of tests is run against the latest commit on the main branch every three
hours (provided there is a new commit to run against).
MATS tests are inclusive of a series of unit tests and performance tests that must be executed against a PR branch prior
-to merging into develop. The MATS tests are intended to complete within a 30-minute time window to provide developers
+to merging into main. The MATS tests are intended to complete within a 30-minute time window to provide developers
with valuable insight of the impact of new code on the default branch.
XTS tests are run against the default branch once every three hours. These cover test cases that are unable to complete
@@ -38,14 +38,14 @@ There is an additional workflow: `ZXF: Extended Test Suite - Dry Run` which is a
`hashgraph/hedera-services` repository.
The XTS Dry-Run workflow runs a provided commit on any branch through the same XTS tests that would be run against the
-latest on develop every three hours. This workflow is run with a manual trigger and will execute in parallel to any
+latest on main every three hours. This workflow is run with a manual trigger and will execute in parallel to any
other actions ongoing in the `hashgraph/hedera-services` repository.
A developer can manually trigger a run using the parameters in the web UI:
```text
Use Workflow From
- Branch: develop # this should always be `develop`
+ Branch: main # this should always be `main`
The commit sha to check out
The branch name, for JRS Panel output
diff --git a/docs/glossary.md b/docs/glossary.md
index 929f3be8a125..b83eb5cc03c6 100644
--- a/docs/glossary.md
+++ b/docs/glossary.md
@@ -193,9 +193,9 @@ This file contains the address book to use when starting from genesis.
**Congestion Pricing**: A mechanism designed to manage network congestion by dynamically adjusting
transaction fees based on network demand. The primary goal of congestion pricing is to discourage
excessive network usage during peak times. Refer to
-[Congestion Pricing](https://github.com/hashgraph/hedera-services/blob/develop/hedera-node/docs/fees/automated-congestion-pricing.md)
+[Congestion Pricing](https://github.com/hashgraph/hedera-services/blob/main/hedera-node/docs/fees/automated-congestion-pricing.md)
and
-[Fees](https://github.com/hashgraph/hedera-services/blob/develop/hedera-node/docs/design/app/fees.md).
+[Fees](https://github.com/hashgraph/hedera-services/blob/main/hedera-node/docs/design/app/fees.md).
## Consensus Time
diff --git a/docs/maintainers-guide.md b/docs/maintainers-guide.md
index 755796a0bfa3..34502f5d0319 100644
--- a/docs/maintainers-guide.md
+++ b/docs/maintainers-guide.md
@@ -58,12 +58,10 @@ pattern for the development life cycle.
![gitflow-branching-model](./assets/gitflow-branching-model.png)
-Note especially the roles of the `main` and `develop` branches:
+Note especially the roles of the `main` branch:
-- `develop` is the default branch, the target of active development, and should at all times
+- `main` is the default branch, the target of active development, and should at all times
should be a viable candidate for the next release.
-- `main` is a tightly-controlled branch that release engineering uses for final tags deployed to
- production.
### Creating issues on GitHub
@@ -92,35 +90,34 @@ with 0.30 milestone on it.
![labels-on-issue](./assets/labels-on-issue.png)
-### Release Engineering Responsibilities
+### DevOps-CI Responsibilities
-The release engineering team will handle the following:
+The DevOps-CI team will handle the following:
-- Create a release branch from `develop` branch at the end of first sprint in the release cycle
-- Will merge the release branch for current deploying release into `main`
- Will provide automated release processes and coordinate release schedules
- Will handle production releases
+- Note: no release branch will be created
### User Stories
#### As a developer, I would like to create a branch to work on the feature for the upcoming release
-As per the development model, every developer should create a feature branch from `develop` branch
+As per the development model, every developer should create a feature branch from `main` branch
for working on a change targeted for the current release. The created branch should follow
[naming conventions](branch-naming-conventions.md).
-The `develop` branch should be up-to-date with all the features going into the next release.
+The `main` branch should be up-to-date with all the features going into the next release.
#### As a developer, I would like to create a branch to work on the feature NOT targeted for upcoming release
-As per the development model, every developer should create a feature branch to work from `develop`
+As per the development model, every developer should create a feature branch to work from `main`
branch. The created branch should follow [naming conventions](branch-naming-conventions.md). But,
-the feature branch should NOT be merged into `develop` until the decision is made if the feature is
+the feature branch should NOT be merged into `main` until the decision is made if the feature is
going into upcoming release.
#### As a developer, I would like to merge my feature branch or bug fix for the upcoming release
-Open a pull request (PR) from the feature branch to `develop` branch and add
+Open a pull request (PR) from the feature branch to `main` branch and add
`hashgraph/hedera-services-team` as reviewers.
Also add the following labels on the PR :
@@ -134,7 +131,7 @@ PR should be merged after an approving review and all the checks are passed.
NOTE:
1. Any feature that is not going into the upcoming release should stay in the feature branch and
- should not be merged to `develop`.
+ should not be merged to `main`.
2. Please use either the Gradle command line `./gradlew qualityGate` or the
[Google Java Format IntelliJ Plugin](https://github.com/google/google-java-format#intellij-android-studio-and-other-jetbrains-ides)
to format your code to avoid failing checks in CI pipeline.
@@ -146,14 +143,14 @@ Once the release branch is created, only bugfixes or hotfixes should be merged i
To do that, create a `hotfix` from the `release` branch. The created branch should follow
[naming conventions](branch-naming-conventions.md). Once the fix is in the branch, open a PR to the
release branch. Once the fix is merged into `release` branch, it should be cherry-picked into the
-`develop` branch.
+`main` branch.
#### As a developer, I would like to merge a bugfix/hotfix from the production code
To fix a bug from one of the previous releases(production code), create a hotfix branch from `main`.
Once the fix is in the branch, create a PR targeting to `main`. Once bugfix is merged into `main`and
it should be cherry-picked back into the current `release` branch(if the release branch is still
-open), and also into `develop`.
+open).
### DCO Sign Off
diff --git a/gradle/development-branch.txt b/gradle/development-branch.txt
deleted file mode 100644
index ce57f6456319..000000000000
--- a/gradle/development-branch.txt
+++ /dev/null
@@ -1 +0,0 @@
-develop
\ No newline at end of file
diff --git a/hedera-node/docs/design/app/workflows.md b/hedera-node/docs/design/app/workflows.md
index bab72146b5d2..b1532d5b6439 100644
--- a/hedera-node/docs/design/app/workflows.md
+++ b/hedera-node/docs/design/app/workflows.md
@@ -118,18 +118,18 @@ All the objects used while handling the transaction belong to one of the followi
Examples include the `NodeInfo` and `WorkingStateAccessor`.
- **UserTxnScope** - Objects that are created once for platform transaction.
Examples include the `Configuration`, `RecordListBuilder` and `TokenContext`.
-Dagger provides all the objects that can be constructed in this scope [here](https://github.com/hashgraph/hedera-services/tree/develop/hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/handle/flow/txn/modules)
-and [UserTxnComponent](https://github.com/hashgraph/hedera-services/blob/develop/hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/handle/flow/txn/UserTransactionComponent.java)
+Dagger provides all the objects that can be constructed in this scope [here](https://github.com/hashgraph/hedera-services/tree/main/hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/handle/flow/txn/modules)
+and [UserTxnComponent](https://github.com/hashgraph/hedera-services/blob/main/hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/handle/flow/txn/UserTransactionComponent.java)
takes all the inputs that are needed to execute the user transaction.
- **UserDispatchScope** - Objects that are created once for each user transaction that will be dispatched.
Examples include the `SingleTransactionRecordBuilder` for user transaction and `FeeContext`.
-Dagger provides all the objects that can be constructed in this scope in [UserDispatchModule](https://github.com/hashgraph/hedera-services/blob/develop/hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/handle/flow/dispatch/user/modules/UserDispatchModule.java) and `UserDispatchComponent`.
-and [UserDispatchComponent](https://github.com/hashgraph/hedera-services/blob/develop/hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/handle/flow/dispatch/user/UserDispatchComponent.java)
+Dagger provides all the objects that can be constructed in this scope in [UserDispatchModule](https://github.com/hashgraph/hedera-services/blob/main/hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/handle/flow/dispatch/user/modules/UserDispatchModule.java) and `UserDispatchComponent`.
+and [UserDispatchComponent](https://github.com/hashgraph/hedera-services/blob/main/hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/handle/flow/dispatch/user/UserDispatchComponent.java)
takes all the inputs that are needed to create the user dispatch.
- **ChildDispatchScope** - Objects that are created once for each child transaction dispatch.
Examples include the `ReadableStoreFactory` and `ChildFeeContext`.
-Dagger provides all the objects that can be constructed in the [ChildDispatchModule](https://github.com/hashgraph/hedera-services/blob/develop/hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/handle/flow/dispatch/child/modules/ChildDispatchModule.java)
-and [ChildDispatchComponent](https://github.com/hashgraph/hedera-services/blob/develop/hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/handle/flow/dispatch/child/ChildDispatchComponent.java)
+Dagger provides all the objects that can be constructed in the [ChildDispatchModule](https://github.com/hashgraph/hedera-services/blob/main/hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/handle/flow/dispatch/child/modules/ChildDispatchModule.java)
+and [ChildDispatchComponent](https://github.com/hashgraph/hedera-services/blob/main/hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/handle/flow/dispatch/child/ChildDispatchComponent.java)
takes all the inputs that are needed to create the child dispatch.
#### HandleWorkflow overview:
@@ -169,7 +169,7 @@ The overall high level steps are as follows:
The `DispatchProcessor.processDispatch` will be called for user and child dispatches. This avoids duplicating
any logic between user and child transactions, since both are treated as dispatches.
-For the child transactions, when a service calls one of the [dispatchXXXTransaction](https://github.com/hashgraph/hedera-services/blob/develop/hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/handle/flow/DispatchHandleContext.java#L459)
+For the child transactions, when a service calls one of the [dispatchXXXTransaction](https://github.com/hashgraph/hedera-services/blob/main/hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/handle/flow/DispatchHandleContext.java#L459)
methods in `DispatchHandleContext`, a new child dispatch is created and `DispatchProcessor.processDispatch` is called.
1. **Error Validation:** Checks if there is any error by node or user by re-assessing preHandleResult. It validates the following:
diff --git a/hedera-node/docs/design/services/smart-contract-service/cancun-fork-support.md b/hedera-node/docs/design/services/smart-contract-service/cancun-fork-support.md
index ddb829613f3a..6c546aceebf2 100644
--- a/hedera-node/docs/design/services/smart-contract-service/cancun-fork-support.md
+++ b/hedera-node/docs/design/services/smart-contract-service/cancun-fork-support.md
@@ -36,7 +36,7 @@ Generally speaking there are four strategies that will be used:
specifications change (e.g., `SELFDESTRUCT`)
* As a Hedera developer, I want to preserve maximum future design space to adopt, or not adopt, blobs.
* As an end user, I want prompt and accurate failures if I attempt to use Blob features in Hedera.
- * And as a smart contract develop I want attempts to _use_ internal blob-support features (e.g.,
+ * And as a smart contract developer I want attempts to _use_ internal blob-support features (e.g.,
opcodes `VERSIONEDHASH` and `BLOBBASEFEE`) to behave in a predictable manner
## Goals
diff --git a/hedera-node/docs/design/services/smart-contract-service/contract-accounts-nonces.md b/hedera-node/docs/design/services/smart-contract-service/contract-accounts-nonces.md
index 311a0b10e552..ae65ca89e953 100644
--- a/hedera-node/docs/design/services/smart-contract-service/contract-accounts-nonces.md
+++ b/hedera-node/docs/design/services/smart-contract-service/contract-accounts-nonces.md
@@ -28,13 +28,13 @@ The following is a table with general use cases and behavior for Ethereum and He
| Contract transaction resulting in `CREATE/CREATE2` (`ContractCall` or `ContractCreate`) | - | initial contract nonce value is 1; nonce is incremented for each contract creation initiated by an account, updates are not externalized to Mirror Node | initial contract nonce value is 1; nonce is incremented for each contract creation initiated by an account, updates are externalized to Mirror Node |
### Contract Nonce Externalization
-- We keep a `ContractId -> nonce` tree map inside [HederaWorldState](https://github.com/hashgraph/hedera-services/blob/develop/hedera-node/hedera-mono-service/src/main/java/com/hedera/node/app/service/mono/store/contracts/HederaWorldState.java#L79), it is updated on each call of `commit()` (using newly added method `trackContractNonces()`).
-- Method `trackContractNonces` in [HederaWorldState](https://github.com/hashgraph/hedera-services/blob/develop/hedera-node/hedera-mono-service/src/main/java/com/hedera/node/app/service/mono/store/contracts/HederaWorldState.java#L393) follows the pattern of `trackNewlyCreatedAccounts`.
+- We keep a `ContractId -> nonce` tree map inside [HederaWorldState](https://github.com/hashgraph/hedera-services/blob/main/hedera-node/hedera-mono-service/src/main/java/com/hedera/node/app/service/mono/store/contracts/HederaWorldState.java#L79), it is updated on each call of `commit()` (using newly added method `trackContractNonces()`).
+- Method `trackContractNonces` in [HederaWorldState](https://github.com/hashgraph/hedera-services/blob/main/hedera-node/hedera-mono-service/src/main/java/com/hedera/node/app/service/mono/store/contracts/HederaWorldState.java#L393) follows the pattern of `trackNewlyCreatedAccounts`.
- Checks if an account is a new smart contract and externalizes its nonce.
- Checks if an existing smart contract's nonce is updated and externalizes it.
-- Added a `ContractId -> nonce` tree map inside [TransactionProcessingResult](https://github.com/hashgraph/hedera-services/blob/develop/hedera-node/hedera-mono-service/src/main/java/com/hedera/node/app/service/mono/contracts/execution/TransactionProcessingResult.java#L45).
-- Persists account contract nonces into state in [ContractCreateTransitionLogic](https://github.com/hashgraph/hedera-services/blob/develop/hedera-node/hedera-mono-service/src/main/java/com/hedera/node/app/service/mono/txns/contract/ContractCreateTransitionLogic.java#L209) and [ContractCallTransitionLogic](https://github.com/hashgraph/hedera-services/blob/develop/hedera-node/hedera-mono-service/src/main/java/com/hedera/node/app/service/mono/txns/contract/ContractCallTransitionLogic.java#L148) using `setContractNonces` from `TransactionProcessingResult`.
-- Created new [ContractNonceInfo](https://github.com/hashgraph/hedera-services/blob/develop/hedera-node/hedera-mono-service/src/main/java/com/hedera/node/app/service/mono/state/submerkle/ContractNonceInfo.java) submerkle class with two main entities - `contractId` and `nonce`
+- Added a `ContractId -> nonce` tree map inside [TransactionProcessingResult](https://github.com/hashgraph/hedera-services/blob/main/hedera-node/hedera-mono-service/src/main/java/com/hedera/node/app/service/mono/contracts/execution/TransactionProcessingResult.java#L45).
+- Persists account contract nonces into state in [ContractCreateTransitionLogic](https://github.com/hashgraph/hedera-services/blob/main/hedera-node/hedera-mono-service/src/main/java/com/hedera/node/app/service/mono/txns/contract/ContractCreateTransitionLogic.java#L209) and [ContractCallTransitionLogic](https://github.com/hashgraph/hedera-services/blob/main/hedera-node/hedera-mono-service/src/main/java/com/hedera/node/app/service/mono/txns/contract/ContractCallTransitionLogic.java#L148) using `setContractNonces` from `TransactionProcessingResult`.
+- Created new [ContractNonceInfo](https://github.com/hashgraph/hedera-services/blob/main/hedera-node/hedera-mono-service/src/main/java/com/hedera/node/app/service/mono/state/submerkle/ContractNonceInfo.java) submerkle class with two main entities - `contractId` and `nonce`
- Added new method `serializableContractNoncesFrom` in [EvmFnResult](https://github.com/hashgraph/hedera-services/blob/96a85f0e08f82582bbf25328d14ca90fc630c5ef/hedera-node/hedera-mono-service/src/main/java/com/hedera/node/app/service/mono/state/submerkle/EvmFnResult.java) that builds `List` (submerkle) from `Map`
- Added new verison `7` (`RELEASE_0400_VERSION`) and externalized logic for `serialize` and `deserialize` of `contractNonces` in `EvmFnResult`
diff --git a/hedera-node/docs/dev/JRS-GettingStarted.md b/hedera-node/docs/dev/JRS-GettingStarted.md
index 9a4d8c604994..3fb9ec19dc4d 100644
--- a/hedera-node/docs/dev/JRS-GettingStarted.md
+++ b/hedera-node/docs/dev/JRS-GettingStarted.md
@@ -127,7 +127,7 @@ Providing very long `name` will cause failure to create instances.
## **Naming Conventions for the JSONs**
-Naming conventions described in [file](https://github.com/swirlds/swirlds-platform-regression/blob/develop/docs/regression-test-naming-standards.md) are required to be followed for both types of configuration JSONs.
+Naming conventions described in [file](https://github.com/swirlds/swirlds-platform-regression/blob/main/docs/regression-test-naming-standards.md) are required to be followed for both types of configuration JSONs.
Any new naming conventions need to be added to the file if required, after seeking approval from the code owners in `swirlds-platform-regression` repository.
@@ -167,7 +167,7 @@ Current Services nightly regression runs the following tests based on the cron t
All the above tests are under the following path `swirlds-platform/regression/configs/services/suites` under `daily` or `weekly` with appropriate names.
-**NOTE** : To validate the regression results follow steps defined in [regression-validation-checklist.md](https://github.com/swirlds/swirlds-platform-regression/blob/develop/docs/regression-validation-checklist.md).
+**NOTE** : To validate the regression results follow steps defined in [regression-validation-checklist.md](https://github.com/swirlds/swirlds-platform-regression/blob/main/docs/regression-validation-checklist.md).
diff --git a/hedera-node/hedera-app/src/main/java/com/hedera/node/app/Hedera.java b/hedera-node/hedera-app/src/main/java/com/hedera/node/app/Hedera.java
index ac8a769a966d..0adf358ddf9b 100644
--- a/hedera-node/hedera-app/src/main/java/com/hedera/node/app/Hedera.java
+++ b/hedera-node/hedera-app/src/main/java/com/hedera/node/app/Hedera.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022-2024 Hedera Hashgraph, LLC
+ * Copyright (C) 2024 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -133,7 +133,6 @@
import com.swirlds.platform.listeners.ReconnectCompleteListener;
import com.swirlds.platform.listeners.ReconnectCompleteNotification;
import com.swirlds.platform.listeners.StateWriteToDiskCompleteListener;
-import com.swirlds.platform.state.MerkleRoot;
import com.swirlds.platform.state.PlatformMerkleStateRoot;
import com.swirlds.platform.state.service.PlatformStateService;
import com.swirlds.platform.state.service.ReadablePlatformStateStore;
@@ -505,7 +504,7 @@ public SoftwareVersion getSoftwareVersion() {
*/
@Override
@NonNull
- public MerkleRoot newMerkleStateRoot() {
+ public PlatformMerkleStateRoot newMerkleStateRoot() {
return stateRootSupplier.get();
}
diff --git a/hedera-node/hedera-app/src/main/java/com/hedera/node/app/ServicesMain.java b/hedera-node/hedera-app/src/main/java/com/hedera/node/app/ServicesMain.java
index 53ad26d55c1b..a778dd859f6d 100644
--- a/hedera-node/hedera-app/src/main/java/com/hedera/node/app/ServicesMain.java
+++ b/hedera-node/hedera-app/src/main/java/com/hedera/node/app/ServicesMain.java
@@ -75,7 +75,6 @@
import com.swirlds.platform.crypto.CryptoStatic;
import com.swirlds.platform.roster.RosterHistory;
import com.swirlds.platform.roster.RosterUtils;
-import com.swirlds.platform.state.MerkleRoot;
import com.swirlds.platform.state.PlatformMerkleStateRoot;
import com.swirlds.platform.state.address.AddressBookInitializer;
import com.swirlds.platform.state.service.ReadableRosterStore;
@@ -145,7 +144,7 @@ public void init(@NonNull final Platform platform, @NonNull final NodeId nodeId)
* {@inheritDoc}
*/
@Override
- public @NonNull MerkleRoot newMerkleStateRoot() {
+ public @NonNull PlatformMerkleStateRoot newMerkleStateRoot() {
return hederaOrThrow().newMerkleStateRoot();
}
@@ -272,7 +271,7 @@ public static void main(final String... args) throws Exception {
version,
() -> {
isGenesis.set(true);
- final var genesisState = (PlatformMerkleStateRoot) hedera.newMerkleStateRoot();
+ final var genesisState = hedera.newMerkleStateRoot();
final var genesisNetwork = DiskStartupNetworks.fromLegacyAddressBook(diskAddressBook);
hedera.initializeStatesApi(
genesisState,
@@ -289,17 +288,12 @@ public static void main(final String... args) throws Exception {
final var initialState = reservedState.state();
if (!isGenesis.get()) {
hedera.initializeStatesApi(
- (PlatformMerkleStateRoot) initialState.get().getState().getSwirldState(),
- metrics,
- InitTrigger.RESTART,
- null,
- platformConfig,
- diskAddressBook);
+ initialState.get().getState(), metrics, InitTrigger.RESTART, null, platformConfig, diskAddressBook);
}
hedera.setInitialStateHash(reservedState.hash());
// --- Now build the platform and start it ---
- final var stateRoot = (PlatformMerkleStateRoot) initialState.get().getState();
+ final var stateRoot = initialState.get().getState();
final RosterHistory rosterHistory;
if (hedera.isRosterLifecycleEnabled()) {
final var rosterStore = new ReadableStoreFactory(stateRoot).getStore(ReadableRosterStore.class);
@@ -466,7 +460,7 @@ private static HashedReservedSignedState loadInitialState(
@NonNull final Configuration configuration,
@NonNull final RecycleBin recycleBin,
@NonNull final SoftwareVersion softwareVersion,
- @NonNull final Supplier stateRootSupplier,
+ @NonNull final Supplier stateRootSupplier,
@NonNull final String mainClassName,
@NonNull final String swirldName,
@NonNull final NodeId selfId) {
diff --git a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/state/merkle/SerializationTest.java b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/state/merkle/SerializationTest.java
index e0576d1b7c2e..9194fff928ea 100644
--- a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/state/merkle/SerializationTest.java
+++ b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/state/merkle/SerializationTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2023-2024 Hedera Hashgraph, LLC
+ * Copyright (C) 2024 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -326,7 +326,7 @@ private PlatformMerkleStateRoot createMerkleHederaState(Schema schemaV1) {
final SignedState randomState =
new RandomSignedStateGenerator().setRound(1).build();
- final var originalTree = (PlatformMerkleStateRoot) randomState.getState();
+ final var originalTree = randomState.getState();
final var originalRegistry =
new MerkleSchemaRegistry(registry, FIRST_SERVICE, DEFAULT_CONFIG, new SchemaApplications());
originalRegistry.register(schemaV1);
diff --git a/hedera-node/infrastructure/docker/containers/production-next/consensus-node/Dockerfile b/hedera-node/infrastructure/docker/containers/production-next/consensus-node/Dockerfile
index 94d8bc1ef2f6..c165fed92372 100644
--- a/hedera-node/infrastructure/docker/containers/production-next/consensus-node/Dockerfile
+++ b/hedera-node/infrastructure/docker/containers/production-next/consensus-node/Dockerfile
@@ -227,8 +227,6 @@ ENV JAVA_VERSION "jdk-21.0.4+7"
ENV JAVA_HOME /usr/local/java
ENV PATH ${JAVA_HOME}/bin:${PATH}
-ENV CONTAINER_TSR_ENABLED "true"
-
# Install Java
COPY --from=java-builder ${JAVA_HOME}/ ${JAVA_HOME}/
@@ -285,6 +283,10 @@ ENV MALLOC_ARENA_MAX 4
# Log Folder Name Override
ENV LOG_DIR_NAME ""
+# If "true" or an integer between 1 & 2^63-1 after running consensus entrypoint.sh will block indefinitely.
+# Otherwise entrypoint.sh will return the exit code from consensus.
+ENV CONTAINER_TSR_ENABLED "false"
+
# Define Volume Bindpoints
VOLUME "/opt/hgcapp/accountBalances"
VOLUME "/opt/hgcapp/eventsStreams"
diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/junit/support/validators/block/StateChangesValidator.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/junit/support/validators/block/StateChangesValidator.java
index b9250731dfaa..6bfd3b0ba426 100644
--- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/junit/support/validators/block/StateChangesValidator.java
+++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/junit/support/validators/block/StateChangesValidator.java
@@ -1,4 +1,19 @@
-// SPDX-License-Identifier: Apache-2.0
+/*
+ * Copyright (C) 2024 Hedera Hashgraph, LLC
+ *
+ * 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.
+ */
+
package com.hedera.services.bdd.junit.support.validators.block;
import static com.hedera.node.app.blocks.impl.BlockImplUtils.combine;
@@ -191,7 +206,7 @@ public StateChangesValidator(
final var addressBook = loadLegacyBookWithGeneratedCerts(pathToAddressBook);
final var metrics = new NoOpMetrics();
final var hedera = ServicesMain.newHedera(NodeId.of(0L), metrics);
- this.state = (PlatformMerkleStateRoot) hedera.newMerkleStateRoot();
+ this.state = hedera.newMerkleStateRoot();
final var platformConfig = ServicesMain.buildPlatformConfig();
hedera.initializeStatesApi(
state,
diff --git a/platform-sdk/README.md b/platform-sdk/README.md
index 55ae640891fb..52919c105e2a 100644
--- a/platform-sdk/README.md
+++ b/platform-sdk/README.md
@@ -46,7 +46,7 @@ Portions of this Hedera Hashgraph, LLC Software may utilize the following copyri
use of which is hereby acknowledged.
The full list of acknowledgements is available at
-[https://github.com/hashgraph/hedera-services/raw/develop/platform-sdk/sdk/docs/acknowledgments.html](sdk/docs/acknowledgments.html)
+[https://github.com/hashgraph/hedera-services/raw/main/platform-sdk/sdk/docs/acknowledgments.html](sdk/docs/acknowledgments.html)
## License
diff --git a/platform-sdk/description.txt b/platform-sdk/description.txt
index 90ec8bd24256..c8bb0806c141 100644
--- a/platform-sdk/description.txt
+++ b/platform-sdk/description.txt
@@ -1,3 +1,3 @@
-Swirlds is a software platform designed to build fully-distributed applications that harness the power of the cloud
+Hedera Hashgraph is a software platform designed to build fully-distributed applications that harness the power of the cloud
without servers. Now you can develop applications with fairness in decision making, speed, trust and reliability, at
a fraction of the cost of traditional server-based platforms.
diff --git a/platform-sdk/docs/core/address-book-management.md b/platform-sdk/docs/core/address-book-management.md
index c0f70b980a71..08acda44ffed 100644
--- a/platform-sdk/docs/core/address-book-management.md
+++ b/platform-sdk/docs/core/address-book-management.md
@@ -3,7 +3,7 @@
## WIP
The address book management pipeline is currently a work in progress.
-This document reflects the address book pipeline as we want it to be, not necessarily as it is in `develop` today.
+This document reflects the address book pipeline as we want it to be, not necessarily as it is in `main` today.
## Summary
diff --git a/platform-sdk/docs/core/wiring-diagram.svg b/platform-sdk/docs/core/wiring-diagram.svg
index 1e314abde54d..098ffc251b92 100644
--- a/platform-sdk/docs/core/wiring-diagram.svg
+++ b/platform-sdk/docs/core/wiring-diagram.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/platform-sdk/docs/proposals/README.md b/platform-sdk/docs/proposals/README.md
index a11874f047ab..f421e5e234a2 100644
--- a/platform-sdk/docs/proposals/README.md
+++ b/platform-sdk/docs/proposals/README.md
@@ -128,7 +128,7 @@ to `Withdrawn` and closed.
## Delivery of A Proposal
-Once an accepted proposal has been completely implemented, tested, the code merged into `develop`, and the feature is
+Once an accepted proposal has been completely implemented, tested, the code merged into `main`, and the feature is
planned to be enabled for production, the proposal's content should be merged with the documentation of the platform
in `platform-sdk/docs` (or other relevant location such as `module-info.java`), as applicable, and removed
from `platform-sdk/docs/proposals`. Once the feature is live on mainnet, the status of the proposal PR in the proposal
diff --git a/platform-sdk/docs/proposals/metric-labels/README.md b/platform-sdk/docs/proposals/metric-labels/README.md
index b61074586088..f27b61e7e460 100644
--- a/platform-sdk/docs/proposals/metric-labels/README.md
+++ b/platform-sdk/docs/proposals/metric-labels/README.md
@@ -227,7 +227,7 @@ interface MetricsFactory {
}
```
-The definition of the api should follow our rules regarding services as defined at https://github.com/hashgraph/hedera-services/blob/develop/platform-sdk/docs/base/service-architecture/service-architecture.md
+The definition of the api should follow our rules regarding services as defined at https://github.com/hashgraph/hedera-services/blob/main/platform-sdk/docs/base/service-architecture/service-architecture.md
##### Examples
diff --git a/platform-sdk/swirlds-common/src/main/java/com/swirlds/common/wiring/model/diagram/HyperlinkBuilder.java b/platform-sdk/swirlds-common/src/main/java/com/swirlds/common/wiring/model/diagram/HyperlinkBuilder.java
index 73f6afa65374..20b74254b1d9 100644
--- a/platform-sdk/swirlds-common/src/main/java/com/swirlds/common/wiring/model/diagram/HyperlinkBuilder.java
+++ b/platform-sdk/swirlds-common/src/main/java/com/swirlds/common/wiring/model/diagram/HyperlinkBuilder.java
@@ -19,15 +19,15 @@
import edu.umd.cs.findbugs.annotations.NonNull;
/**
- * Given a class, derive a hyperlink to the github for that class's source code (in develop).
+ * Given a class, derive a hyperlink to the github for that class's source code (in main).
*/
public final class HyperlinkBuilder {
- public static final String PLATFORM_CORE_ROOT = "https://github.com/hashgraph/hedera-services/blob/develop/"
+ public static final String PLATFORM_CORE_ROOT = "https://github.com/hashgraph/hedera-services/blob/main/"
+ "platform-sdk/swirlds-platform-core/src/main/java";
public static final String PLATFORM_COMMON_ROOT =
- "https://github.com/hashgraph/hedera-services/blob/develop/platform-sdk/swirlds-common/src/main/java";
+ "https://github.com/hashgraph/hedera-services/blob/main/platform-sdk/swirlds-common/src/main/java";
/**
* Build a hyperlink to the platform core source code for the given class. Only works for things in the core
@@ -52,7 +52,7 @@ public static String platformCommonHyperlink(@NonNull final Class> clazz) {
}
/**
- * Get a github hyperlink to this class (in develop).
+ * Get a github hyperlink to this class (in main).
*
* @param clazz the class
* @return the hyperlink
diff --git a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/ReconnectStateLoader.java b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/ReconnectStateLoader.java
index b5b4448f4470..944ef5e116b6 100644
--- a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/ReconnectStateLoader.java
+++ b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/ReconnectStateLoader.java
@@ -39,7 +39,6 @@
import com.swirlds.platform.system.status.actions.ReconnectCompleteAction;
import com.swirlds.platform.wiring.PlatformWiring;
import com.swirlds.state.State;
-import com.swirlds.state.merkle.MerkleStateRoot;
import edu.umd.cs.findbugs.annotations.NonNull;
import java.util.Objects;
import org.apache.logging.log4j.LogManager;
@@ -118,7 +117,7 @@ public void loadReconnectState(@NonNull final SignedState signedState) {
}
// Before attempting to load the state, verify that the platform roster matches the state roster.
- final State state = (MerkleStateRoot>) signedState.getState().getSwirldState();
+ final State state = signedState.getState();
final Roster stateRoster = RosterRetriever.retrieveActiveOrGenesisRoster(state);
if (!roster.equals(stateRoster)) {
throw new IllegalStateException("Current roster and state-based roster do not contain the same nodes "
@@ -170,9 +169,7 @@ public void loadReconnectState(@NonNull final SignedState signedState) {
.getNotifierWiring()
.getInputWire(AppNotifier::sendReconnectCompleteNotification)
.put(new ReconnectCompleteNotification(
- signedState.getRound(),
- signedState.getConsensusTimestamp(),
- signedState.getState().getSwirldState()));
+ signedState.getRound(), signedState.getConsensusTimestamp(), signedState.getState()));
} catch (final RuntimeException e) {
logger.debug(RECONNECT.getMarker(), "`loadReconnectState` : FAILED, reason: {}", e.getMessage());
diff --git a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/StateInitializer.java b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/StateInitializer.java
index 743639e48fd4..8db8764cbaeb 100644
--- a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/StateInitializer.java
+++ b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/StateInitializer.java
@@ -25,7 +25,7 @@
import com.swirlds.common.context.PlatformContext;
import com.swirlds.common.merkle.crypto.MerkleCryptoFactory;
import com.swirlds.platform.config.StateConfig;
-import com.swirlds.platform.state.MerkleRoot;
+import com.swirlds.platform.state.PlatformMerkleStateRoot;
import com.swirlds.platform.state.signed.SignedState;
import com.swirlds.platform.system.InitTrigger;
import com.swirlds.platform.system.Platform;
@@ -70,18 +70,18 @@ public static void initializeState(
trigger = RESTART;
}
- final MerkleRoot initialState = signedState.getState();
+ final PlatformMerkleStateRoot initialState = signedState.getState();
// Although the state from disk / genesis state is initially hashed, we are actually dealing with a copy
// of that state here. That copy should have caused the hash to be cleared.
if (initialState.getHash() != null) {
throw new IllegalStateException("Expected initial state to be unhashed");
}
- if (initialState.getSwirldState().getHash() != null) {
+ if (initialState.getHash() != null) {
throw new IllegalStateException("Expected initial swirld state to be unhashed");
}
- initialState.getSwirldState().init(platform, trigger, previousSoftwareVersion);
+ initialState.init(platform, trigger, previousSoftwareVersion);
abortAndThrowIfInterrupted(
() -> {
diff --git a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/SwirldsPlatform.java b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/SwirldsPlatform.java
index 8ed09fafd540..3363353ec5e0 100644
--- a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/SwirldsPlatform.java
+++ b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/SwirldsPlatform.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016-2024 Hedera Hashgraph, LLC
+ * Copyright (C) 2024 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -58,7 +58,7 @@
import com.swirlds.platform.pool.TransactionPoolNexus;
import com.swirlds.platform.publisher.DefaultPlatformPublisher;
import com.swirlds.platform.publisher.PlatformPublisher;
-import com.swirlds.platform.state.MerkleRoot;
+import com.swirlds.platform.state.PlatformMerkleStateRoot;
import com.swirlds.platform.state.PlatformStateAccessor;
import com.swirlds.platform.state.SwirldStateManager;
import com.swirlds.platform.state.nexus.DefaultLatestCompleteStateNexus;
@@ -365,7 +365,7 @@ private BirthRoundMigrationShim buildBirthRoundMigrationShim(
return null;
}
- final MerkleRoot state = initialState.getState();
+ final PlatformMerkleStateRoot state = initialState.getState();
final PlatformStateAccessor platformState = state.getReadablePlatformState();
return new DefaultBirthRoundMigrationShim(
@@ -515,6 +515,6 @@ public AutoCloseableWrapper getLatestImmutableState(@
final ReservedSignedState wrapper = latestImmutableStateNexus.getState(reason);
return wrapper == null
? AutoCloseableWrapper.empty()
- : new AutoCloseableWrapper<>((T) wrapper.get().getState().getSwirldState(), wrapper::close);
+ : new AutoCloseableWrapper<>((T) wrapper.get().getState(), wrapper::close);
}
}
diff --git a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/cli/GenesisPlatformStateCommand.java b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/cli/GenesisPlatformStateCommand.java
index 4606b861ed51..88566146dc68 100644
--- a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/cli/GenesisPlatformStateCommand.java
+++ b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/cli/GenesisPlatformStateCommand.java
@@ -95,7 +95,7 @@ public Integer call() throws IOException, ExecutionException, InterruptedExcepti
});
{
System.out.printf("Resetting the RosterService state %n");
- final State state = (State) reservedSignedState.get().getState().getSwirldState();
+ final State state = reservedSignedState.get().getState();
final WritableStates writableStates = state.getWritableStates(RosterStateId.NAME);
final WritableRosterStore writableRosterStore = new WritableRosterStore(writableStates);
writableRosterStore.resetRosters();
diff --git a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/cli/JrsTestReaderReportCommand.java b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/cli/JrsTestReaderReportCommand.java
index d1aa66743ff4..a3e96840f9dc 100644
--- a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/cli/JrsTestReaderReportCommand.java
+++ b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/cli/JrsTestReaderReportCommand.java
@@ -185,9 +185,9 @@ private static Path autoGenerateOutputDirectoryName(@NonNull final String target
@Override
public Integer call() {
- // if no targets were specified, then default to the develop branch
+ // if no targets were specified, then default to the main branch
if (targets == null) {
- targets = List.of("develop");
+ targets = List.of("main");
}
final Map metadata = JtrUtils.getTestMetadata(metadataFile);
diff --git a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/cli/ValidateAddressBookStateCommand.java b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/cli/ValidateAddressBookStateCommand.java
index 7b4b53bfd771..43be509a695d 100644
--- a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/cli/ValidateAddressBookStateCommand.java
+++ b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/cli/ValidateAddressBookStateCommand.java
@@ -31,7 +31,6 @@
import com.swirlds.platform.system.address.AddressBookUtils;
import com.swirlds.platform.system.address.AddressBookValidator;
import com.swirlds.platform.util.BootstrapUtils;
-import com.swirlds.state.State;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -81,7 +80,7 @@ public Integer call() throws IOException, ExecutionException, InterruptedExcepti
try (final ReservedSignedState reservedSignedState = deserializedSignedState.reservedSignedState()) {
System.out.printf("Extracting the state address book for comparison %n");
stateAddressBook = RosterUtils.buildAddressBook(RosterRetriever.retrieveActiveOrGenesisRoster(
- (State) reservedSignedState.get().getState().getSwirldState()));
+ reservedSignedState.get().getState()));
}
System.out.printf("Validating address book %n");
diff --git a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/eventhandling/DefaultTransactionHandler.java b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/eventhandling/DefaultTransactionHandler.java
index 12e36f6ae397..c01d2b661f9c 100644
--- a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/eventhandling/DefaultTransactionHandler.java
+++ b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/eventhandling/DefaultTransactionHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016-2024 Hedera Hashgraph, LLC
+ * Copyright (C) 2024 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,7 +38,7 @@
import com.swirlds.platform.event.PlatformEvent;
import com.swirlds.platform.internal.ConsensusRound;
import com.swirlds.platform.metrics.RoundHandlingMetrics;
-import com.swirlds.platform.state.MerkleRoot;
+import com.swirlds.platform.state.PlatformMerkleStateRoot;
import com.swirlds.platform.state.PlatformStateModifier;
import com.swirlds.platform.state.SwirldStateManager;
import com.swirlds.platform.state.signed.ReservedSignedState;
@@ -282,7 +282,7 @@ private StateAndRound createSignedState(
swirldStateManager.sealConsensusRound(consensusRound);
handlerMetrics.setPhase(GETTING_STATE_TO_SIGN);
- final MerkleRoot immutableStateCons = swirldStateManager.getStateForSigning();
+ final PlatformMerkleStateRoot immutableStateCons = swirldStateManager.getStateForSigning();
handlerMetrics.setPhase(CREATING_SIGNED_STATE);
final SignedState signedState = new SignedState(
diff --git a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/reconnect/ReconnectHelper.java b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/reconnect/ReconnectHelper.java
index 2268e509265a..5fefc4912583 100644
--- a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/reconnect/ReconnectHelper.java
+++ b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/reconnect/ReconnectHelper.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022-2024 Hedera Hashgraph, LLC
+ * Copyright (C) 2024 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,7 +25,7 @@
import com.swirlds.logging.legacy.payload.ReconnectStartPayload;
import com.swirlds.platform.config.StateConfig;
import com.swirlds.platform.network.Connection;
-import com.swirlds.platform.state.MerkleRoot;
+import com.swirlds.platform.state.PlatformMerkleStateRoot;
import com.swirlds.platform.state.signed.ReservedSignedState;
import com.swirlds.platform.state.signed.SignedState;
import com.swirlds.platform.state.signed.SignedStateValidator;
@@ -51,7 +51,7 @@ public class ReconnectHelper {
/** clears all data that is no longer needed since we fell behind */
private final Clearable clearAll;
/** supplier of the initial signed state against which to perform a delta based reconnect */
- private final Supplier workingStateSupplier;
+ private final Supplier workingStateSupplier;
/** provides the latest signed state round for which we have a supermajority of signatures */
private final LongSupplier lastCompleteRoundSupplier;
/** throttles reconnect learner attempts */
@@ -66,7 +66,7 @@ public class ReconnectHelper {
public ReconnectHelper(
final Runnable pauseGossip,
final Clearable clearAll,
- final Supplier workingStateSupplier,
+ final Supplier workingStateSupplier,
final LongSupplier lastCompleteRoundSupplier,
final ReconnectLearnerThrottle reconnectLearnerThrottle,
final Consumer loadSignedState,
diff --git a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/reconnect/ReconnectLearner.java b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/reconnect/ReconnectLearner.java
index c92a02a0f808..67a2b6c4459b 100644
--- a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/reconnect/ReconnectLearner.java
+++ b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/reconnect/ReconnectLearner.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016-2024 Hedera Hashgraph, LLC
+ * Copyright (C) 2024 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,7 +30,7 @@
import com.swirlds.platform.crypto.CryptoStatic;
import com.swirlds.platform.metrics.ReconnectMetrics;
import com.swirlds.platform.network.Connection;
-import com.swirlds.platform.state.MerkleRoot;
+import com.swirlds.platform.state.PlatformMerkleStateRoot;
import com.swirlds.platform.state.signed.ReservedSignedState;
import com.swirlds.platform.state.signed.SigSet;
import com.swirlds.platform.state.signed.SignedState;
@@ -57,7 +57,7 @@ public class ReconnectLearner {
private final Connection connection;
private final Roster roster;
- private final MerkleRoot currentState;
+ private final PlatformMerkleStateRoot currentState;
private final Duration reconnectSocketTimeout;
private final ReconnectMetrics statistics;
private final SignedStateValidationData stateValidationData;
@@ -89,7 +89,7 @@ public ReconnectLearner(
@NonNull final ThreadManager threadManager,
@NonNull final Connection connection,
@NonNull final Roster roster,
- @NonNull final MerkleRoot currentState,
+ @NonNull final PlatformMerkleStateRoot currentState,
@NonNull final Duration reconnectSocketTimeout,
@NonNull final ReconnectMetrics statistics) {
@@ -204,7 +204,7 @@ private ReservedSignedState reconnect() throws InterruptedException {
platformContext.getMetrics());
synchronizer.synchronize();
- final MerkleRoot state = (MerkleRoot) synchronizer.getRoot();
+ final PlatformMerkleStateRoot state = (PlatformMerkleStateRoot) synchronizer.getRoot();
final SignedState newSignedState = new SignedState(
platformContext.getConfiguration(),
CryptoStatic::verifySignature,
diff --git a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/reconnect/ReconnectLearnerFactory.java b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/reconnect/ReconnectLearnerFactory.java
index ea1bb9342d0a..47fe3b7bfb34 100644
--- a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/reconnect/ReconnectLearnerFactory.java
+++ b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/reconnect/ReconnectLearnerFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016-2024 Hedera Hashgraph, LLC
+ * Copyright (C) 2024 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,7 +21,7 @@
import com.swirlds.common.threading.manager.ThreadManager;
import com.swirlds.platform.metrics.ReconnectMetrics;
import com.swirlds.platform.network.Connection;
-import com.swirlds.platform.state.MerkleRoot;
+import com.swirlds.platform.state.PlatformMerkleStateRoot;
import edu.umd.cs.findbugs.annotations.NonNull;
import java.time.Duration;
import java.util.Objects;
@@ -63,7 +63,7 @@ public ReconnectLearnerFactory(
* @param workingState the state to use to perform a delta based reconnect
* @return a new instance
*/
- public ReconnectLearner create(final Connection conn, final MerkleRoot workingState) {
+ public ReconnectLearner create(final Connection conn, final PlatformMerkleStateRoot workingState) {
return new ReconnectLearner(
platformContext, threadManager, conn, roster, workingState, reconnectSocketTimeout, statistics);
}
diff --git a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/reconnect/ReconnectUtils.java b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/reconnect/ReconnectUtils.java
index 4a02423aca51..7a187fd6976f 100644
--- a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/reconnect/ReconnectUtils.java
+++ b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/reconnect/ReconnectUtils.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022-2024 Hedera Hashgraph, LLC
+ * Copyright (C) 2024 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,7 +21,7 @@
import com.swirlds.common.merkle.crypto.MerkleCryptoFactory;
import com.swirlds.logging.legacy.payload.ReconnectFailurePayload;
import com.swirlds.platform.network.Connection;
-import com.swirlds.platform.state.MerkleRoot;
+import com.swirlds.platform.state.PlatformMerkleStateRoot;
import edu.umd.cs.findbugs.annotations.NonNull;
import java.io.IOException;
import java.util.concurrent.ExecutionException;
@@ -60,7 +60,7 @@ static void endReconnectHandshake(@NonNull final Connection connection) throws I
/**
* Hash the working state to prepare for reconnect
*/
- static void hashStateForReconnect(final MerkleRoot workingState) {
+ static void hashStateForReconnect(final PlatformMerkleStateRoot workingState) {
try {
MerkleCryptoFactory.getInstance().digestTreeAsync(workingState).get();
} catch (final ExecutionException e) {
diff --git a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/recovery/EventRecoveryWorkflow.java b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/recovery/EventRecoveryWorkflow.java
index 5acb363bb1fe..a9e67fc85656 100644
--- a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/recovery/EventRecoveryWorkflow.java
+++ b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/recovery/EventRecoveryWorkflow.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016-2024 Hedera Hashgraph, LLC
+ * Copyright (C) 2024 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -52,7 +52,7 @@
import com.swirlds.platform.recovery.internal.RecoveredState;
import com.swirlds.platform.recovery.internal.RecoveryPlatform;
import com.swirlds.platform.recovery.internal.StreamedRound;
-import com.swirlds.platform.state.MerkleRoot;
+import com.swirlds.platform.state.PlatformMerkleStateRoot;
import com.swirlds.platform.state.PlatformStateAccessor;
import com.swirlds.platform.state.PlatformStateModifier;
import com.swirlds.platform.state.signed.ReservedSignedState;
@@ -185,7 +185,7 @@ public static void recoverState(
resultingStateDirectory);
// Make one more copy to force the state in recoveredState to be immutable.
- final MerkleRoot mutableStateCopy =
+ final PlatformMerkleStateRoot mutableStateCopy =
recoveredState.state().get().getState().copy();
SignedStateFileWriter.writeSignedStateFilesToDirectory(
@@ -376,7 +376,7 @@ private static ReservedSignedState handleNextRound(
final Instant currentRoundTimestamp = getRoundTimestamp(round);
previousState.get().getState().throwIfImmutable();
- final MerkleRoot newState = previousState.get().getState().copy();
+ final PlatformMerkleStateRoot newState = previousState.get().getState().copy();
final PlatformEvent lastEvent = ((CesEvent) getLastEvent(round)).getPlatformEvent();
new DefaultEventHasher().hashEvent(lastEvent);
@@ -397,7 +397,7 @@ private static ReservedSignedState handleNextRound(
applyTransactions(
previousState.get().getSwirldState().cast(),
- newState.getSwirldState().cast(),
+ newState.cast(),
newState.getWritablePlatformState(),
round);
diff --git a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/BirthRoundStateMigration.java b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/BirthRoundStateMigration.java
index 925a96cb6e25..a1f5772cedf7 100644
--- a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/BirthRoundStateMigration.java
+++ b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/BirthRoundStateMigration.java
@@ -63,7 +63,7 @@ public static void modifyStateForBirthRoundMigration(
return;
}
- final MerkleRoot state = initialState.getState();
+ final PlatformMerkleStateRoot state = initialState.getState();
final PlatformStateModifier writablePlatformState = state.getWritablePlatformState();
final boolean alreadyMigrated = writablePlatformState.getFirstVersionInBirthRoundMode() != null;
diff --git a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/MerkleRoot.java b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/MerkleRoot.java
deleted file mode 100644
index a3cf03cf860c..000000000000
--- a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/MerkleRoot.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2024 Hedera Hashgraph, LLC
- *
- * 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.
- */
-
-package com.swirlds.platform.state;
-
-import com.swirlds.common.merkle.MerkleInternal;
-import com.swirlds.platform.system.SwirldState;
-import edu.umd.cs.findbugs.annotations.NonNull;
-import java.nio.file.Path;
-
-/**
- * This interface represents the root node of the Merkle tree.
- */
-public interface MerkleRoot extends MerkleInternal {
- /**
- * Get the application state.
- *
- * @return the application state
- */
- @NonNull
- SwirldState getSwirldState();
- /**
- * Get readable platform state.
- * Works on both - mutable and immutable {@link MerkleRoot} and, therefore, this method should be preferred.
- *
- * @return immutable platform state
- */
- @NonNull
- PlatformStateAccessor getReadablePlatformState();
-
- /**
- * Get writable platform state. Works only on mutable {@link MerkleRoot}.
- * Call this method only if you need to modify the platform state.
- *
- * @return mutable platform state
- */
- @NonNull
- PlatformStateModifier getWritablePlatformState();
-
- /**
- * Set the platform state.
- *
- * @param platformState the platform state
- */
- void updatePlatformState(@NonNull final PlatformStateModifier platformState);
-
- /**
- * Generate a string that describes this state.
- *
- * @param hashDepth the depth of the tree to visit and print
- */
- @NonNull
- String getInfoString(final int hashDepth);
-
- /** {@inheritDoc} */
- @NonNull
- MerkleRoot copy();
-
- /** Creates a snapshots for the state. The state has to be hashed and immutable before calling this method.
- * @param targetPath The path to save the snapshot.
- */
- void createSnapshot(final @NonNull Path targetPath);
-}
diff --git a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/PlatformMerkleStateRoot.java b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/PlatformMerkleStateRoot.java
index 7fff84b01b46..e4cb5cd77cc1 100644
--- a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/PlatformMerkleStateRoot.java
+++ b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/PlatformMerkleStateRoot.java
@@ -70,8 +70,7 @@
* consider nesting service nodes in a MerkleMap, or some other such approach to get a binary tree.
*/
@ConstructableIgnored
-public class PlatformMerkleStateRoot extends MerkleStateRoot
- implements SwirldState, MerkleRoot {
+public class PlatformMerkleStateRoot extends MerkleStateRoot implements SwirldState {
private static final long CLASS_ID = 0x8e300b0dfdafbb1aL;
/**
@@ -157,6 +156,9 @@ public void handleConsensusRound(
lifecycles.onHandleConsensusRound(round, this);
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public void sealConsensusRound(@NonNull final Round round) {
requireNonNull(round);
@@ -183,10 +185,12 @@ public Function getVersionFactory() {
}
/**
- * {@inheritDoc}
+ * Get writable platform state. Works only on mutable {@link PlatformMerkleStateRoot}.
+ * Call this method only if you need to modify the platform state.
+ *
+ * @return mutable platform state
*/
@NonNull
- @Override
public PlatformStateModifier getWritablePlatformState() {
if (isImmutable()) {
throw new IllegalStateException("Cannot get writable platform state when state is immutable");
@@ -199,16 +203,17 @@ public PlatformStateModifier getWritablePlatformState() {
*
* @param accessor a source of values
*/
- @Override
public void updatePlatformState(@NonNull final PlatformStateModifier accessor) {
writablePlatformStateStore().setAllFrom(accessor);
}
/**
- * {@inheritDoc}
+ * Get readable platform state.
+ * Works on both - mutable and immutable {@link PlatformMerkleStateRoot} and, therefore, this method should be preferred.
+ *
+ * @return immutable platform state
*/
@NonNull
- @Override
public PlatformStateAccessor getReadablePlatformState() {
return getServices().isEmpty()
? new SnapshotPlatformStateAccessor(getPlatformState(), versionFactory)
@@ -240,25 +245,17 @@ public long getCurrentRound() {
: getPlatformState().consensusSnapshot().round();
}
- /**
- * {@inheritDoc}
- */
- @NonNull
- @Override
- public SwirldState getSwirldState() {
- return this;
- }
-
@Override
public long getClassId() {
return CLASS_ID;
}
/**
- * {@inheritDoc}
+ * Generate a string that describes this state.
+ *
+ * @param hashDepth the depth of the tree to visit and print
*/
@NonNull
- @Override
public String getInfoString(final int hashDepth) {
return createInfoString(hashDepth, getReadablePlatformState(), getHash(), this);
}
diff --git a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/SwirldStateManager.java b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/SwirldStateManager.java
index 06a9d89e1456..7630af120a77 100644
--- a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/SwirldStateManager.java
+++ b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/SwirldStateManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016-2024 Hedera Hashgraph, LLC
+ * Copyright (C) 2024 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -53,12 +53,12 @@ public class SwirldStateManager implements FreezePeriodChecker {
/**
* reference to the state that reflects all known consensus transactions
*/
- private final AtomicReference stateRef = new AtomicReference<>();
+ private final AtomicReference stateRef = new AtomicReference<>();
/**
* The most recent immutable state. No value until the first fast copy is created.
*/
- private final AtomicReference latestImmutableState = new AtomicReference<>();
+ private final AtomicReference latestImmutableState = new AtomicReference<>();
/**
* Handle transactions by applying them to a state
@@ -107,7 +107,7 @@ public SwirldStateManager(
*
* @param state the initial state
*/
- public void setInitialState(@NonNull final MerkleRoot state) {
+ public void setInitialState(@NonNull final PlatformMerkleStateRoot state) {
Objects.requireNonNull(state);
state.throwIfDestroyed("state must not be destroyed");
state.throwIfImmutable("state must be mutable");
@@ -128,7 +128,7 @@ public void setInitialState(@NonNull final MerkleRoot state) {
* @param round the round to handle
*/
public List> handleConsensusRound(final ConsensusRound round) {
- final MerkleRoot state = stateRef.get();
+ final PlatformMerkleStateRoot state = stateRef.get();
uptimeTracker.handleRound(round);
transactionHandler.handleRound(round, state);
@@ -144,15 +144,15 @@ public List> handleConsensusR
*/
public void sealConsensusRound(@NonNull final Round round) {
Objects.requireNonNull(round);
- final MerkleRoot state = stateRef.get();
- state.getSwirldState().sealConsensusRound(round);
+ final PlatformMerkleStateRoot state = stateRef.get();
+ state.sealConsensusRound(round);
}
/**
* Returns the consensus state. The consensus state could become immutable at any time. Modifications must not be
* made to the returned state.
*/
- public MerkleRoot getConsensusState() {
+ public PlatformMerkleStateRoot getConsensusState() {
return stateRef.get();
}
@@ -176,7 +176,7 @@ public void savedStateInFreezePeriod() {
* @param signedState the signed state to load
*/
public void loadFromSignedState(@NonNull final SignedState signedState) {
- final MerkleRoot state = signedState.getState();
+ final PlatformMerkleStateRoot state = signedState.getState();
state.throwIfDestroyed("state must not be destroyed");
state.throwIfImmutable("state must be mutable");
@@ -184,8 +184,8 @@ public void loadFromSignedState(@NonNull final SignedState signedState) {
fastCopyAndUpdateRefs(state);
}
- private void fastCopyAndUpdateRefs(final MerkleRoot state) {
- final MerkleRoot consState = fastCopy(state, stats, softwareVersion);
+ private void fastCopyAndUpdateRefs(final PlatformMerkleStateRoot state) {
+ final PlatformMerkleStateRoot consState = fastCopy(state, stats, softwareVersion);
// Set latest immutable first to prevent the newly immutable state from being deleted between setting the
// stateRef and the latestImmutableState
@@ -198,8 +198,8 @@ private void fastCopyAndUpdateRefs(final MerkleRoot state) {
*
* @param state the new mutable state
*/
- private void setState(final MerkleRoot state) {
- final MerkleRoot currVal = stateRef.get();
+ private void setState(final PlatformMerkleStateRoot state) {
+ final PlatformMerkleStateRoot currVal = stateRef.get();
if (currVal != null) {
currVal.release();
}
@@ -208,8 +208,8 @@ private void setState(final MerkleRoot state) {
stateRef.set(state);
}
- private void setLatestImmutableState(final MerkleRoot immutableState) {
- final MerkleRoot currVal = latestImmutableState.get();
+ private void setLatestImmutableState(final PlatformMerkleStateRoot immutableState) {
+ final PlatformMerkleStateRoot currVal = latestImmutableState.get();
if (currVal != null) {
currVal.release();
}
@@ -237,9 +237,9 @@ public boolean isInFreezePeriod(final Instant timestamp) {
* event handling may or may not be blocked depending on the implementation.
*
* @return a copy of the state to use for the next signed state
- * @see MerkleRoot#copy()
+ * @see PlatformMerkleStateRoot#copy()
*/
- public MerkleRoot getStateForSigning() {
+ public PlatformMerkleStateRoot getStateForSigning() {
fastCopyAndUpdateRefs(stateRef.get());
return latestImmutableState.get();
}
diff --git a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/SwirldStateManagerUtils.java b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/SwirldStateManagerUtils.java
index bb42bcd48af6..efbff35b36a4 100644
--- a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/SwirldStateManagerUtils.java
+++ b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/SwirldStateManagerUtils.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022-2024 Hedera Hashgraph, LLC
+ * Copyright (C) 2024 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,15 +34,15 @@ public final class SwirldStateManagerUtils {
private SwirldStateManagerUtils() {}
/**
- * Performs a fast copy on a {@link MerkleRoot}. The {@code state} must not be modified during execution of this method.
+ * Performs a fast copy on a {@link PlatformMerkleStateRoot}. The {@code state} must not be modified during execution of this method.
*
* @param state the state object to fast copy
* @param stats object to record stats in
* @param softwareVersion the current software version
* @return the newly created state copy
*/
- public static MerkleRoot fastCopy(
- @NonNull final MerkleRoot state,
+ public static PlatformMerkleStateRoot fastCopy(
+ @NonNull final PlatformMerkleStateRoot state,
@NonNull final SwirldStateMetrics stats,
@NonNull final SoftwareVersion softwareVersion) {
@@ -51,7 +51,7 @@ public static MerkleRoot fastCopy(
final long copyStart = System.nanoTime();
// Create a fast copy
- final MerkleRoot copy = state.copy();
+ final PlatformMerkleStateRoot copy = state.copy();
final var platformState = copy.getWritablePlatformState();
platformState.setCreationSoftwareVersion(softwareVersion);
diff --git a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/TransactionHandler.java b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/TransactionHandler.java
index 59f7c3374cff..9f40a4671f86 100644
--- a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/TransactionHandler.java
+++ b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/TransactionHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022-2024 Hedera Hashgraph, LLC
+ * Copyright (C) 2024 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -52,12 +52,12 @@ public TransactionHandler(final NodeId selfId, final SwirldStateMetrics stats) {
* @param state
* the state to apply {@code round} to
*/
- public void handleRound(final ConsensusRound round, final MerkleRoot state) {
+ public void handleRound(final ConsensusRound round, final PlatformMerkleStateRoot state) {
try {
final Instant timeOfHandle = Instant.now();
final long startTime = System.nanoTime();
- state.getSwirldState().handleConsensusRound(round, state.getWritablePlatformState(), NO_OP_CONSUMER);
+ state.handleConsensusRound(round, state.getWritablePlatformState(), NO_OP_CONSUMER);
final double secondsElapsed = (System.nanoTime() - startTime) * NANOSECONDS_TO_SECONDS;
diff --git a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/address/AddressBookInitializer.java b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/address/AddressBookInitializer.java
index 15cc9a257794..9e174784b375 100644
--- a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/address/AddressBookInitializer.java
+++ b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/address/AddressBookInitializer.java
@@ -1,4 +1,19 @@
-// SPDX-License-Identifier: Apache-2.0
+/*
+ * Copyright (C) 2024 Hedera Hashgraph, LLC
+ *
+ * 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.
+ */
+
package com.swirlds.platform.state.address;
import static com.swirlds.logging.legacy.LogMarker.EXCEPTION;
@@ -14,7 +29,6 @@
import com.swirlds.platform.system.address.Address;
import com.swirlds.platform.system.address.AddressBook;
import com.swirlds.platform.system.address.AddressBookValidator;
-import com.swirlds.state.State;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.Nullable;
import java.io.File;
@@ -118,8 +132,7 @@ public AddressBookInitializer(
platformContext.getConfiguration().getConfigData(AddressBookConfig.class);
this.initialState = Objects.requireNonNull(initialState, "The initialState must not be null.");
- final var book = buildAddressBook(
- retrieveActiveOrGenesisRoster((State) initialState.getState().getSwirldState()));
+ final var book = buildAddressBook(retrieveActiveOrGenesisRoster(initialState.getState()));
this.stateAddressBook = (book == null || book.getSize() == 0) ? null : book;
if (stateAddressBook == null && !initialState.isGenesisState()) {
throw new IllegalStateException("Only genesis states can have null address books.");
diff --git a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/hashlogger/DefaultHashLogger.java b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/hashlogger/DefaultHashLogger.java
index 27fef2693beb..5c5a0a8b6c40 100644
--- a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/hashlogger/DefaultHashLogger.java
+++ b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/hashlogger/DefaultHashLogger.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022-2024 Hedera Hashgraph, LLC
+ * Copyright (C) 2024 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,7 +20,7 @@
import com.swirlds.common.context.PlatformContext;
import com.swirlds.platform.config.StateConfig;
-import com.swirlds.platform.state.MerkleRoot;
+import com.swirlds.platform.state.PlatformMerkleStateRoot;
import com.swirlds.platform.state.signed.ReservedSignedState;
import com.swirlds.platform.state.signed.SignedState;
import edu.umd.cs.findbugs.annotations.NonNull;
@@ -107,7 +107,7 @@ public void logHashes(@NonNull final ReservedSignedState reservedState) {
*/
@NonNull
private Message generateLogMessage(@NonNull final SignedState signedState) {
- final MerkleRoot state = signedState.getState();
+ final PlatformMerkleStateRoot state = signedState.getState();
final String platformInfo = state.getInfoString(depth);
return MESSAGE_FACTORY.newMessage(
diff --git a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/signed/SignedState.java b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/signed/SignedState.java
index 4b2f9e462f96..0f1da7772bf9 100644
--- a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/signed/SignedState.java
+++ b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/signed/SignedState.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016-2024 Hedera Hashgraph, LLC
+ * Copyright (C) 2024 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,12 +39,11 @@
import com.swirlds.platform.crypto.SignatureVerifier;
import com.swirlds.platform.roster.RosterRetriever;
import com.swirlds.platform.roster.RosterUtils;
-import com.swirlds.platform.state.MerkleRoot;
+import com.swirlds.platform.state.PlatformMerkleStateRoot;
import com.swirlds.platform.state.signed.SignedStateHistory.SignedStateAction;
import com.swirlds.platform.state.snapshot.StateToDiskReason;
import com.swirlds.platform.system.SwirldState;
import com.swirlds.platform.system.address.Address;
-import com.swirlds.state.merkle.MerkleStateRoot;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.Nullable;
import java.security.cert.X509Certificate;
@@ -106,7 +105,7 @@ public class SignedState implements SignedStateInfo {
/**
* The root of the merkle state.
*/
- private final MerkleRoot state;
+ private final PlatformMerkleStateRoot state;
/**
* The timestamp of when this object was created.
@@ -188,7 +187,7 @@ public class SignedState implements SignedStateInfo {
public SignedState(
@NonNull final Configuration configuration,
@NonNull final SignatureVerifier signatureVerifier,
- @NonNull final MerkleRoot state,
+ @NonNull final PlatformMerkleStateRoot state,
@NonNull final String reason,
final boolean freezeState,
final boolean deleteOnBackgroundThread,
@@ -270,8 +269,7 @@ public void setSigSet(@NonNull final SigSet sigSet) {
Ideally the roster would be captured in the constructor but due to the mutable underlying state, the roster
can change from underneath us. Therefore, the roster must be regenerated on each access.
*/
- final Roster roster = RosterRetriever.retrieveActiveOrGenesisRoster(
- (MerkleStateRoot) getState().getSwirldState());
+ final Roster roster = RosterRetriever.retrieveActiveOrGenesisRoster(state);
return requireNonNull(roster, "Roster stored in signed state is null (this should never happen)");
}
@@ -281,7 +279,7 @@ public void setSigSet(@NonNull final SigSet sigSet) {
*
* @return the state contained in the signed state
*/
- public @NonNull MerkleRoot getState() {
+ public @NonNull PlatformMerkleStateRoot getState() {
return state;
}
@@ -484,7 +482,7 @@ public String toString() {
* @return the root node of the application's state.
*/
public @NonNull SwirldState getSwirldState() {
- return state.getSwirldState();
+ return state;
}
/**
diff --git a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/signed/StartupStateUtils.java b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/signed/StartupStateUtils.java
index 60c29102456f..f6414825dac2 100644
--- a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/signed/StartupStateUtils.java
+++ b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/signed/StartupStateUtils.java
@@ -37,7 +37,7 @@
import com.swirlds.platform.internal.SignedStateLoadingException;
import com.swirlds.platform.roster.RosterRetriever;
import com.swirlds.platform.roster.RosterUtils;
-import com.swirlds.platform.state.MerkleRoot;
+import com.swirlds.platform.state.PlatformMerkleStateRoot;
import com.swirlds.platform.state.PlatformStateModifier;
import com.swirlds.platform.state.snapshot.DeserializedSignedState;
import com.swirlds.platform.state.snapshot.SavedStateInfo;
@@ -85,7 +85,7 @@ public static HashedReservedSignedState getInitialState(
@NonNull final Configuration configuration,
@NonNull final RecycleBin recycleBin,
@NonNull final SoftwareVersion softwareVersion,
- @NonNull final Supplier genesisStateBuilder,
+ @NonNull final Supplier genesisStateBuilder,
@NonNull final String mainClassName,
@NonNull final String swirldName,
@NonNull final NodeId selfId,
@@ -172,7 +172,7 @@ public static ReservedSignedState loadStateFile(
requireNonNull(configuration);
requireNonNull(initialSignedState);
- final MerkleRoot stateCopy = initialSignedState.getState().copy();
+ final PlatformMerkleStateRoot stateCopy = initialSignedState.getState().copy();
final SignedState signedStateCopy = new SignedState(
configuration,
CryptoStatic::verifySignature,
@@ -266,7 +266,7 @@ private static ReservedSignedState loadStateFile(
}
}
- final MerkleRoot state =
+ final PlatformMerkleStateRoot state =
deserializedSignedState.reservedSignedState().get().getState();
final Hash oldHash = deserializedSignedState.originalHash();
@@ -326,15 +326,10 @@ private static ReservedSignedState buildGenesisState(
@NonNull final Configuration configuration,
@NonNull final AddressBook addressBook,
@NonNull final SoftwareVersion appVersion,
- @NonNull final MerkleRoot stateRoot) {
+ @NonNull final PlatformMerkleStateRoot stateRoot) {
if (!configuration.getConfigData(AddressBookConfig.class).useRosterLifecycle()) {
- initGenesisState(
- configuration,
- (State) stateRoot.getSwirldState(),
- stateRoot.getWritablePlatformState(),
- addressBook,
- appVersion);
+ initGenesisState(configuration, stateRoot, stateRoot.getWritablePlatformState(), addressBook, appVersion);
}
final SignedState signedState = new SignedState(
diff --git a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/snapshot/SavedStateMetadata.java b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/snapshot/SavedStateMetadata.java
index f684241e94a2..5325751bd92f 100644
--- a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/snapshot/SavedStateMetadata.java
+++ b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/snapshot/SavedStateMetadata.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2023-2024 Hedera Hashgraph, LLC
+ * Copyright (C) 2024 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -42,7 +42,6 @@
import com.swirlds.platform.roster.RosterUtils;
import com.swirlds.platform.state.PlatformStateAccessor;
import com.swirlds.platform.state.signed.SignedState;
-import com.swirlds.state.State;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.Nullable;
import java.io.BufferedReader;
@@ -172,8 +171,7 @@ public static SavedStateMetadata create(
Objects.requireNonNull(now, "now must not be null");
final PlatformStateAccessor platformState = signedState.getState().getReadablePlatformState();
- final Roster roster = RosterRetriever.retrieveActiveOrGenesisRoster(
- (State) signedState.getState().getSwirldState());
+ final Roster roster = RosterRetriever.retrieveActiveOrGenesisRoster(signedState.getState());
final List signingNodes = signedState.getSigSet().getSigningNodes();
Collections.sort(signingNodes);
diff --git a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/snapshot/SignedStateFileReader.java b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/snapshot/SignedStateFileReader.java
index 322e36c5a94a..e98b289cea32 100644
--- a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/snapshot/SignedStateFileReader.java
+++ b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/snapshot/SignedStateFileReader.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022-2024 Hedera Hashgraph, LLC
+ * Copyright (C) 2024 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,7 +29,7 @@
import com.swirlds.common.platform.NodeId;
import com.swirlds.config.api.Configuration;
import com.swirlds.platform.crypto.CryptoStatic;
-import com.swirlds.platform.state.MerkleRoot;
+import com.swirlds.platform.state.PlatformMerkleStateRoot;
import com.swirlds.platform.state.service.PlatformStateService;
import com.swirlds.platform.state.service.schemas.V0540PlatformStateSchema;
import com.swirlds.platform.state.service.schemas.V0540RosterBaseSchema;
@@ -106,7 +106,7 @@ public static List getSavedStateFiles(
final SignedState newSignedState = new SignedState(
configuration,
CryptoStatic::verifySignature,
- (MerkleRoot) data.stateRoot(),
+ (PlatformMerkleStateRoot) data.stateRoot(),
"SignedStateFileReader.readStateFile()",
false,
false,
diff --git a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/snapshot/SignedStateFileWriter.java b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/snapshot/SignedStateFileWriter.java
index 87407dc7d3f8..972c87c2bdbf 100644
--- a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/snapshot/SignedStateFileWriter.java
+++ b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/snapshot/SignedStateFileWriter.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022-2024 Hedera Hashgraph, LLC
+ * Copyright (C) 2024 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,11 +35,10 @@
import com.swirlds.platform.config.StateConfig;
import com.swirlds.platform.recovery.emergencyfile.EmergencyRecoveryFile;
import com.swirlds.platform.roster.RosterUtils;
-import com.swirlds.platform.state.MerkleRoot;
+import com.swirlds.platform.state.PlatformMerkleStateRoot;
import com.swirlds.platform.state.signed.SigSet;
import com.swirlds.platform.state.signed.SignedState;
import com.swirlds.platform.system.address.AddressBook;
-import com.swirlds.state.merkle.MerkleStateRoot;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.Nullable;
import java.io.BufferedWriter;
@@ -70,7 +69,7 @@ private SignedStateFileWriter() {}
* @param directory the directory where the state is being written
*/
public static void writeHashInfoFile(
- @NonNull final PlatformContext platformContext, final Path directory, final MerkleRoot state)
+ @NonNull final PlatformContext platformContext, final Path directory, final PlatformMerkleStateRoot state)
throws IOException {
final StateConfig stateConfig = platformContext.getConfiguration().getConfigData(StateConfig.class);
final String platformInfo = state.getInfoString(stateConfig.debugHashDepth());
@@ -151,10 +150,8 @@ public static void writeSignedStateFilesToDirectory(
Objects.requireNonNull(directory);
Objects.requireNonNull(signedState);
- final MerkleRoot state = signedState.getState();
- if (state instanceof MerkleStateRoot merkleStateRoot) {
- merkleStateRoot.setTime(platformContext.getTime());
- }
+ final PlatformMerkleStateRoot state = signedState.getState();
+ state.setTime(platformContext.getTime());
state.createSnapshot(directory);
writeSignatureSetFile(directory, signedState);
writeHashInfoFile(platformContext, directory, signedState.getState());
diff --git a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/system/SwirldMain.java b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/system/SwirldMain.java
index 588a58b8e530..35a902c9821f 100644
--- a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/system/SwirldMain.java
+++ b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/system/SwirldMain.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016-2024 Hedera Hashgraph, LLC
+ * Copyright (C) 2024 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,7 +17,7 @@
package com.swirlds.platform.system;
import com.swirlds.common.platform.NodeId;
-import com.swirlds.platform.state.MerkleRoot;
+import com.swirlds.platform.state.PlatformMerkleStateRoot;
import edu.umd.cs.findbugs.annotations.NonNull;
import java.util.List;
@@ -67,7 +67,7 @@ default List> getConfigDataTypes() {
* @return merkle state tree root node
*/
@NonNull
- MerkleRoot newMerkleStateRoot();
+ PlatformMerkleStateRoot newMerkleStateRoot();
/**
*
diff --git a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/system/address/AddressBookUtils.java b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/system/address/AddressBookUtils.java
index 3e7991e05800..8a1d5fd6ed23 100644
--- a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/system/address/AddressBookUtils.java
+++ b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/system/address/AddressBookUtils.java
@@ -251,7 +251,7 @@ public static ServiceEndpoint endpointFor(@NonNull final String host, final int
// Initialize the address book from the configuration and platform saved state.
final AddressBookInitializer addressBookInitializer = new AddressBookInitializer(
selfId, version, softwareUpgrade, initialState.get(), bootstrapAddressBook.copy(), platformContext);
- final State state = (State) initialState.get().getState().getSwirldState();
+ final State state = initialState.get().getState();
if (addressBookInitializer.hasAddressBookChanged()) {
if (addressBookInitializer.getPreviousAddressBook() != null) {
diff --git a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/util/BootstrapUtils.java b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/util/BootstrapUtils.java
index fb14bb299cf1..3d5cffdf034f 100644
--- a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/util/BootstrapUtils.java
+++ b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/util/BootstrapUtils.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022-2024 Hedera Hashgraph, LLC
+ * Copyright (C) 2024 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -48,6 +48,9 @@
import com.swirlds.platform.health.entropy.OSEntropyChecker;
import com.swirlds.platform.health.filesystem.OSFileSystemChecker;
import com.swirlds.platform.state.MerkleRoot;
+import com.swirlds.platform.network.Network;
+import com.swirlds.platform.state.PlatformMerkleStateRoot;
+import com.swirlds.platform.state.address.AddressBookNetworkUtils;
import com.swirlds.platform.state.signed.SignedState;
import com.swirlds.platform.swirldapp.AppLoaderException;
import com.swirlds.platform.swirldapp.SwirldAppLoader;
@@ -212,7 +215,7 @@ public static boolean detectSoftwareUpgrade(
if (loadedSignedState == null) {
loadedSoftwareVersion = null;
} else {
- MerkleRoot state = loadedSignedState.getState();
+ PlatformMerkleStateRoot state = loadedSignedState.getState();
loadedSoftwareVersion = state.getReadablePlatformState().getCreationSoftwareVersion();
}
final int versionComparison = loadedSoftwareVersion == null ? 1 : appVersion.compareTo(loadedSoftwareVersion);
diff --git a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/AddressBookInitializerTest.java b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/AddressBookInitializerTest.java
index 8d2bf9aa94ad..4db717f954be 100644
--- a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/AddressBookInitializerTest.java
+++ b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/AddressBookInitializerTest.java
@@ -1,4 +1,19 @@
-// SPDX-License-Identifier: Apache-2.0
+/*
+ * Copyright (C) 2024 Hedera Hashgraph, LLC
+ *
+ * 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.
+ */
+
package com.swirlds.platform;
import static com.swirlds.platform.roster.RosterUtils.buildAddressBook;
@@ -16,7 +31,6 @@
import static org.mockito.ArgumentMatchers.argThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-import static org.mockito.Mockito.withSettings;
import com.hedera.hapi.node.state.roster.Roster;
import com.swirlds.common.context.PlatformContext;
@@ -27,18 +41,16 @@
import com.swirlds.config.extensions.test.fixtures.TestConfigBuilder;
import com.swirlds.platform.config.AddressBookConfig_;
import com.swirlds.platform.roster.RosterRetriever;
-import com.swirlds.platform.state.MerkleRoot;
+import com.swirlds.platform.state.PlatformMerkleStateRoot;
import com.swirlds.platform.state.PlatformStateAccessor;
import com.swirlds.platform.state.address.AddressBookInitializer;
import com.swirlds.platform.state.signed.SignedState;
import com.swirlds.platform.system.SoftwareVersion;
-import com.swirlds.platform.system.SwirldState;
import com.swirlds.platform.system.address.Address;
import com.swirlds.platform.system.address.AddressBook;
import com.swirlds.platform.test.fixtures.addressbook.RandomAddressBookBuilder;
import com.swirlds.platform.test.fixtures.addressbook.RandomRosterBuilder;
import com.swirlds.platform.test.fixtures.roster.RosterServiceStateMock;
-import com.swirlds.state.State;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.Nullable;
import java.io.File;
@@ -379,15 +391,14 @@ private SignedState getMockSignedState(
boolean fromGenesis) {
final SignedState signedState = mock(SignedState.class);
final SoftwareVersion softwareVersion = getMockSoftwareVersion(2);
- final SwirldState swirldState = getMockSwirldStateSupplier(weightValue).get();
- when(signedState.getSwirldState()).thenReturn(swirldState);
+ final PlatformMerkleStateRoot state =
+ getMockSwirldStateSupplier(weightValue).get();
+ when(signedState.getSwirldState()).thenReturn(state);
final PlatformStateAccessor platformState = mock(PlatformStateAccessor.class);
when(platformState.getCreationSoftwareVersion()).thenReturn(softwareVersion);
- RosterServiceStateMock.setup(
- (State) swirldState, currentRoster, 1L, RosterRetriever.buildRoster(previousAddressBook));
- final MerkleRoot state = mock(MerkleRoot.class);
+ RosterServiceStateMock.setup(state, currentRoster, 1L, RosterRetriever.buildRoster(previousAddressBook));
+
when(state.getReadablePlatformState()).thenReturn(platformState);
- when(state.getSwirldState()).thenReturn(swirldState);
when(signedState.getState()).thenReturn(state);
when(signedState.isGenesisState()).thenReturn(fromGenesis);
when(signedState.getRoster()).thenReturn(currentRoster);
@@ -400,10 +411,10 @@ private SignedState getMockSignedState(
* @param scenario The scenario to load.
* @return A SwirldState which behaves according to the input scenario.
*/
- private Supplier getMockSwirldStateSupplier(int scenario) {
+ private Supplier getMockSwirldStateSupplier(int scenario) {
final AtomicReference configAddressBook = new AtomicReference<>();
- final SwirldState swirldState = mock(SwirldState.class, withSettings().extraInterfaces(State.class));
+ final PlatformMerkleStateRoot swirldState = mock(PlatformMerkleStateRoot.class);
final OngoingStubbing stub = when(swirldState.updateWeight(
argThat(confAB -> {
diff --git a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/SavedStateMetadataTests.java b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/SavedStateMetadataTests.java
index 66d513611c38..9858084d3b14 100644
--- a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/SavedStateMetadataTests.java
+++ b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/SavedStateMetadataTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2023-2024 Hedera Hashgraph, LLC
+ * Copyright (C) 2024 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,14 +37,13 @@
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-import static org.mockito.Mockito.withSettings;
import com.hedera.hapi.node.state.roster.Roster;
import com.swirlds.common.crypto.Hash;
import com.swirlds.common.platform.NodeId;
import com.swirlds.common.test.fixtures.RandomUtils;
import com.swirlds.platform.consensus.ConsensusSnapshot;
-import com.swirlds.platform.state.MerkleRoot;
+import com.swirlds.platform.state.PlatformMerkleStateRoot;
import com.swirlds.platform.state.PlatformStateAccessor;
import com.swirlds.platform.state.signed.SigSet;
import com.swirlds.platform.state.signed.SignedState;
@@ -52,9 +51,7 @@
import com.swirlds.platform.state.snapshot.SavedStateMetadataField;
import com.swirlds.platform.system.BasicSoftwareVersion;
import com.swirlds.platform.system.SoftwareVersion;
-import com.swirlds.platform.system.SwirldState;
import com.swirlds.platform.test.fixtures.roster.RosterServiceStateMock;
-import com.swirlds.state.State;
import edu.umd.cs.findbugs.annotations.NonNull;
import java.io.IOException;
import java.nio.file.Files;
@@ -209,16 +206,14 @@ void signingNodesSortedTest() {
final SignedState signedState = mock(SignedState.class);
final SigSet sigSet = mock(SigSet.class);
- final MerkleRoot state = mock(MerkleRoot.class);
+ final PlatformMerkleStateRoot state = mock(PlatformMerkleStateRoot.class);
when(state.getHash()).thenReturn(randomHash(random));
final PlatformStateAccessor platformState = mock(PlatformStateAccessor.class);
when(platformState.getLegacyRunningEventHash()).thenReturn(randomHash(random));
when(platformState.getSnapshot()).thenReturn(mock(ConsensusSnapshot.class));
final Roster roster = mock(Roster.class);
- final State theState = mock(State.class, withSettings().extraInterfaces(SwirldState.class));
- when(state.getSwirldState()).thenReturn((SwirldState) theState);
- RosterServiceStateMock.setup(theState, roster);
+ RosterServiceStateMock.setup(state, roster);
when(signedState.getState()).thenReturn(state);
when(state.getReadablePlatformState()).thenReturn(platformState);
diff --git a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/SignedStateFileReadWriteTest.java b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/SignedStateFileReadWriteTest.java
index b611d823dfff..d48611bafb62 100644
--- a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/SignedStateFileReadWriteTest.java
+++ b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/SignedStateFileReadWriteTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022-2024 Hedera Hashgraph, LLC
+ * Copyright (C) 2024 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -47,7 +47,7 @@
import com.swirlds.config.extensions.test.fixtures.TestConfigBuilder;
import com.swirlds.merkledb.MerkleDb;
import com.swirlds.platform.config.StateConfig;
-import com.swirlds.platform.state.MerkleRoot;
+import com.swirlds.platform.state.PlatformMerkleStateRoot;
import com.swirlds.platform.state.signed.SignedState;
import com.swirlds.platform.state.snapshot.DeserializedSignedState;
import com.swirlds.platform.state.snapshot.SignedStateFileUtils;
@@ -107,7 +107,7 @@ void writeHashInfoFileTest() throws IOException {
final SignedState signedState = new RandomSignedStateGenerator()
.setSoftwareVersion(new BasicSoftwareVersion(platformVersion.minor()))
.build();
- MerkleRoot state = signedState.getState();
+ PlatformMerkleStateRoot state = signedState.getState();
writeHashInfoFile(platformContext, testDirectory, state);
final StateConfig stateConfig =
new TestConfigBuilder().getOrCreateConfig().getConfigData(StateConfig.class);
diff --git a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/consensus/RoundCalculationUtilsTest.java b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/consensus/RoundCalculationUtilsTest.java
index 5fdda8434044..477d12c0f578 100644
--- a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/consensus/RoundCalculationUtilsTest.java
+++ b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/consensus/RoundCalculationUtilsTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022-2024 Hedera Hashgraph, LLC
+ * Copyright (C) 2024 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,7 +19,7 @@
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-import com.swirlds.platform.state.MerkleRoot;
+import com.swirlds.platform.state.PlatformMerkleStateRoot;
import com.swirlds.platform.state.PlatformStateModifier;
import com.swirlds.platform.state.signed.SignedState;
import com.swirlds.platform.system.events.EventConstants;
@@ -69,7 +69,7 @@ void getMinGenNonAncientFromSignedState() {
final Map map =
LongStream.range(1, 50).collect(HashMap::new, (m, l) -> m.put(l, l * 10), HashMap::putAll);
final SignedState signedState = mock(SignedState.class);
- final MerkleRoot state = mock(MerkleRoot.class);
+ final PlatformMerkleStateRoot state = mock(PlatformMerkleStateRoot.class);
final PlatformStateModifier platformState = mock(PlatformStateModifier.class);
when(signedState.getState()).thenReturn(state);
when(state.getReadablePlatformState()).thenReturn(platformState);
diff --git a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/eventhandling/DefaultTransactionHandlerTests.java b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/eventhandling/DefaultTransactionHandlerTests.java
index 125d4a27678c..037f5c12b3d4 100644
--- a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/eventhandling/DefaultTransactionHandlerTests.java
+++ b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/eventhandling/DefaultTransactionHandlerTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016-2024 Hedera Hashgraph, LLC
+ * Copyright (C) 2024 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -156,8 +156,7 @@ void normalOperation(final boolean pcesRound) throws InterruptedException {
pcesRound,
handlerOutput.reservedSignedState().get().isPcesRound(),
"the state should match the PCES boolean");
- verify(tester.getSwirldStateManager().getConsensusState().getSwirldState())
- .sealConsensusRound(consensusRound);
+ verify(tester.getSwirldStateManager().getConsensusState()).sealConsensusRound(consensusRound);
}
@Test
diff --git a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/eventhandling/TransactionHandlerTester.java b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/eventhandling/TransactionHandlerTester.java
index b985df4b09a9..2fac032faca8 100644
--- a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/eventhandling/TransactionHandlerTester.java
+++ b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/eventhandling/TransactionHandlerTester.java
@@ -25,7 +25,7 @@
import com.swirlds.common.platform.NodeId;
import com.swirlds.common.test.fixtures.platform.TestPlatformContextBuilder;
import com.swirlds.platform.roster.RosterRetriever;
-import com.swirlds.platform.state.MerkleRoot;
+import com.swirlds.platform.state.PlatformMerkleStateRoot;
import com.swirlds.platform.state.PlatformStateModifier;
import com.swirlds.platform.state.SwirldStateManager;
import com.swirlds.platform.state.service.PlatformStateValueAccumulator;
@@ -59,9 +59,7 @@ public TransactionHandlerTester(final AddressBook addressBook) {
TestPlatformContextBuilder.create().build();
platformState = new PlatformStateValueAccumulator();
- final MerkleRoot consensusState = mock(MerkleRoot.class);
- final SwirldState swirldState = mock(SwirldState.class);
- when(consensusState.getSwirldState()).thenReturn(swirldState);
+ final PlatformMerkleStateRoot consensusState = mock(PlatformMerkleStateRoot.class);
when(consensusState.copy()).thenReturn(consensusState);
when(consensusState.getReadablePlatformState()).thenReturn(platformState);
when(consensusState.getWritablePlatformState()).thenReturn(platformState);
@@ -69,7 +67,7 @@ public TransactionHandlerTester(final AddressBook addressBook) {
handledRounds.add(i.getArgument(0));
return null;
})
- .when(swirldState)
+ .when(consensusState)
.handleConsensusRound(any(), any(), any());
final StatusActionSubmitter statusActionSubmitter = submittedActions::add;
swirldStateManager = new SwirldStateManager(
diff --git a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/reconnect/ReconnectProtocolTests.java b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/reconnect/ReconnectProtocolTests.java
index 9403b24625a0..0c99753b12c3 100644
--- a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/reconnect/ReconnectProtocolTests.java
+++ b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/reconnect/ReconnectProtocolTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022-2024 Hedera Hashgraph, LLC
+ * Copyright (C) 2024 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -47,7 +47,7 @@
import com.swirlds.platform.network.protocol.Protocol;
import com.swirlds.platform.network.protocol.ProtocolFactory;
import com.swirlds.platform.network.protocol.ReconnectProtocolFactory;
-import com.swirlds.platform.state.MerkleRoot;
+import com.swirlds.platform.state.PlatformMerkleStateRoot;
import com.swirlds.platform.state.signed.ReservedSignedState;
import com.swirlds.platform.state.signed.SignedState;
import com.swirlds.platform.state.signed.SignedStateValidator;
@@ -308,7 +308,7 @@ void testTeacherThrottleReleased() {
Time.getCurrent());
final SignedState signedState = spy(new RandomSignedStateGenerator().build());
when(signedState.isComplete()).thenReturn(true);
- final MerkleRoot state = mock(MerkleRoot.class);
+ final PlatformMerkleStateRoot state = mock(PlatformMerkleStateRoot.class);
when(signedState.getState()).thenReturn(state);
final ReservedSignedState reservedSignedState = signedState.reserve("test");
diff --git a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/reconnect/ReconnectTest.java b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/reconnect/ReconnectTest.java
index dc133ae5adc4..ab823330c2c9 100644
--- a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/reconnect/ReconnectTest.java
+++ b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/reconnect/ReconnectTest.java
@@ -39,7 +39,7 @@
import com.swirlds.platform.metrics.ReconnectMetrics;
import com.swirlds.platform.network.Connection;
import com.swirlds.platform.network.SocketConnection;
-import com.swirlds.platform.state.MerkleRoot;
+import com.swirlds.platform.state.PlatformMerkleStateRoot;
import com.swirlds.platform.state.signed.SignedState;
import com.swirlds.platform.state.signed.SignedStateValidator;
import com.swirlds.platform.test.fixtures.addressbook.RandomRosterBuilder;
@@ -182,7 +182,7 @@ private ReconnectTeacher buildSender(final SocketConnection connection, final Re
}
private ReconnectLearner buildReceiver(
- final MerkleRoot state, final Connection connection, final ReconnectMetrics reconnectMetrics) {
+ final PlatformMerkleStateRoot state, final Connection connection, final ReconnectMetrics reconnectMetrics) {
final Roster roster =
RandomRosterBuilder.create(getRandomPrintSeed()).withSize(5).build();
diff --git a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/state/StateRegistryTests.java b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/state/StateRegistryTests.java
index 0165713bc1ed..0da53f98a5bb 100644
--- a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/state/StateRegistryTests.java
+++ b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/state/StateRegistryTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022-2024 Hedera Hashgraph, LLC
+ * Copyright (C) 2024 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -83,7 +83,7 @@ void activeStateCountTest() throws IOException {
RuntimeObjectRegistry.getActiveObjectsCount(PlatformMerkleStateRoot.class),
"no states have been created yet");
- final List states = new LinkedList<>();
+ final List states = new LinkedList<>();
// Create a bunch of states
for (int i = 0; i < 100; i++) {
states.add(new PlatformMerkleStateRoot(FAKE_MERKLE_STATE_LIFECYCLES, softwareVersionSupplier));
@@ -94,10 +94,10 @@ void activeStateCountTest() throws IOException {
}
// Fast copy a state
- final MerkleRoot stateToCopy =
+ final PlatformMerkleStateRoot stateToCopy =
new PlatformMerkleStateRoot(FAKE_MERKLE_STATE_LIFECYCLES, softwareVersionSupplier);
states.add(stateToCopy);
- final MerkleRoot copyOfStateToCopy = stateToCopy.copy();
+ final PlatformMerkleStateRoot copyOfStateToCopy = stateToCopy.copy();
states.add(copyOfStateToCopy);
assertEquals(
states.size(),
@@ -120,7 +120,7 @@ void activeStateCountTest() throws IOException {
final InputOutputStream io = new InputOutputStream();
io.getOutput().writeMerkleTree(dir, stateToSerialize);
io.startReading();
- final MerkleRoot deserializedState = io.getInput().readMerkleTree(dir, 5);
+ final PlatformMerkleStateRoot deserializedState = io.getInput().readMerkleTree(dir, 5);
states.add(deserializedState);
assertEquals(
states.size(),
diff --git a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/state/SwirldStateManagerTests.java b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/state/SwirldStateManagerTests.java
index 21238be8a06d..80ccb927b3c7 100644
--- a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/state/SwirldStateManagerTests.java
+++ b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/state/SwirldStateManagerTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022-2024 Hedera Hashgraph, LLC
+ * Copyright (C) 2024 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,7 +44,7 @@
class SwirldStateManagerTests {
private SwirldStateManager swirldStateManager;
- private MerkleRoot initialState;
+ private PlatformMerkleStateRoot initialState;
@BeforeEach
void setup() {
@@ -125,7 +125,7 @@ void loadFromSignedStateRefCount() {
+ "decremented.");
}
- private static MerkleRoot newState() {
+ private static PlatformMerkleStateRoot newState() {
final PlatformMerkleStateRoot state = new PlatformMerkleStateRoot(
FAKE_MERKLE_STATE_LIFECYCLES, version -> new BasicSoftwareVersion(version.major()));
FAKE_MERKLE_STATE_LIFECYCLES.initPlatformState(state);
diff --git a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/state/SwirldStateManagerUtilsTests.java b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/state/SwirldStateManagerUtilsTests.java
index 76cfe53cde02..4bf8fc0bbed8 100644
--- a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/state/SwirldStateManagerUtilsTests.java
+++ b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/state/SwirldStateManagerUtilsTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018-2024 Hedera Hashgraph, LLC
+ * Copyright (C) 2024 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,7 +39,8 @@ void testFastCopyIsMutable() {
FAKE_MERKLE_STATE_LIFECYCLES.initPlatformState(state);
state.reserve();
final SwirldStateMetrics stats = mock(SwirldStateMetrics.class);
- final MerkleRoot result = SwirldStateManagerUtils.fastCopy(state, stats, new BasicSoftwareVersion(1));
+ final PlatformMerkleStateRoot result =
+ SwirldStateManagerUtils.fastCopy(state, stats, new BasicSoftwareVersion(1));
assertFalse(result.isImmutable(), "The copy state should be mutable.");
assertEquals(
diff --git a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/state/hashlogger/HashLoggerTest.java b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/state/hashlogger/HashLoggerTest.java
index 09d5beadc45e..3b56272a8e6f 100644
--- a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/state/hashlogger/HashLoggerTest.java
+++ b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/state/hashlogger/HashLoggerTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022-2024 Hedera Hashgraph, LLC
+ * Copyright (C) 2024 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,7 +35,7 @@
import com.swirlds.config.api.Configuration;
import com.swirlds.config.extensions.test.fixtures.TestConfigBuilder;
import com.swirlds.platform.config.StateConfig_;
-import com.swirlds.platform.state.MerkleRoot;
+import com.swirlds.platform.state.PlatformMerkleStateRoot;
import com.swirlds.platform.state.PlatformStateAccessor;
import com.swirlds.platform.state.signed.ReservedSignedState;
import com.swirlds.platform.state.signed.SignedState;
@@ -150,7 +150,8 @@ private ReservedSignedState createSignedState(final long round) {
final MerkleNode merkleNode = MerkleTestUtils.buildLessSimpleTree();
MerkleCryptoFactory.getInstance().digestTreeSync(merkleNode);
final SignedState signedState = mock(SignedState.class);
- final MerkleRoot state = mock(MerkleRoot.class, withSettings().extraInterfaces(State.class, SwirldState.class));
+ final PlatformMerkleStateRoot state =
+ mock(PlatformMerkleStateRoot.class, withSettings().extraInterfaces(State.class, SwirldState.class));
final PlatformStateAccessor platformState = mock(PlatformStateAccessor.class);
when(platformState.getRound()).thenReturn(round);
@@ -160,7 +161,6 @@ private ReservedSignedState createSignedState(final long round) {
when(state.getHash()).thenReturn(merkleNode.getHash());
when(signedState.getState()).thenReturn(state);
- when(state.getSwirldState()).thenReturn((SwirldState) state);
when(signedState.getRound()).thenReturn(round);
ReservedSignedState reservedSignedState = mock(ReservedSignedState.class);
diff --git a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/system/state/notifications/StateHashedNotificationTest.java b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/system/state/notifications/StateHashedNotificationTest.java
index 3f6c32024fc7..f44c8b942200 100644
--- a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/system/state/notifications/StateHashedNotificationTest.java
+++ b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/system/state/notifications/StateHashedNotificationTest.java
@@ -23,7 +23,7 @@
import com.swirlds.common.crypto.Hash;
import com.swirlds.platform.components.transaction.system.ScopedSystemTransaction;
import com.swirlds.platform.internal.ConsensusRound;
-import com.swirlds.platform.state.MerkleRoot;
+import com.swirlds.platform.state.PlatformMerkleStateRoot;
import com.swirlds.platform.state.signed.ReservedSignedState;
import com.swirlds.platform.state.signed.SignedState;
import com.swirlds.platform.wiring.components.StateAndRound;
@@ -39,7 +39,7 @@ class StateHashedNotificationTest {
private static final Hash HASH = new Hash(new byte[48]);
@Mock
- private MerkleRoot merkleRoot;
+ private PlatformMerkleStateRoot merkleRoot;
@Mock
private SignedState signedState;
diff --git a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/turtle/runner/TurtleNode.java b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/turtle/runner/TurtleNode.java
index b3f17736b056..227ef6dd2588 100644
--- a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/turtle/runner/TurtleNode.java
+++ b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/turtle/runner/TurtleNode.java
@@ -37,7 +37,7 @@
import com.swirlds.platform.config.BasicConfig_;
import com.swirlds.platform.crypto.KeysAndCerts;
import com.swirlds.platform.roster.RosterUtils;
-import com.swirlds.platform.state.MerkleRoot;
+import com.swirlds.platform.state.PlatformMerkleStateRoot;
import com.swirlds.platform.system.BasicSoftwareVersion;
import com.swirlds.platform.system.Platform;
import com.swirlds.platform.system.address.AddressBook;
@@ -103,7 +103,7 @@ public class TurtleNode {
model = WiringModelBuilder.create(platformContext)
.withDeterministicModeEnabled(true)
.build();
- final Supplier genesisStateSupplier = TurtleTestingToolState::getStateRootNode;
+ final Supplier genesisStateSupplier = TurtleTestingToolState::getStateRootNode;
final var version = new BasicSoftwareVersion(1);
final var metrics = getMetricsProvider().createPlatformMetrics(nodeId);
diff --git a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/turtle/runner/TurtleTestingToolState.java b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/turtle/runner/TurtleTestingToolState.java
index f4547d45a1cd..9e9231159cbe 100644
--- a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/turtle/runner/TurtleTestingToolState.java
+++ b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/turtle/runner/TurtleTestingToolState.java
@@ -107,7 +107,7 @@ public TurtleTestingToolState copy() {
* @return merkle tree root
*/
@NonNull
- public static MerkleRoot getStateRootNode() {
+ public static PlatformMerkleStateRoot getStateRootNode() {
final PlatformMerkleStateRoot state = new TurtleTestingToolState();
FAKE_MERKLE_STATE_LIFECYCLES.initPlatformState(state);
return state;
diff --git a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/wiring/SignedStateReserverTest.java b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/wiring/SignedStateReserverTest.java
index 2ac17245facf..a1acab1071d8 100644
--- a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/wiring/SignedStateReserverTest.java
+++ b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/wiring/SignedStateReserverTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2023-2024 Hedera Hashgraph, LLC
+ * Copyright (C) 2024 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,7 +30,7 @@
import com.swirlds.common.wiring.wires.input.BindableInputWire;
import com.swirlds.common.wiring.wires.output.OutputWire;
import com.swirlds.platform.crypto.SignatureVerifier;
-import com.swirlds.platform.state.MerkleRoot;
+import com.swirlds.platform.state.PlatformMerkleStateRoot;
import com.swirlds.platform.state.signed.ReservedSignedState;
import com.swirlds.platform.state.signed.SignedState;
import java.util.List;
@@ -51,7 +51,7 @@ void basicTest() {
final SignedState signedState = new SignedState(
platformContext.getConfiguration(),
Mockito.mock(SignatureVerifier.class),
- Mockito.mock(MerkleRoot.class),
+ Mockito.mock(PlatformMerkleStateRoot.class),
"create",
false,
false,
diff --git a/platform-sdk/swirlds-platform-core/src/testFixtures/java/com/swirlds/platform/test/fixtures/state/BlockingSwirldState.java b/platform-sdk/swirlds-platform-core/src/testFixtures/java/com/swirlds/platform/test/fixtures/state/BlockingSwirldState.java
index 29b3ade2f864..7b18be87da68 100644
--- a/platform-sdk/swirlds-platform-core/src/testFixtures/java/com/swirlds/platform/test/fixtures/state/BlockingSwirldState.java
+++ b/platform-sdk/swirlds-platform-core/src/testFixtures/java/com/swirlds/platform/test/fixtures/state/BlockingSwirldState.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2023-2024 Hedera Hashgraph, LLC
+ * Copyright (C) 2024 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,7 +26,6 @@
import com.swirlds.common.io.streams.SerializableDataInputStream;
import com.swirlds.common.io.streams.SerializableDataOutputStream;
import com.swirlds.platform.components.transaction.system.ScopedSystemTransaction;
-import com.swirlds.platform.state.MerkleRoot;
import com.swirlds.platform.state.PlatformMerkleStateRoot;
import com.swirlds.platform.state.PlatformStateModifier;
import com.swirlds.platform.system.BasicSoftwareVersion;
@@ -41,8 +40,8 @@
import java.util.function.Consumer;
/**
- * A test implementation of {@link MerkleRoot} and {@link SwirldState} state for SignedStateManager unit tests.
- * Node that some of the {@link MerkleRoot} methods are intentionally not implemented. If a test needs these methods,
+ * A test implementation of {@link PlatformMerkleStateRoot} and {@link SwirldState} state for SignedStateManager unit tests.
+ * Node that some of the {@link PlatformMerkleStateRoot} methods are intentionally not implemented. If a test needs these methods,
* {@link MerkleStateRoot} should be used instead.
*/
public class BlockingSwirldState extends PlatformMerkleStateRoot {
diff --git a/platform-sdk/swirlds-platform-core/src/testFixtures/java/com/swirlds/platform/test/fixtures/state/RandomSignedStateGenerator.java b/platform-sdk/swirlds-platform-core/src/testFixtures/java/com/swirlds/platform/test/fixtures/state/RandomSignedStateGenerator.java
index 15069294bd83..80536e8ea87a 100644
--- a/platform-sdk/swirlds-platform-core/src/testFixtures/java/com/swirlds/platform/test/fixtures/state/RandomSignedStateGenerator.java
+++ b/platform-sdk/swirlds-platform-core/src/testFixtures/java/com/swirlds/platform/test/fixtures/state/RandomSignedStateGenerator.java
@@ -39,7 +39,6 @@
import com.swirlds.platform.consensus.ConsensusSnapshot;
import com.swirlds.platform.crypto.SignatureVerifier;
import com.swirlds.platform.roster.RosterUtils;
-import com.swirlds.platform.state.MerkleRoot;
import com.swirlds.platform.state.MinimumJudgeInfo;
import com.swirlds.platform.state.PlatformMerkleStateRoot;
import com.swirlds.platform.state.PlatformStateModifier;
@@ -77,7 +76,7 @@ public class RandomSignedStateGenerator {
final Random random;
- private MerkleRoot state;
+ private PlatformMerkleStateRoot state;
private Long round;
private Hash legacyRunningEventHash;
private Roster roster;
@@ -138,7 +137,7 @@ public SignedState build() {
softwareVersionInstance = softwareVersion;
}
- final MerkleRoot stateInstance;
+ final PlatformMerkleStateRoot stateInstance;
registerMerkleStateRootClassIds();
if (state == null) {
if (useBlockingState) {
@@ -147,7 +146,7 @@ public SignedState build() {
stateInstance = new PlatformMerkleStateRoot(
FAKE_MERKLE_STATE_LIFECYCLES, version -> new BasicSoftwareVersion(version.major()));
}
- ((MerkleStateRoot) stateInstance).setTime(Time.getCurrent());
+ stateInstance.setTime(Time.getCurrent());
} else {
stateInstance = state;
}
diff --git a/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/StateTest.java b/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/StateTest.java
index 375b1f708f8b..6b6d36b915e8 100644
--- a/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/StateTest.java
+++ b/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/StateTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2020-2024 Hedera Hashgraph, LLC
+ * Copyright (C) 2024 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,7 +28,6 @@
import com.swirlds.common.test.fixtures.junit.tags.TestComponentTags;
import com.swirlds.common.test.fixtures.platform.TestPlatformContextBuilder;
import com.swirlds.platform.crypto.CryptoStatic;
-import com.swirlds.platform.state.MerkleRoot;
import com.swirlds.platform.state.PlatformMerkleStateRoot;
import com.swirlds.platform.state.signed.SignedState;
import com.swirlds.platform.system.BasicSoftwareVersion;
@@ -45,8 +44,8 @@ class StateTest {
@DisplayName("Test Copy")
void testCopy() {
- final MerkleRoot state = randomSignedState().getState();
- final MerkleRoot copy = state.copy();
+ final PlatformMerkleStateRoot state = randomSignedState().getState();
+ final PlatformMerkleStateRoot copy = state.copy();
assertNotSame(state, copy, "copy should not return the same object");
@@ -67,7 +66,7 @@ void testCopy() {
@Tag(TestComponentTags.MERKLE)
@DisplayName("Test Try Reserve")
void tryReserveTest() {
- final MerkleRoot state = randomSignedState().getState();
+ final PlatformMerkleStateRoot state = randomSignedState().getState();
assertEquals(
1,
state.getReservationCount(),
diff --git a/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/StateTests.java b/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/StateTests.java
index 5457d9b685eb..f06478b51f4a 100644
--- a/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/StateTests.java
+++ b/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/StateTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021-2024 Hedera Hashgraph, LLC
+ * Copyright (C) 2024 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,7 +26,7 @@
import com.swirlds.common.test.fixtures.io.InputOutputStream;
import com.swirlds.common.test.fixtures.junit.tags.TestComponentTags;
import com.swirlds.config.extensions.test.fixtures.TestConfigBuilder;
-import com.swirlds.platform.state.MerkleRoot;
+import com.swirlds.platform.state.PlatformMerkleStateRoot;
import com.swirlds.platform.test.fixtures.state.BlockingSwirldState;
import com.swirlds.state.merkle.MerkleStateRoot;
import java.io.IOException;
@@ -70,7 +70,7 @@ void stateSerializationTest() throws IOException {
io.startReading();
- final MerkleRoot decodedState = io.getInput().readMerkleTree(testDirectory, Integer.MAX_VALUE);
+ final PlatformMerkleStateRoot decodedState = io.getInput().readMerkleTree(testDirectory, Integer.MAX_VALUE);
MerkleCryptoFactory.getInstance().digestTreeSync(decodedState);
assertEquals(merkleStateRoot.getHash(), decodedState.getHash(), "expected trees to be equal");
diff --git a/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/state/IssDetectorTests.java b/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/state/IssDetectorTests.java
index 38ad75bf149e..a8e5a5bc1464 100644
--- a/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/state/IssDetectorTests.java
+++ b/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/state/IssDetectorTests.java
@@ -44,7 +44,7 @@
import com.swirlds.platform.internal.ConsensusRound;
import com.swirlds.platform.internal.EventImpl;
import com.swirlds.platform.roster.RosterUtils;
-import com.swirlds.platform.state.MerkleRoot;
+import com.swirlds.platform.state.PlatformMerkleStateRoot;
import com.swirlds.platform.state.iss.DefaultIssDetector;
import com.swirlds.platform.state.iss.IssDetector;
import com.swirlds.platform.state.iss.internal.HashValidityStatus;
@@ -764,7 +764,7 @@ void ignoredRoundTest() {
private static ReservedSignedState mockState(final long round, final Hash hash) {
final ReservedSignedState rs = mock(ReservedSignedState.class);
final SignedState ss = mock(SignedState.class);
- final MerkleRoot s = mock(MerkleRoot.class);
+ final PlatformMerkleStateRoot s = mock(PlatformMerkleStateRoot.class);
when(rs.get()).thenReturn(ss);
when(ss.getState()).thenReturn(s);
when(ss.getRound()).thenReturn(round);
diff --git a/settings.gradle.kts b/settings.gradle.kts
index 0630c1461051..f1d55a92049b 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-plugins { id("org.hiero.gradle.build") version "0.1.2" }
+plugins { id("org.hiero.gradle.build") version "0.1.4" }
javaModules {
// This "intermediate parent project" should be removed