diff --git a/.github/workflows/ci-expanded.yml b/.github/workflows/ci-expanded.yml index 46f0f2a5..0dfbdadd 100644 --- a/.github/workflows/ci-expanded.yml +++ b/.github/workflows/ci-expanded.yml @@ -603,6 +603,14 @@ jobs: ./emulation fi + - name: Register warning matcher + shell: bash + run: | + cat > "$RUNNER_TEMP/warning-matcher.json" << 'EOF' + {"problemMatcher":[{"owner":"gcc-warning","severity":"warning","pattern":[{"regexp":"^([^\\s:(][^:(]*):(\\d+):(\\d+):\\s+warning:\\s+(.*?)(?:\\s+\\[(-W[^\\]]+)\\])?$","file":1,"line":2,"column":3,"message":4,"code":5}]},{"owner":"msvc-warning","severity":"warning","pattern":[{"regexp":"^\\s*(?:\\d+>)?([^\\s(][^(]*)\\((\\d+)(?:,(\\d+))?\\)\\s*:\\s+warning\\s+(C\\d+)\\s*:\\s*(.*?)(?:\\s+\\[[^\\]]+\\])?$","file":1,"line":2,"column":3,"code":4,"message":5}]},{"owner":"clang-cl-warning","severity":"warning","pattern":[{"regexp":"^\\s*(?:\\d+>)?([^\\s(][^(]*)\\((\\d+)(?:,(\\d+))?\\)\\s*:\\s+warning:\\s+(.*?)(?:\\s+\\[(-W[^\\]]+)\\])?$","file":1,"line":2,"column":3,"message":4,"code":5}]}]} + EOF + echo "::add-matcher::$RUNNER_TEMP/warning-matcher.json" + - name: Execute installation shell: bash working-directory: 'libbitcoin-node' @@ -819,6 +827,14 @@ jobs: echo "LDFLAGS=-Wl,-rpath,${{ github.workspace }}/prefix/lib" >> $GITHUB_ENV fi + - name: Register warning matcher + shell: bash + run: | + cat > "$RUNNER_TEMP/warning-matcher.json" << 'EOF' + {"problemMatcher":[{"owner":"gcc-warning","severity":"warning","pattern":[{"regexp":"^([^\\s:(][^:(]*):(\\d+):(\\d+):\\s+warning:\\s+(.*?)(?:\\s+\\[(-W[^\\]]+)\\])?$","file":1,"line":2,"column":3,"message":4,"code":5}]},{"owner":"msvc-warning","severity":"warning","pattern":[{"regexp":"^\\s*(?:\\d+>)?([^\\s(][^(]*)\\((\\d+)(?:,(\\d+))?\\)\\s*:\\s+warning\\s+(C\\d+)\\s*:\\s*(.*?)(?:\\s+\\[[^\\]]+\\])?$","file":1,"line":2,"column":3,"code":4,"message":5}]},{"owner":"clang-cl-warning","severity":"warning","pattern":[{"regexp":"^\\s*(?:\\d+>)?([^\\s(][^(]*)\\((\\d+)(?:,(\\d+))?\\)\\s*:\\s+warning:\\s+(.*?)(?:\\s+\\[(-W[^\\]]+)\\])?$","file":1,"line":2,"column":3,"message":4,"code":5}]}]} + EOF + echo "::add-matcher::$RUNNER_TEMP/warning-matcher.json" + - name: Execute installation shell: bash working-directory: 'libbitcoin-node' @@ -1372,6 +1388,14 @@ jobs: chmod -R u+rwX /tmp/sysroot find /tmp/sysroot -name '*.la' -delete + - name: Register warning matcher + shell: bash + run: | + cat > "$RUNNER_TEMP/warning-matcher.json" << 'EOF' + {"problemMatcher":[{"owner":"gcc-warning","severity":"warning","pattern":[{"regexp":"^([^\\s:(][^:(]*):(\\d+):(\\d+):\\s+warning:\\s+(.*?)(?:\\s+\\[(-W[^\\]]+)\\])?$","file":1,"line":2,"column":3,"message":4,"code":5}]},{"owner":"msvc-warning","severity":"warning","pattern":[{"regexp":"^\\s*(?:\\d+>)?([^\\s(][^(]*)\\((\\d+)(?:,(\\d+))?\\)\\s*:\\s+warning\\s+(C\\d+)\\s*:\\s*(.*?)(?:\\s+\\[[^\\]]+\\])?$","file":1,"line":2,"column":3,"code":4,"message":5}]},{"owner":"clang-cl-warning","severity":"warning","pattern":[{"regexp":"^\\s*(?:\\d+>)?([^\\s(][^(]*)\\((\\d+)(?:,(\\d+))?\\)\\s*:\\s+warning:\\s+(.*?)(?:\\s+\\[(-W[^\\]]+)\\])?$","file":1,"line":2,"column":3,"message":4,"code":5}]}]} + EOF + echo "::add-matcher::$RUNNER_TEMP/warning-matcher.json" + - name: Execute installation shell: bash working-directory: 'libbitcoin-node' @@ -1848,6 +1872,14 @@ jobs: echo "LDFLAGS=-Wl,-rpath,${{ github.workspace }}/prefix/lib" >> $GITHUB_ENV fi + - name: Register warning matcher + shell: bash + run: | + cat > "$RUNNER_TEMP/warning-matcher.json" << 'EOF' + {"problemMatcher":[{"owner":"gcc-warning","severity":"warning","pattern":[{"regexp":"^([^\\s:(][^:(]*):(\\d+):(\\d+):\\s+warning:\\s+(.*?)(?:\\s+\\[(-W[^\\]]+)\\])?$","file":1,"line":2,"column":3,"message":4,"code":5}]},{"owner":"msvc-warning","severity":"warning","pattern":[{"regexp":"^\\s*(?:\\d+>)?([^\\s(][^(]*)\\((\\d+)(?:,(\\d+))?\\)\\s*:\\s+warning\\s+(C\\d+)\\s*:\\s*(.*?)(?:\\s+\\[[^\\]]+\\])?$","file":1,"line":2,"column":3,"code":4,"message":5}]},{"owner":"clang-cl-warning","severity":"warning","pattern":[{"regexp":"^\\s*(?:\\d+>)?([^\\s(][^(]*)\\((\\d+)(?:,(\\d+))?\\)\\s*:\\s+warning:\\s+(.*?)(?:\\s+\\[(-W[^\\]]+)\\])?$","file":1,"line":2,"column":3,"message":4,"code":5}]}]} + EOF + echo "::add-matcher::$RUNNER_TEMP/warning-matcher.json" + - name: Execute installation shell: bash working-directory: 'libbitcoin-node' @@ -2103,6 +2135,14 @@ jobs: persist-credentials: false repository: ${{ github.repository }} + - name: Register warning matcher + shell: bash + run: | + cat > "$RUNNER_TEMP/warning-matcher.json" << 'EOF' + {"problemMatcher":[{"owner":"gcc-warning","severity":"warning","pattern":[{"regexp":"^([^\\s:(][^:(]*):(\\d+):(\\d+):\\s+warning:\\s+(.*?)(?:\\s+\\[(-W[^\\]]+)\\])?$","file":1,"line":2,"column":3,"message":4,"code":5}]},{"owner":"msvc-warning","severity":"warning","pattern":[{"regexp":"^\\s*(?:\\d+>)?([^\\s(][^(]*)\\((\\d+)(?:,(\\d+))?\\)\\s*:\\s+warning\\s+(C\\d+)\\s*:\\s*(.*?)(?:\\s+\\[[^\\]]+\\])?$","file":1,"line":2,"column":3,"code":4,"message":5}]},{"owner":"clang-cl-warning","severity":"warning","pattern":[{"regexp":"^\\s*(?:\\d+>)?([^\\s(][^(]*)\\((\\d+)(?:,(\\d+))?\\)\\s*:\\s+warning:\\s+(.*?)(?:\\s+\\[(-W[^\\]]+)\\])?$","file":1,"line":2,"column":3,"message":4,"code":5}]}]} + EOF + echo "::add-matcher::$RUNNER_TEMP/warning-matcher.json" + - name: Force clean nuget package repository shell: cmd working-directory: 'libbitcoin-node' @@ -2143,3 +2183,40 @@ jobs: exit $ERR; } Write-Host "Test execution complete." -ForegroundColor Green; + + warnings: + needs: [ gnu, musl, cmake, presets, msvc ] + if: ${{ !cancelled() && (github.event_name != 'pull_request' || github.event.action != 'closed') }} + continue-on-error: true + runs-on: ubuntu-latest + + permissions: + actions: read + checks: read + + steps: + - name: Count compiler warnings + id: count + shell: bash + env: + GH_TOKEN: ${{ github.token }} + run: | + SUITE=$(gh api "repos/${{ github.repository }}/actions/runs/${{ github.run_id }}" --jq .check_suite_id) + RUNS=$(gh api --paginate "repos/${{ github.repository }}/check-suites/${SUITE}/check-runs?per_page=100" --jq '.check_runs[] | select(.output.annotations_count > 0) | .id') + COUNT=0 + for RUN in ${RUNS}; do + FOUND=$(gh api --paginate "repos/${{ github.repository }}/check-runs/${RUN}/annotations?per_page=100" --jq '[.[] | select(.annotation_level == "warning" and .path != ".github")] | length' | awk '{ sum += $1 } END { print sum + 0 }') + COUNT=$((COUNT + FOUND)) + done + echo "Compiler warnings: ${COUNT}" | tee -a "$GITHUB_STEP_SUMMARY" + mkdir -p warnings + echo "${COUNT}" > warnings/count + echo "count=${COUNT}" >> "$GITHUB_OUTPUT" + + - name: Upload warning count + if: steps.count.outputs.count != '0' + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: warnings-${{ steps.count.outputs.count }} + path: warnings/count + retention-days: 90 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9c9ad947..cfd18345 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -335,6 +335,14 @@ jobs: ./emulation fi + - name: Register warning matcher + shell: bash + run: | + cat > "$RUNNER_TEMP/warning-matcher.json" << 'EOF' + {"problemMatcher":[{"owner":"gcc-warning","severity":"warning","pattern":[{"regexp":"^([^\\s:(][^:(]*):(\\d+):(\\d+):\\s+warning:\\s+(.*?)(?:\\s+\\[(-W[^\\]]+)\\])?$","file":1,"line":2,"column":3,"message":4,"code":5}]},{"owner":"msvc-warning","severity":"warning","pattern":[{"regexp":"^\\s*(?:\\d+>)?([^\\s(][^(]*)\\((\\d+)(?:,(\\d+))?\\)\\s*:\\s+warning\\s+(C\\d+)\\s*:\\s*(.*?)(?:\\s+\\[[^\\]]+\\])?$","file":1,"line":2,"column":3,"code":4,"message":5}]},{"owner":"clang-cl-warning","severity":"warning","pattern":[{"regexp":"^\\s*(?:\\d+>)?([^\\s(][^(]*)\\((\\d+)(?:,(\\d+))?\\)\\s*:\\s+warning:\\s+(.*?)(?:\\s+\\[(-W[^\\]]+)\\])?$","file":1,"line":2,"column":3,"message":4,"code":5}]}]} + EOF + echo "::add-matcher::$RUNNER_TEMP/warning-matcher.json" + - name: Execute installation shell: bash working-directory: 'libbitcoin-node' @@ -595,6 +603,14 @@ jobs: echo "LDFLAGS=-Wl,-rpath,${{ github.workspace }}/prefix/lib" >> $GITHUB_ENV fi + - name: Register warning matcher + shell: bash + run: | + cat > "$RUNNER_TEMP/warning-matcher.json" << 'EOF' + {"problemMatcher":[{"owner":"gcc-warning","severity":"warning","pattern":[{"regexp":"^([^\\s:(][^:(]*):(\\d+):(\\d+):\\s+warning:\\s+(.*?)(?:\\s+\\[(-W[^\\]]+)\\])?$","file":1,"line":2,"column":3,"message":4,"code":5}]},{"owner":"msvc-warning","severity":"warning","pattern":[{"regexp":"^\\s*(?:\\d+>)?([^\\s(][^(]*)\\((\\d+)(?:,(\\d+))?\\)\\s*:\\s+warning\\s+(C\\d+)\\s*:\\s*(.*?)(?:\\s+\\[[^\\]]+\\])?$","file":1,"line":2,"column":3,"code":4,"message":5}]},{"owner":"clang-cl-warning","severity":"warning","pattern":[{"regexp":"^\\s*(?:\\d+>)?([^\\s(][^(]*)\\((\\d+)(?:,(\\d+))?\\)\\s*:\\s+warning:\\s+(.*?)(?:\\s+\\[(-W[^\\]]+)\\])?$","file":1,"line":2,"column":3,"message":4,"code":5}]}]} + EOF + echo "::add-matcher::$RUNNER_TEMP/warning-matcher.json" + - name: Execute installation shell: bash working-directory: 'libbitcoin-node' @@ -859,6 +875,14 @@ jobs: echo "LDFLAGS=-Wl,-rpath,${{ github.workspace }}/prefix/lib" >> $GITHUB_ENV fi + - name: Register warning matcher + shell: bash + run: | + cat > "$RUNNER_TEMP/warning-matcher.json" << 'EOF' + {"problemMatcher":[{"owner":"gcc-warning","severity":"warning","pattern":[{"regexp":"^([^\\s:(][^:(]*):(\\d+):(\\d+):\\s+warning:\\s+(.*?)(?:\\s+\\[(-W[^\\]]+)\\])?$","file":1,"line":2,"column":3,"message":4,"code":5}]},{"owner":"msvc-warning","severity":"warning","pattern":[{"regexp":"^\\s*(?:\\d+>)?([^\\s(][^(]*)\\((\\d+)(?:,(\\d+))?\\)\\s*:\\s+warning\\s+(C\\d+)\\s*:\\s*(.*?)(?:\\s+\\[[^\\]]+\\])?$","file":1,"line":2,"column":3,"code":4,"message":5}]},{"owner":"clang-cl-warning","severity":"warning","pattern":[{"regexp":"^\\s*(?:\\d+>)?([^\\s(][^(]*)\\((\\d+)(?:,(\\d+))?\\)\\s*:\\s+warning:\\s+(.*?)(?:\\s+\\[(-W[^\\]]+)\\])?$","file":1,"line":2,"column":3,"message":4,"code":5}]}]} + EOF + echo "::add-matcher::$RUNNER_TEMP/warning-matcher.json" + - name: Execute installation shell: bash working-directory: 'libbitcoin-node' @@ -1065,6 +1089,14 @@ jobs: persist-credentials: false repository: ${{ github.repository }} + - name: Register warning matcher + shell: bash + run: | + cat > "$RUNNER_TEMP/warning-matcher.json" << 'EOF' + {"problemMatcher":[{"owner":"gcc-warning","severity":"warning","pattern":[{"regexp":"^([^\\s:(][^:(]*):(\\d+):(\\d+):\\s+warning:\\s+(.*?)(?:\\s+\\[(-W[^\\]]+)\\])?$","file":1,"line":2,"column":3,"message":4,"code":5}]},{"owner":"msvc-warning","severity":"warning","pattern":[{"regexp":"^\\s*(?:\\d+>)?([^\\s(][^(]*)\\((\\d+)(?:,(\\d+))?\\)\\s*:\\s+warning\\s+(C\\d+)\\s*:\\s*(.*?)(?:\\s+\\[[^\\]]+\\])?$","file":1,"line":2,"column":3,"code":4,"message":5}]},{"owner":"clang-cl-warning","severity":"warning","pattern":[{"regexp":"^\\s*(?:\\d+>)?([^\\s(][^(]*)\\((\\d+)(?:,(\\d+))?\\)\\s*:\\s+warning:\\s+(.*?)(?:\\s+\\[(-W[^\\]]+)\\])?$","file":1,"line":2,"column":3,"message":4,"code":5}]}]} + EOF + echo "::add-matcher::$RUNNER_TEMP/warning-matcher.json" + - name: Force clean nuget package repository shell: cmd working-directory: 'libbitcoin-node' @@ -1105,3 +1137,40 @@ jobs: exit $ERR; } Write-Host "Test execution complete." -ForegroundColor Green; + + warnings: + needs: [ gnu, cmake, presets, msvc ] + if: ${{ !cancelled() && (github.event_name != 'pull_request' || github.event.action != 'closed') }} + continue-on-error: true + runs-on: ubuntu-latest + + permissions: + actions: read + checks: read + + steps: + - name: Count compiler warnings + id: count + shell: bash + env: + GH_TOKEN: ${{ github.token }} + run: | + SUITE=$(gh api "repos/${{ github.repository }}/actions/runs/${{ github.run_id }}" --jq .check_suite_id) + RUNS=$(gh api --paginate "repos/${{ github.repository }}/check-suites/${SUITE}/check-runs?per_page=100" --jq '.check_runs[] | select(.output.annotations_count > 0) | .id') + COUNT=0 + for RUN in ${RUNS}; do + FOUND=$(gh api --paginate "repos/${{ github.repository }}/check-runs/${RUN}/annotations?per_page=100" --jq '[.[] | select(.annotation_level == "warning" and .path != ".github")] | length' | awk '{ sum += $1 } END { print sum + 0 }') + COUNT=$((COUNT + FOUND)) + done + echo "Compiler warnings: ${COUNT}" | tee -a "$GITHUB_STEP_SUMMARY" + mkdir -p warnings + echo "${COUNT}" > warnings/count + echo "count=${COUNT}" >> "$GITHUB_OUTPUT" + + - name: Upload warning count + if: steps.count.outputs.count != '0' + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: warnings-${{ steps.count.outputs.count }} + path: warnings/count + retention-days: 90 diff --git a/builds/gnu/install-gnu.sh b/builds/gnu/install-gnu.sh index 2a261174..65942ab3 100755 --- a/builds/gnu/install-gnu.sh +++ b/builds/gnu/install-gnu.sh @@ -30,6 +30,8 @@ # --build-skip-tests Skip test compilation and execution. # --build-skip-test-run Compile tests without executing them. # --build-valgrind= Also run the tests matching the filter under valgrind. +# --build-web Also test, regenerate and compare the embedded web pages. +# --build-smoke Also sync each network and smoke test the nodes. # --build-parallel= Number of jobs to run simultaneously. # Default: supported platforms use nproc/sysctl # --build-use-local-src Use existing sources in relevant paths. @@ -162,6 +164,8 @@ main() (--build-skip-tests) BUILD_SKIP_TESTS="yes";; (--build-skip-test-run) BUILD_SKIP_TEST_RUN="yes";; (--build-valgrind=*) BUILD_VALGRIND="${OPTION#*=}";; + (--build-web) BUILD_WEB="yes";; + (--build-smoke) BUILD_SMOKE="yes";; (--build-parallel=*) PARALLEL="${OPTION#*=}";; (--build-use-local-src) BUILD_USE_LOCAL_SRC="yes";; (--prefix=*) PREFIX="${OPTION#*=}";; @@ -186,6 +190,8 @@ main() remove_configure_option "--build-skip-tests" remove_configure_option "--build-skip-test-run" remove_configure_option "--build-valgrind=*" + remove_configure_option "--build-web" + remove_configure_option "--build-smoke" remove_configure_option "--build-parallel=*" remove_configure_option "--build-use-local-src" remove_configure_option "--prefix=*" @@ -1051,6 +1057,33 @@ test_gnu() fi fi + if [[ "${BUILD_WEB}" == "yes" && "${BUILD_SKIP_TEST_RUN}" != "yes" && "${PROJECT}" == "libbitcoin-node" ]]; then + msg "Testing ${PROJECT} embedded web pages" + push_directory "${BUILD_SRC_DIR}/${PROJECT}" + python3 tools/generate_embedded_pages.py && git diff --exit-code -- console/embedded + + RESULT=$? + pop_directory + if [[ ${RESULT} -ne 0 ]]; then + msg_error "Embedded web pages failed tests or differ from those committed." + exit ${RESULT} + fi + fi + + if [[ "${BUILD_SMOKE}" == "yes" && "${BUILD_SKIP_TEST_RUN}" != "yes" && "${PROJECT}" == "libbitcoin-node" ]]; then + msg "Smoke testing ${PROJECT} nodes" + local BS="$(pwd)/console/bs" + push_directory "${BUILD_SRC_DIR}/${PROJECT}" + python3 tools/sync_networks.py "${BS}" + + RESULT=$? + pop_directory + if [[ ${RESULT} -ne 0 ]]; then + msg_error "Encountered node smoke test failure, please see report above." + exit ${RESULT} + fi + fi + enable_exit_on_error pop_directory # BUILD_OBJ_DIR @@ -1077,6 +1110,8 @@ display_build_variables() msg "BUILD_SKIP_TESTS : ${BUILD_SKIP_TESTS}" msg "BUILD_SKIP_TEST_RUN : ${BUILD_SKIP_TEST_RUN}" msg "BUILD_VALGRIND : ${BUILD_VALGRIND}" + msg "BUILD_WEB : ${BUILD_WEB}" + msg "BUILD_SMOKE : ${BUILD_SMOKE}" msg "PARALLEL : ${PARALLEL}" msg "PREFIX : ${PREFIX}" msg "DISPLAY_VERBOSE : ${DISPLAY_VERBOSE}" @@ -1151,6 +1186,8 @@ help() msg "--build-skip-tests Skip test compilation and execution." msg "--build-skip-test-run Compile tests without executing them." msg "--build-valgrind= Also run the tests matching the filter under valgrind." + msg "--build-web Also test, regenerate and compare the embedded web pages." + msg "--build-smoke Also sync each network and smoke test the nodes." msg "--build-parallel= Number of jobs to run simultaneously." msg " Default: supported platforms use nproc/sysctl" msg "--build-use-local-src Use existing sources in relevant paths." diff --git a/src/chasers/chaser_transaction.cpp b/src/chasers/chaser_transaction.cpp index 519baa20..7075ab51 100644 --- a/src/chasers/chaser_transaction.cpp +++ b/src/chasers/chaser_transaction.cpp @@ -403,22 +403,23 @@ void chaser_transaction::do_revalidated(const database::tx_links& links, return; } - size_t count{}; - auto& query = archive(); - const auto revalidated = database::context::from(ctx); + database::tx_links valid{}; + std::vector counts{}; for (size_t at{}; at < links.size(); ++at) { if (is_zero(passed.at(at))) continue; - if (!query.set_pooled_context(links.at(at), revalidated, - sigops.at(at))) - { - fault(error::transaction2); - return; - } + valid.push_back(links.at(at)); + counts.push_back(sigops.at(at)); + } - ++count; + const auto count = valid.size(); + const auto revalidated = database::context::from(ctx); + if (!archive().set_pooled_contexts(valid, counts, revalidated)) + { + fault(error::transaction2); + return; } LOGN("Revalidated (" << count << ") of (" << links.size()