diff --git a/.github/actions/capture_test_logs/action.yml b/.github/actions/capture_test_logs/action.yml new file mode 100644 index 00000000000..bb9200f11af --- /dev/null +++ b/.github/actions/capture_test_logs/action.yml @@ -0,0 +1,11 @@ +name: capture_test_logs +description: "Capture test logs" +runs: + using: composite + steps: + - uses: actions/upload-artifact@v3.1.3 + with: + path: acceptance-tests/tests/build/acceptanceTestLogs + - uses: actions/upload-artifact@v3.1.3 + with: + path: acceptance-tests/tests/build/jvmErrorLogs \ No newline at end of file diff --git a/.github/actions/capture_test_results/action.yml b/.github/actions/capture_test_results/action.yml new file mode 100644 index 00000000000..ea0206a6c7e --- /dev/null +++ b/.github/actions/capture_test_results/action.yml @@ -0,0 +1,26 @@ +name: capture_test_results +description: "Capture test results" +runs: + using: composite + steps: + - name: Jacoco + run: "./gradlew --no-daemon jacocoTestReport" + shell: bash + - name: Gather test results + run: |- + FILES=`find . -name test-results` + for FILE in $FILES + do + MODULE=`echo "$FILE" | sed -e 's@./\(.*\)/build/test-results@\1@'` + TARGET="build/test-results/$MODULE" + mkdir -p "$TARGET" + cp -rf ${FILE}/*/* "$TARGET" + done + if: always() + shell: bash + - uses: actions/upload-artifact@v3.1.3 + with: + path: build/test-results + - uses: actions/upload-artifact@v3.1.3 + with: + path: besu/build/reports/jacoco \ No newline at end of file diff --git a/.github/actions/prepare/action.yml b/.github/actions/prepare/action.yml new file mode 100644 index 00000000000..16fbf1b69f0 --- /dev/null +++ b/.github/actions/prepare/action.yml @@ -0,0 +1,14 @@ +name: prepare +description: "Prepare the environment for the build" +runs: + using: composite + steps: + - uses: actions/checkout@v4.1.0 + - name: Install Packages - LibSodium, nssdb + shell: bash + run: |- + sudo apt-get update + sudo apt-get install -y libsodium23 libsodium-dev libjemalloc-dev apt-transport-https haveged libnss3-tools + sudo service haveged restart + java --version + - uses: "./.github/actions/restore_gradle_cache" \ No newline at end of file diff --git a/.github/actions/restore_gradle_cache/action.yml b/.github/actions/restore_gradle_cache/action.yml new file mode 100644 index 00000000000..ba421cc4864 --- /dev/null +++ b/.github/actions/restore_gradle_cache/action.yml @@ -0,0 +1,14 @@ +name: restore_gradle_cache +description: "Restore the gradle cache" +runs: + using: composite + steps: + - name: restore_cache + uses: actions/cache@v3.3.2 + with: + key: deps-{{ checksum "gradle/versions.gradle" }}-{{ .Branch }}-{{ .Revision }} + path: UPDATE_ME + restore-keys: |- + deps-{{ checksum "gradle/versions.gradle" }}-{{ .Branch }}-{{ .Revision }} + deps-{{ checksum "gradle/versions.gradle" }} + deps- \ No newline at end of file diff --git a/.github/workflows/default.yml b/.github/workflows/default.yml new file mode 100644 index 00000000000..0d3b64c84a0 --- /dev/null +++ b/.github/workflows/default.yml @@ -0,0 +1,323 @@ +name: default +on: + push: + branches: + - op-stack + - main + pull_request: +jobs: + assemble: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4.1.0 + - uses: "./.github/actions/prepare" + - name: Set up Java + uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 + with: + distribution: temurin + java-version: 21 + - name: setup gradle + uses: gradle/actions/setup-gradle@9e899d11ad247ec76be7a60bc1cf9d3abbb9e7f1 + with: + cache-disabled: true + - name: Assemble + run: "./gradlew --no-daemon clean compileJava compileTestJava assemble" + - name: save_cache + uses: actions/cache@v3.3.2 + with: + path: |- + .gradle + ~/.gradle + key: deps-{{ checksum "gradle/versions.gradle" }}-{{ .Branch }}-{{ .Revision }} + - uses: actions/upload-artifact@v3.1.3 + with: + path: build/assemble + - uses: actions/upload-artifact@v3.1.3 + with: + path: build/distributions + unitTests: + runs-on: ubuntu-latest + needs: + - assemble + steps: + - uses: actions/checkout@v4.1.0 + - uses: "./.github/actions/prepare" + - name: Set up Java + uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 + with: + distribution: temurin + java-version: 21 + - uses: actions/download-artifact@v3.0.2 + with: + path: build/assemble + - name: Build + run: "./gradlew --no-daemon build -x test" + - uses: "./.github/actions/capture_test_results" + # testWindows: + # runs-on: windows-latest + # needs: + # - assemble + # steps: + # - uses: actions/download-artifact@v3.0.2 + # with: + # path: build/assemble + # - name: Unzip Windows build + # run: |- + # cd build/distributions + # unzip besu-*.zip -d besu-tmp + # cd besu-tmp + # mv besu-* ../besu + # - name: Test Besu Windows executable + # run: |- + # build\distributions\besu\bin\besu.bat --help + # build\distributions\besu\bin\besu.bat --version + referenceTests: + runs-on: ubuntu-latest + needs: + - assemble + steps: + - uses: actions/checkout@v4.1.0 + - uses: "./.github/actions/prepare" + - name: Set up Java + uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 + with: + distribution: temurin + java-version: 21 + - uses: actions/download-artifact@v3.0.2 + with: + path: build/assemble + - name: ReferenceTests + run: |- + git submodule update --init --recursive + ./gradlew --no-daemon referenceTest + - uses: "./.github/actions/capture_test_results" + integrationTests: + runs-on: ubuntu-latest + needs: + - assemble + steps: + - uses: actions/checkout@v4.1.0 + - uses: "./.github/actions/prepare" + - name: Set up Java + uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 + with: + distribution: temurin + java-version: 21 + - uses: actions/download-artifact@v3.0.2 + with: + path: build/assemble + - name: IntegrationTests + run: "./gradlew --no-daemon integrationTest" + - name: CompileJmh + run: "./gradlew --no-daemon compileJmh" + - uses: "./.github/actions/capture_test_results" +# acceptanceTests: +# runs-on: ubuntu-latest +# container: +# image: cimg/openjdk:17.0 +# needs: +# - assemble +# steps: +# - uses: actions/checkout@v4.1.0 +# - uses: "./.github/actions/prepare" +# - uses: actions/download-artifact@v3.0.2 +# with: +# path: build/assemble +# - name: AcceptanceTests (Mainnet) +# run: |- +# ./gradlew --no-daemon acceptanceTestMainnet +# - uses: "./.github/actions/capture_test_results" +# - uses: "./.github/actions/capture_test_logs" +# acceptanceTestsCliqueBft: +# runs-on: ubuntu-latest +# container: +# image: cimg/openjdk:17.0 +# needs: +# - assemble +# steps: +# - uses: actions/checkout@v4.1.0 +# - uses: "./.github/actions/prepare" +# - uses: actions/download-artifact@v3.0.2 +# with: +# path: build/assemble +# - name: AcceptanceTests (Non-Mainnet) +# run: |- +# ./gradlew --no-daemon acceptanceTestCliqueBft +# - uses: "./.github/actions/capture_test_results" +# - uses: "./.github/actions/capture_test_logs" +# acceptanceTestsPrivacy: +# runs-on: ubuntu-latest +# container: +# image: cimg/openjdk:17.0 +# needs: +# - assemble +# steps: +# - uses: actions/checkout@v4.1.0 +# - uses: "./.github/actions/prepare" +# - uses: actions/download-artifact@v3.0.2 +# with: +# path: build/assemble +# - name: AcceptanceTests (Non-Mainnet) +# run: |- +# ./gradlew --no-daemon acceptanceTestPrivacy +# - uses: "./.github/actions/capture_test_results" +# - uses: "./.github/actions/capture_test_logs" +# acceptanceTestsPermissioning: +# runs-on: ubuntu-latest +# container: +# image: cimg/openjdk:17.0 +# needs: +# - assemble +# steps: +# - uses: actions/checkout@v4.1.0 +# - uses: "./.github/actions/prepare" +# - uses: actions/download-artifact@v3.0.2 +# with: +# path: build/assemble +# - name: AcceptanceTests (Non-Mainnet) +# run: |- +# ./gradlew --no-daemon acceptanceTestPermissioning +# - uses: "./.github/actions/capture_test_results" +# - uses: "./.github/actions/capture_test_logs" +# buildDocker: +# runs-on: ubuntu-latest +# container: +# image: cimg/openjdk:17.0 +# needs: +# - assemble +# steps: +# - uses: actions/checkout@v4.1.0 +# - uses: "./.github/actions/prepare" +# - uses: actions/download-artifact@v3.0.2 +# with: +# path: build/assemble +## # 'setup_remote_docker' was not transformed because there is no suitable equivalent in GitHub Actions +# - name: hadoLint_openjdk_17 +# run: docker run --rm -i hadolint/hadolint < docker/openjdk-17/Dockerfile +# - name: hadoLint_openjdk_17_debug +# run: docker run --rm -i hadolint/hadolint < docker/openjdk-17-debug/Dockerfile +# - name: hadoLint_openjdk_latest +# run: docker run --rm -i hadolint/hadolint < docker/openjdk-latest/Dockerfile +# - name: hadoLint_graalvm +# run: docker run --rm -i hadolint/hadolint < docker/graalvm/Dockerfile +# - name: build image +# run: "./gradlew --no-daemon distDocker" +# - name: test image +# run: |- +# mkdir -p docker/reports +# curl -L https://github.com/aelsabbahy/goss/releases/download/v0.3.9/goss-linux-amd64 -o ./docker/tests/goss-linux-amd64 +# ./gradlew --no-daemon testDocker +# buildArm64Docker: +# runs-on: ubuntu-latest +# needs: +# - assemble +# steps: +# - uses: actions/checkout@v4.1.0 +# - uses: "./.github/actions/prepare" +# - uses: actions/download-artifact@v3.0.2 +# with: +# path: build/assemble +# - name: hadoLint_openjdk_17 +# run: docker run --rm -i hadolint/hadolint < docker/openjdk-17/Dockerfile +# - name: hadoLint_openjdk_latest +# run: docker run --rm -i hadolint/hadolint < docker/openjdk-latest/Dockerfile +# - name: hadoLint_graalvm +# run: docker run --rm -i hadolint/hadolint < docker/graalvm/Dockerfile +# - name: Java_17 +# run: |- +# sudo apt install -q --assume-yes openjdk-17-jre-headless openjdk-17-jdk-headless +# sudo update-java-alternatives -a +# - name: build image +# run: "./gradlew --no-daemon distDocker" +# - name: test image +# run: |- +# mkdir -p docker/reports +# curl -L https://github.com/aelsabbahy/goss/releases/download/v0.3.9/goss-linux-arm -o ./docker/tests/goss-linux-arm64 +# ./gradlew --no-daemon testDocker + +# publish: +# if: # GitHub does not currently support regular expressions inside if conditions +## github.ref == 'refs/heads/main' || github.ref == 'refs/heads//^release-.*/' +# runs-on: ubuntu-latest +# container: +# image: cimg/openjdk:17.0 +# needs: +# - assemble +# - integrationTests +# - unitTests +# - acceptanceTests +# - referenceTests +# - buildDocker +# steps: +# - uses: actions/checkout@v4.1.0 +# - uses: "./.github/actions/prepare" +# - uses: actions/download-artifact@v3.0.2 +# with: +# path: "~/project" +# - name: Publish +# run: "./gradlew --no-daemon artifactoryPublish" +# publishDocker: +# if: # GitHub does not currently support regular expressions inside if conditions +## github.ref == 'refs/heads/main' || github.ref == 'refs/heads//^release-.*/' +# runs-on: ubuntu-latest +# container: +# image: cimg/openjdk:17.0 +# needs: +# - assemble +# - integrationTests +# - unitTests +# - acceptanceTests +# - referenceTests +# - buildDocker +# steps: +# - uses: actions/checkout@v4.1.0 +# - uses: "./.github/actions/prepare" +# - uses: actions/download-artifact@v3.0.2 +# with: +# path: "~/project" +## # 'setup_remote_docker' was not transformed because there is no suitable equivalent in GitHub Actions +# - name: Publish Docker +# run: |- +# docker login --username "${DOCKER_USER_RW}" --password "${DOCKER_PASSWORD_RW}" +# ./gradlew --no-daemon "-Pbranch=${{ github.ref }}" dockerUpload +# publishArm64Docker: +# if: # GitHub does not currently support regular expressions inside if conditions +## github.ref == 'refs/heads/main' || github.ref == 'refs/heads//^release-.*/' +# runs-on: ubuntu-latest +# needs: +# - integrationTests +# - unitTests +# - acceptanceTests +# - referenceTests +# - buildArm64Docker +# steps: +# - uses: actions/checkout@v4.1.0 +# - uses: "./.github/actions/prepare" +# - uses: actions/download-artifact@v3.0.2 +# with: +# path: "~/project" +# - name: Java_17 +# run: |- +# sudo apt install -q --assume-yes openjdk-17-jre-headless openjdk-17-jdk-headless +# sudo update-java-alternatives -a +# - name: Publish Docker +# run: |- +# docker login --username "${DOCKER_USER_RW}" --password "${DOCKER_PASSWORD_RW}" +# ./gradlew --no-daemon "-Pbranch=${{ github.ref }}" dockerUpload +# manifestDocker: +# if: # GitHub does not currently support regular expressions inside if conditions +## github.ref == 'refs/heads/main' || github.ref == 'refs/heads//^release-.*/' +# runs-on: ubuntu-latest +# container: +# image: cimg/openjdk:17.0 +# needs: +# - publishDocker +# - publishArm64Docker +# steps: +# - uses: actions/checkout@v4.1.0 +# - uses: "./.github/actions/prepare" +## # 'setup_remote_docker' was not transformed because there is no suitable equivalent in GitHub Actions +# - name: Create and publish docker manifest +# run: |- +# docker login --username "${DOCKER_USER_RW}" --password "${DOCKER_PASSWORD_RW}" +# ./gradlew --no-daemon "-Pbranch=${{ github.ref }}" --parallel manifestDocker diff --git a/.github/workflows/pages.yaml b/.github/workflows/pages.yaml new file mode 100644 index 00000000000..7e204ae09f0 --- /dev/null +++ b/.github/workflows/pages.yaml @@ -0,0 +1,36 @@ +name: Build and publish forkdiff github-pages +permissions: + contents: write +on: + push: + branches: + - op-stack +jobs: + deploy: + concurrency: ci-${{ github.ref }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 500 # make sure to fetch the old commit we diff against + + - name: Build forkdiff + uses: "docker://protolambda/forkdiff:latest" + with: + args: -repo=/github/workspace -fork=/github/workspace/fork.yaml -out=/github/workspace/index.html + + - name: Build pages + run: | + mkdir -p tmp/pages + mv index.html tmp/pages/index.html + touch tmp/pages/.nojekyll + if [ "$GITHUB_REPOSITORY" == "optimism-java/op-besu" ]; then + echo "op-besu.github.io" > tmp/pages/CNAME + fi; + + - name: Deploy + uses: JamesIves/github-pages-deploy-action@v4 + with: + folder: tmp/pages + clean: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2aff0bb48e5..cbd8d44c2ba 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,20 +35,20 @@ jobs: id: hashes run: | cd build/distributions - echo "zipSha=$(shasum -a 256 besu*.zip)" - echo "tarSha=$(shasum -a 256 besu*.tar.gz)" - echo "zipSha=$(shasum -a 256 besu*.zip)" >> $GITHUB_OUTPUT - echo "tarSha=$(shasum -a 256 besu*.tar.gz)" >> $GITHUB_OUTPUT + echo "zipSha=$(shasum -a 256 op-besu*.zip)" + echo "tarSha=$(shasum -a 256 op-besu*.tar.gz)" + echo "zipSha=$(shasum -a 256 op-besu*.zip)" >> $GITHUB_OUTPUT + echo "tarSha=$(shasum -a 256 op-besu*.tar.gz)" >> $GITHUB_OUTPUT - name: upload tarball uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 with: - path: 'build/distributions/besu*.tar.gz' - name: besu-${{ github.event.release.name }}.tar.gz + path: 'build/distributions/op-besu*.tar.gz' + name: op-besu-${{ github.event.release.name }}.tar.gz compression-level: 0 - name: upload zipfile uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 with: - path: 'build/distributions/besu*.zip' + path: 'build/distributions/op-besu*.zip' name: besu-${{ github.event.release.name }}.zip compression-level: 0 @@ -65,17 +65,17 @@ jobs: - name: Download zip uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe with: - pattern: besu-*.zip + pattern: op-besu-*.zip merge-multiple: true - name: test Besu run: | dir - unzip besu-*.zip -d besu-tmp - cd besu-tmp - mv besu-* ../besu + unzip op-besu-*.zip -d op-besu-tmp + cd op-besu-tmp + mv op-besu-* ../op-besu cd .. - besu\bin\besu.bat --help - besu\bin\besu.bat --version + op-besu\bin\besu.bat --help + op-besu\bin\besu.bat --version publish: runs-on: ubuntu-22.04 @@ -86,7 +86,7 @@ jobs: - name: Download archives uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe with: - pattern: besu-* + pattern: op-besu-* merge-multiple: true path: 'build/distributions' - name: Upload Release assets @@ -94,8 +94,8 @@ jobs: with: append_body: true files: | - build/distributions/besu*.tar.gz - build/distributions/besu*.zip + build/distributions/op-besu*.tar.gz + build/distributions/op-besu*.zip body: | ${{needs.artifacts.outputs.tarSha}} ${{needs.artifacts.outputs.zipSha}} diff --git a/.gitignore b/.gitignore index e1c936fd623..c55bf6b411e 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,7 @@ out/ site/ /kubernetes/reports/ /kubernetes/besu-*.tar.gz +/kubernetes/op-besu-*.tar.gz **/src/*/generated jitpack.yml /ethereum/eth/src/test/resources/tx.csv.gz diff --git a/build.gradle b/build.gradle index b26f36b5194..f8076c22ac6 100644 --- a/build.gradle +++ b/build.gradle @@ -743,7 +743,7 @@ tasks.register("dockerDistUntar") { into(dockerBuildDir) } project.delete(files("${dockerBuildDir}/besu")) - file("${dockerBuildDir}/${distTarFileName}").renameTo("${dockerBuildDir}/besu") + file("${dockerBuildDir}/${distTarFileName}").renameTo("${dockerBuildDir}/op-besu") } } diff --git a/docker/.gitignore b/docker/.gitignore index f66d61166c1..3c24e26df4d 100644 --- a/docker/.gitignore +++ b/docker/.gitignore @@ -1,4 +1,7 @@ besu-*.tar.gz +op-besu-*.tar.gz besu/* +op-besu/* besu-* +op-besu-* reports/* diff --git a/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/benchmarks/BenchmarkExecutor.java b/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/benchmarks/BenchmarkExecutor.java index 50a6df67d46..6220da5fa5a 100644 --- a/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/benchmarks/BenchmarkExecutor.java +++ b/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/benchmarks/BenchmarkExecutor.java @@ -141,7 +141,7 @@ public static GasCalculator gasCalculatorForFork(final String fork) { case BERLIN -> new BerlinGasCalculator(); case LONDON, PARIS -> new LondonGasCalculator(); case SHANGHAI -> new ShanghaiGasCalculator(); - case CANCUN -> new CancunGasCalculator(); + case CANCUN,FJORD -> new CancunGasCalculator(); case PRAGUE -> new PragueGasCalculator(); case PRAGUE_EOF, OSAKA, AMSTERDAM, BOGOTA, POLIS, BANGKOK, FUTURE_EIPS, EXPERIMENTAL_EIPS -> new PragueEOFGasCalculator(); diff --git a/fork.yaml b/fork.yaml index 401ba5e84ec..f8c2146ebbd 100644 --- a/fork.yaml +++ b/fork.yaml @@ -4,11 +4,11 @@ footer: | # define the footer with markdown base: name: hyperledger/besu url: https://github.com/hyperledger/besu - hash: 287f0c206e8ac668ffb5ec908128724b6338a294 + hash: 86b9c38015590923c3c24d0599a17385c55c7332 fork: name: optimism-java/op-besu url: https://github.com/optimism-java/op-besu - ref: refs/heads/release-23.10.x + ref: refs/heads/op-stack def: title: "op-besu" description: | # description in markdown @@ -152,12 +152,10 @@ def: ignore: - "*.sum" - ".gitignore" - - ".github/**/*" - - ".github/actions/**/*.yml" - ".circleci/**/*" - - ".circleci-nouse/**/*" - "gradle/*" - "**/*.yml" - "fork.yaml" - - "Dockerfile" - "README.md" + - "evm/src/test/resources/org/hyperledger/besu/evm/precompile/p256Verify.json" + - "config/src/main/resources/optimism-sepolia.json"