diff --git a/.github/actions/build-deps/action.yml b/.github/actions/build-deps/action.yml index ba4f4e9e2f..c3b405e70f 100644 --- a/.github/actions/build-deps/action.yml +++ b/.github/actions/build-deps/action.yml @@ -1,7 +1,5 @@ -# This action installs and optionally uploads Conan dependencies to a remote -# repository. The dependencies will only be uploaded if the credentials are -# provided. name: Build Conan dependencies +description: "Install Conan dependencies, optionally forcing a rebuild of all dependencies." # Note that actions do not support 'type' and all inputs are strings, see # https://docs.github.com/en/actions/reference/workflows-and-actions/metadata-syntax#inputs. @@ -12,28 +10,10 @@ inputs: build_type: description: 'The build type to use ("Debug", "Release").' required: true - conan_remote_name: - description: "The name of the Conan remote to use." - required: true - conan_remote_url: - description: "The URL of the Conan endpoint to use." - required: true - conan_remote_username: - description: "The username for logging into the Conan remote. If not provided, the dependencies will not be uploaded." - required: false - default: "" - conan_remote_password: - description: "The password for logging into the Conan remote. If not provided, the dependencies will not be uploaded." - required: false - default: "" force_build: description: 'Force building of all dependencies ("true", "false").' required: false default: "false" - force_upload: - description: 'Force uploading of all dependencies ("true", "false").' - required: false - default: "false" runs: using: composite @@ -51,12 +31,3 @@ runs: --options:host '&:xrpld=True' \ --settings:all build_type=${{ inputs.build_type }} \ --format=json .. - - name: Upload Conan dependencies - if: ${{ inputs.conan_remote_username != '' && inputs.conan_remote_password != '' }} - shell: bash - working-directory: ${{ inputs.build_dir }} - run: | - echo "Logging into Conan remote '${{ inputs.conan_remote_name }}' at ${{ inputs.conan_remote_url }}." - conan remote login ${{ inputs.conan_remote_name }} "${{ inputs.conan_remote_username }}" --password "${{ inputs.conan_remote_password }}" - echo 'Uploading dependencies.' - conan upload '*' --confirm --check ${{ inputs.force_upload == 'true' && '--force' || '' }} --remote=${{ inputs.conan_remote_name }} diff --git a/.github/actions/build-test/action.yml b/.github/actions/build-test/action.yml index ee945dcf38..cf1bac16f7 100644 --- a/.github/actions/build-test/action.yml +++ b/.github/actions/build-test/action.yml @@ -1,6 +1,7 @@ # This action build and tests the binary. The Conan dependencies must have # already been installed (see the build-deps action). name: Build and Test +description: "Build and test the binary." # Note that actions do not support 'type' and all inputs are strings, see # https://docs.github.com/en/actions/reference/workflows-and-actions/metadata-syntax#inputs. diff --git a/.github/actions/setup-conan/action.yml b/.github/actions/setup-conan/action.yml new file mode 100644 index 0000000000..d31809dc94 --- /dev/null +++ b/.github/actions/setup-conan/action.yml @@ -0,0 +1,43 @@ +name: Setup Conan +description: "Set up Conan configuration, profile, and remote." + +inputs: + conan_remote_name: + description: "The name of the Conan remote to use." + required: false + default: xrplf + conan_remote_url: + description: "The URL of the Conan endpoint to use." + required: false + default: https://conan.ripplex.io + +runs: + using: composite + + steps: + - name: Set up Conan configuration + shell: bash + run: | + echo 'Installing configuration.' + cat conan/global.conf ${{ runner.os == 'Linux' && '>>' || '>' }} $(conan config home)/global.conf + + echo 'Conan configuration:' + conan config show '*' + + - name: Set up Conan profile + shell: bash + run: | + echo 'Installing profile.' + conan config install conan/profiles/default -tf $(conan config home)/profiles/ + + echo 'Conan profile:' + conan profile show + + - name: Set up Conan remote + shell: bash + run: | + echo "Adding Conan remote '${{ inputs.conan_remote_name }}' at ${{ inputs.conan_remote_url }}." + conan remote add --index 0 --force ${{ inputs.conan_remote_name }} ${{ inputs.conan_remote_url }} + + echo 'Listing Conan remotes.' + conan remote list diff --git a/.github/scripts/strategy-matrix/generate.py b/.github/scripts/strategy-matrix/generate.py old mode 100644 new mode 100755 diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 40399539b8..69ff986f98 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -13,14 +13,6 @@ on: required: false type: string default: ".build" - conan_remote_name: - description: "The name of the Conan remote to use." - required: true - type: string - conan_remote_url: - description: "The URL of the Conan endpoint to use." - required: true - type: string dependencies_force_build: description: "Force building of all dependencies." required: false @@ -45,12 +37,6 @@ on: codecov_token: description: "The Codecov token to use for uploading coverage reports." required: false - conan_remote_username: - description: "The username for logging into the Conan remote. If not provided, the dependencies will not be uploaded." - required: false - conan_remote_password: - description: "The password for logging into the Conan remote. If not provided, the dependencies will not be uploaded." - required: false concurrency: group: ${{ github.workflow }}-${{ github.ref }}-${{ inputs.os }} @@ -63,20 +49,10 @@ defaults: jobs: # Generate the strategy matrix to be used by the following job. generate-matrix: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 - - name: Set up Python - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 - with: - python-version: 3.13 - - name: Generate strategy matrix - working-directory: .github/scripts/strategy-matrix - id: generate - run: python generate.py ${{ inputs.strategy_matrix == 'all' && '--all' || '' }} --config=${{ inputs.os }}.json >> "${GITHUB_OUTPUT}" - outputs: - matrix: ${{ steps.generate.outputs.matrix }} + uses: ./.github/workflows/reusable-strategy-matrix.yml + with: + os: ${{ inputs.os }} + strategy_matrix: ${{ inputs.strategy_matrix }} # Build and test the binary. build-test: @@ -148,40 +124,16 @@ jobs: echo 'Checking nproc version.' nproc --version - - name: Set up Conan configuration - run: | - echo 'Installing configuration.' - cat conan/global.conf ${{ inputs.os == 'linux' && '>>' || '>' }} $(conan config home)/global.conf - - echo 'Conan configuration:' - conan config show '*' - - name: Set up Conan profile - run: | - echo 'Installing profile.' - conan config install conan/profiles/default -tf $(conan config home)/profiles/ - - echo 'Conan profile:' - conan profile show - - name: Set up Conan remote - shell: bash - run: | - echo "Adding Conan remote '${{ inputs.conan_remote_name }}' at ${{ inputs.conan_remote_url }}." - conan remote add --index 0 --force ${{ inputs.conan_remote_name }} ${{ inputs.conan_remote_url }} - - echo 'Listing Conan remotes.' - conan remote list + - name: Setup Conan + uses: ./.github/actions/setup-conan - name: Build dependencies uses: ./.github/actions/build-deps with: build_dir: ${{ inputs.build_dir }} build_type: ${{ matrix.build_type }} - conan_remote_name: ${{ inputs.conan_remote_name }} - conan_remote_url: ${{ inputs.conan_remote_url }} - conan_remote_username: ${{ secrets.conan_remote_username }} - conan_remote_password: ${{ secrets.conan_remote_password }} force_build: ${{ inputs.dependencies_force_build }} - force_upload: ${{ inputs.dependencies_force_upload }} + - name: Build and test binary uses: ./.github/actions/build-test with: diff --git a/.github/workflows/check-format.yml b/.github/workflows/check-format.yml index 359e3e634b..c63589017d 100644 --- a/.github/workflows/check-format.yml +++ b/.github/workflows/check-format.yml @@ -17,41 +17,10 @@ jobs: runs-on: ubuntu-latest container: ghcr.io/xrplf/ci/tools-rippled-pre-commit steps: - # The $GITHUB_WORKSPACE and ${{ github.workspace }} might not point to the - # same directory for jobs running in containers. The actions/checkout step - # is *supposed* to checkout into $GITHUB_WORKSPACE and then add it to - # safe.directory (see instructions at https://github.com/actions/checkout) - # but that is apparently not happening for some container images. We - # therefore preemptively add both directories to safe.directory. See also - # https://github.com/actions/runner/issues/2058 for more details. - - name: Configure git safe.directory - run: | - git config --global --add safe.directory $GITHUB_WORKSPACE - git config --global --add safe.directory ${{ github.workspace }} - name: Checkout repository uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 - - name: Check configuration - run: | - echo 'Checking path.' - echo ${PATH} | tr ':' '\n' - - echo 'Checking environment variables.' - env | sort - - echo 'Checking pre-commit version.' - pre-commit --version - - echo 'Checking clang-format version.' - clang-format --version - - echo 'Checking NPM version.' - npm --version - - echo 'Checking Node.js version.' - node --version - - echo 'Checking prettier version.' - prettier --version + - name: Prepare runner + uses: XRPLF/actions/.github/actions/prepare-runner@638e0dc11ea230f91bd26622fb542116bb5254d5 - name: Format code run: pre-commit run --show-diff-on-failure --color=always --all-files - name: Check for differences diff --git a/.github/workflows/notify-clio.yml b/.github/workflows/notify-clio.yml index f7e10de7af..692904ff12 100644 --- a/.github/workflows/notify-clio.yml +++ b/.github/workflows/notify-clio.yml @@ -9,12 +9,14 @@ on: inputs: conan_remote_name: description: "The name of the Conan remote to use." - required: true + required: false type: string + default: xrplf conan_remote_url: description: "The URL of the Conan endpoint to use." - required: true + required: false type: string + default: https://conan.ripplex.io secrets: clio_notify_token: description: "The GitHub token to notify Clio about new versions." @@ -50,21 +52,25 @@ jobs: echo "channel=pr_${{ github.event.pull_request.number }}" >> "${GITHUB_OUTPUT}" echo 'Extracting version.' echo "version=$(cat src/libxrpl/protocol/BuildInfo.cpp | grep "versionString =" | awk -F '"' '{print $2}')" >> "${GITHUB_OUTPUT}" - - name: Add Conan remote + - name: Calculate conan reference + id: conan_ref run: | - echo "Adding Conan remote '${{ inputs.conan_remote_name }}' at ${{ inputs.conan_remote_url }}." - conan remote add --index 0 --force ${{ inputs.conan_remote_name }} ${{ inputs.conan_remote_url }} - echo 'Listing Conan remotes.' - conan remote list + echo "conan_ref=${{ steps.generate.outputs.version }}@${{ steps.generate.outputs.user }}/${{ steps.generate.outputs.channel }}" >> "${GITHUB_OUTPUT}" + + - name: Set up Conan + uses: ./.github/actions/setup-conan + with: + conan_remote_name: ${{ inputs.conan_remote_name }} + conan_remote_url: ${{ inputs.conan_remote_url }} + - name: Log into Conan remote run: conan remote login ${{ inputs.conan_remote_name }} "${{ secrets.conan_remote_username }}" --password "${{ secrets.conan_remote_password }}" - name: Upload package run: | conan export --user=${{ steps.generate.outputs.user }} --channel=${{ steps.generate.outputs.channel }} . - conan upload --confirm --check --remote=${{ inputs.conan_remote_name }} xrpl/${{ steps.generate.outputs.version }}@${{ steps.generate.outputs.user }}/${{ steps.generate.outputs.channel }} + conan upload --confirm --check --remote=${{ inputs.conan_remote_name }} xrpl/${{ steps.conan_ref.outputs.conan_ref }} outputs: - channel: ${{ steps.generate.outputs.channel }} - version: ${{ steps.generate.outputs.version }} + conan_ref: ${{ steps.conan_ref.outputs.conan_ref }} notify: needs: upload @@ -76,5 +82,5 @@ jobs: run: | gh api --method POST -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" \ /repos/xrplf/clio/dispatches -f "event_type=check_libxrpl" \ - -F "client_payload[version]=${{ needs.upload.outputs.version }}@${{ needs.upload.outputs.user }}/${{ needs.upload.outputs.channel }}" \ - -F "client_payload[pr]=${{ github.event.pull_request.number }}" + -F "client_payload[conan_ref]=${{ needs.upload.outputs.conan_ref }}" \ + -F "client_payload[pr_url]=${{ github.event.pull_request.html_url }}" diff --git a/.github/workflows/on-pr.yml b/.github/workflows/on-pr.yml index 8008aebcbb..f72b8a9121 100644 --- a/.github/workflows/on-pr.yml +++ b/.github/workflows/on-pr.yml @@ -23,10 +23,6 @@ defaults: run: shell: bash -env: - CONAN_REMOTE_NAME: xrplf - CONAN_REMOTE_URL: https://conan.ripplex.io - jobs: # This job determines whether the rest of the workflow should run. It runs # when the PR is not a draft (which should also cover merge-group) or @@ -105,40 +101,22 @@ jobs: if: needs.should-run.outputs.go == 'true' uses: ./.github/workflows/check-levelization.yml - # This job works around the limitation that GitHub Actions does not support - # using environment variables as inputs for reusable workflows. - generate-outputs: - needs: should-run - if: needs.should-run.outputs.go == 'true' - runs-on: ubuntu-latest - steps: - - name: No-op - run: true - outputs: - conan_remote_name: ${{ env.CONAN_REMOTE_NAME }} - conan_remote_url: ${{ env.CONAN_REMOTE_URL }} - build-test: - needs: generate-outputs + needs: should-run uses: ./.github/workflows/build-test.yml strategy: matrix: os: [linux, macos, windows] with: - conan_remote_name: ${{ needs.generate-outputs.outputs.conan_remote_name }} - conan_remote_url: ${{ needs.generate-outputs.outputs.conan_remote_url }} os: ${{ matrix.os }} secrets: codecov_token: ${{ secrets.CODECOV_TOKEN }} notify-clio: needs: - - generate-outputs + - should-run - build-test uses: ./.github/workflows/notify-clio.yml - with: - conan_remote_name: ${{ needs.generate-outputs.outputs.conan_remote_name }} - conan_remote_url: ${{ needs.generate-outputs.outputs.conan_remote_url }} secrets: clio_notify_token: ${{ secrets.CLIO_NOTIFY_TOKEN }} conan_remote_username: ${{ secrets.CONAN_REMOTE_USERNAME }} diff --git a/.github/workflows/on-trigger.yml b/.github/workflows/on-trigger.yml index dcd592a1f7..14884391ef 100644 --- a/.github/workflows/on-trigger.yml +++ b/.github/workflows/on-trigger.yml @@ -66,54 +66,18 @@ defaults: run: shell: bash -env: - CONAN_REMOTE_NAME: xrplf - CONAN_REMOTE_URL: https://conan.ripplex.io - jobs: check-missing-commits: if: ${{ github.event_name == 'push' && github.ref_type == 'branch' && contains(fromJSON('["develop", "release"]'), github.ref_name) }} uses: ./.github/workflows/check-missing-commits.yml - # This job works around the limitation that GitHub Actions does not support - # using environment variables as inputs for reusable workflows. It also sets - # outputs that depend on the event that triggered the workflow. - generate-outputs: - runs-on: ubuntu-latest - steps: - - name: Check inputs and set outputs - id: generate - run: | - if [[ '${{ github.event_name }}' == 'push' ]]; then - echo 'dependencies_force_build=false' >> "${GITHUB_OUTPUT}" - echo 'dependencies_force_upload=false' >> "${GITHUB_OUTPUT}" - elif [[ '${{ github.event_name }}' == 'schedule' ]]; then - echo 'dependencies_force_build=true' >> "${GITHUB_OUTPUT}" - echo 'dependencies_force_upload=false' >> "${GITHUB_OUTPUT}" - else - echo 'dependencies_force_build=${{ inputs.dependencies_force_build }}' >> "${GITHUB_OUTPUT}" - echo 'dependencies_force_upload=${{ inputs.dependencies_force_upload }}' >> "${GITHUB_OUTPUT}" - fi - outputs: - conan_remote_name: ${{ env.CONAN_REMOTE_NAME }} - conan_remote_url: ${{ env.CONAN_REMOTE_URL }} - dependencies_force_build: ${{ steps.generate.outputs.dependencies_force_build }} - dependencies_force_upload: ${{ steps.generate.outputs.dependencies_force_upload }} - build-test: - needs: generate-outputs uses: ./.github/workflows/build-test.yml strategy: matrix: os: [linux, macos, windows] with: - conan_remote_name: ${{ needs.generate-outputs.outputs.conan_remote_name }} - conan_remote_url: ${{ needs.generate-outputs.outputs.conan_remote_url }} - dependencies_force_build: ${{ needs.generate-outputs.outputs.dependencies_force_build == 'true' }} - dependencies_force_upload: ${{ needs.generate-outputs.outputs.dependencies_force_upload == 'true' }} os: ${{ matrix.os }} - strategy_matrix: "all" + strategy_matrix: "minimal" secrets: codecov_token: ${{ secrets.CODECOV_TOKEN }} - conan_remote_username: ${{ secrets.CONAN_REMOTE_USERNAME }} - conan_remote_password: ${{ secrets.CONAN_REMOTE_PASSWORD }} diff --git a/.github/workflows/reusable-strategy-matrix.yml b/.github/workflows/reusable-strategy-matrix.yml new file mode 100644 index 0000000000..5c84b51de1 --- /dev/null +++ b/.github/workflows/reusable-strategy-matrix.yml @@ -0,0 +1,38 @@ +name: Generate strategy matrix + +on: + workflow_call: + inputs: + os: + description: 'The operating system to use for the build ("linux", "macos", "windows").' + required: true + type: string + strategy_matrix: + # TODO: Support additional strategies, e.g. "ubuntu" for generating all Ubuntu configurations. + description: 'The strategy matrix to use for generating the configurations ("minimal", "all").' + required: false + type: string + default: "minimal" + outputs: + matrix: + description: "The generated strategy matrix." + value: ${{ jobs.generate-matrix.outputs.matrix }} + +jobs: + generate-matrix: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.generate.outputs.matrix }} + steps: + - name: Checkout repository + uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 + + - name: Set up Python + uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 + with: + python-version: 3.13 + + - name: Generate strategy matrix + working-directory: .github/scripts/strategy-matrix + id: generate + run: ./generate.py ${{ inputs.strategy_matrix == 'all' && '--all' || '' }} --config=${{ inputs.os }}.json >> "${GITHUB_OUTPUT}" diff --git a/.github/workflows/reusable-upload-conan-deps-os.yml b/.github/workflows/reusable-upload-conan-deps-os.yml new file mode 100644 index 0000000000..787cf6a39e --- /dev/null +++ b/.github/workflows/reusable-upload-conan-deps-os.yml @@ -0,0 +1,78 @@ +name: Upload Conan Dependencies + +on: + workflow_call: + inputs: + build_dir: + description: "The directory where to build." + required: false + type: string + default: ".build" + conan_remote_name: + description: "The name of the Conan remote to use." + required: false + type: string + default: xrplf + + os: + description: 'The operating system to use for the build ("linux", "macos", "windows").' + required: true + type: string + force_source_build: + description: "Force source build of all dependencies" + required: true + type: boolean + force_upload: + description: "Force upload of all dependencies" + required: true + type: boolean + secrets: + CONAN_USERNAME: + required: true + CONAN_PASSWORD: + required: true + +jobs: + generate-matrix: + uses: ./.github/workflows/reusable-strategy-matrix.yml + with: + os: ${{ inputs.os }} + strategy_matrix: all + + upload-conan-deps: + needs: + - generate-matrix + strategy: + fail-fast: false + matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }} + runs-on: ${{ matrix.architecture.runner }} + container: ${{ inputs.os == 'linux' && format('ghcr.io/xrplf/ci/{0}-{1}:{2}-{3}', matrix.os.distro_name, matrix.os.distro_version, matrix.os.compiler_name, matrix.os.compiler_version) || null }} + + steps: + - name: Cleanup workspace + if: ${{ runner.os == 'macOS' }} + uses: XRPLF/actions/.github/actions/cleanup-workspace@3f044c7478548e3c32ff68980eeb36ece02b364e + + - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 + - name: Prepare runner + uses: XRPLF/actions/.github/actions/prepare-runner@638e0dc11ea230f91bd26622fb542116bb5254d5 + with: + disable_ccache: false + + - name: Setup Conan + uses: ./.github/actions/setup-conan + + - name: Build dependencies + uses: ./.github/actions/build-deps + with: + build_dir: ${{ inputs.build_dir }} + build_type: ${{ matrix.build_type }} + force_build: ${{ inputs.force_source_build }} + + - name: Login to Conan + if: github.repository_owner == 'XRPLF' && github.event_name != 'pull_request' + run: conan remote login -p ${{ secrets.CONAN_PASSWORD }} ${{ inputs.conan_remote_name }} ${{ secrets.CONAN_USERNAME }} + + - name: Upload Conan packages + if: github.repository_owner == 'XRPLF' && github.event_name != 'pull_request' && github.event_name != 'schedule' + run: conan upload "*" -r=${{ inputs.conan_remote_name }} --confirm ${{ inputs.force_upload == 'true' && '--force' || '' }} diff --git a/.github/workflows/upload-conan-deps.yml b/.github/workflows/upload-conan-deps.yml new file mode 100644 index 0000000000..5a6adc99be --- /dev/null +++ b/.github/workflows/upload-conan-deps.yml @@ -0,0 +1,62 @@ +name: Upload Conan Dependencies + +on: + schedule: + - cron: "0 9 * * 1-5" + workflow_dispatch: + inputs: + force_source_build: + description: "Force source build of all dependencies" + required: false + default: false + type: boolean + force_upload: + description: "Force upload of all dependencies" + required: false + default: false + type: boolean + pull_request: + branches: [develop] + paths: + - .github/workflows/upload-conan-deps.yml + + - .github/workflows/reusable-strategy-matrix.yml + - .github/workflows/reusable-upload-conan-deps-os.yml + + - .github/actions/build-deps/action.yml + - ".github/scripts/strategy-matrix/**" + + - conanfile.py + - conan.lock + push: + branches: [develop] + paths: + - .github/workflows/upload-conan-deps.yml + + - .github/workflows/reusable-strategy-matrix.yml + - .github/workflows/reusable-upload-conan-deps-os.yml + + - .github/actions/build-deps/action.yml + - ".github/scripts/strategy-matrix/**" + + - conanfile.py + - conan.lock + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + run-upload-conan-deps: + strategy: + fail-fast: true + matrix: + os: ["linux", "macos", "windows"] + uses: ./.github/workflows/reusable-upload-conan-deps-os.yml + with: + force_source_build: ${{ github.event_name == 'schedule' || github.event.inputs.force_source_build == 'true' }} + force_upload: ${{ github.event.inputs.force_upload == 'true' }} + os: ${{ matrix.os }} + secrets: + CONAN_USERNAME: ${{ secrets.CONAN_REMOTE_USERNAME }} + CONAN_PASSWORD: ${{ secrets.CONAN_REMOTE_PASSWORD }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 223c324a8c..85568a8b2e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,18 +1,5 @@ # To run pre-commit hooks, first install pre-commit: # - `pip install pre-commit==${PRE_COMMIT_VERSION}` -# - `pip install pre-commit-hooks==${PRE_COMMIT_HOOKS_VERSION}` -# -# Depending on your system, you can use `brew install` or `apt install` as well -# for installing the pre-commit package, but `pip` is needed to install the -# hooks; you can also use `pipx` if you prefer. -# Next, install the required formatters: -# - `pip install clang-format==${CLANG_VERSION}` -# - `npm install prettier@${PRETTIER_VERSION}` -# -# See https://github.com/XRPLF/ci/blob/main/.github/workflows/tools-rippled.yml -# for the versions used in the CI pipeline. You will need to have the exact same -# versions of the tools installed on your system to produce the same results as -# the pipeline. # # Then, run the following command to install the git hook scripts: # - `pre-commit install` @@ -20,42 +7,29 @@ # - `pre-commit run --all-files` # To manually run a specific hook, use: # - `pre-commit run --all-files` -# To run the hooks against only the files changed in the current commit, use: +# To run the hooks against only the staged files, use: # - `pre-commit run` repos: - - repo: local + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # frozen: v6.0.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: mixed-line-ending + - id: check-merge-conflict + args: [--assume-in-merge] + + - repo: https://github.com/pre-commit/mirrors-clang-format + rev: 7d85583be209cb547946c82fbe51f4bc5dd1d017 # frozen: v18.1.8 hooks: - id: clang-format - name: clang-format - language: system - entry: clang-format -i - files: '\.(cpp|hpp|h|ipp|proto)$' - - id: trailing-whitespace - name: trailing-whitespace - entry: trailing-whitespace-fixer - language: system - types: [text] - - id: end-of-file - name: end-of-file - entry: end-of-file-fixer - language: system - types: [text] - - id: mixed-line-ending - name: mixed-line-ending - entry: mixed-line-ending - language: system - types: [text] - - id: check-merge-conflict - name: check-merge-conflict - entry: check-merge-conflict --assume-in-merge - language: system - types: [text] - - repo: local + args: [--style=file] + "types_or": [c++, c, proto] + + - repo: https://github.com/rbubley/mirrors-prettier + rev: 5ba47274f9b181bce26a5150a725577f3c336011 # frozen: v3.6.2 hooks: - id: prettier - name: prettier - language: system - entry: prettier --ignore-unknown --write exclude: | (?x)^( diff --git a/README.md b/README.md index fe7daa38bc..dbc5ab078e 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ The [XRP Ledger](https://xrpl.org/) is a decentralized cryptographic ledger powe ## XRP -[XRP](https://xrpl.org/xrp.html) is a public, counterparty-free asset native to the XRP Ledger, and is designed to bridge the many different currencies in use worldwide. XRP is traded on the open-market and is available for anyone to access. The XRP Ledger was created in 2012 with a finite supply of 100 billion units of XRP. +[XRP](https://xrpl.org/xrp.html) is a public, counterparty-free crypto-asset native to the XRP Ledger, and is designed as a gas token for network services and to bridge different currencies. XRP is traded on the open-market and is available for anyone to access. The XRP Ledger was created in 2012 with a finite supply of 100 billion units of XRP. ## rippled @@ -23,19 +23,19 @@ If you are interested in running an **API Server** (including a **Full History S - **[Censorship-Resistant Transaction Processing][]:** No single party decides which transactions succeed or fail, and no one can "roll back" a transaction after it completes. As long as those who choose to participate in the network keep it healthy, they can settle transactions in seconds. - **[Fast, Efficient Consensus Algorithm][]:** The XRP Ledger's consensus algorithm settles transactions in 4 to 5 seconds, processing at a throughput of up to 1500 transactions per second. These properties put XRP at least an order of magnitude ahead of other top digital assets. -- **[Finite XRP Supply][]:** When the XRP Ledger began, 100 billion XRP were created, and no more XRP will ever be created. The available supply of XRP decreases slowly over time as small amounts are destroyed to pay transaction costs. -- **[Responsible Software Governance][]:** A team of full-time, world-class developers at Ripple maintain and continually improve the XRP Ledger's underlying software with contributions from the open-source community. Ripple acts as a steward for the technology and an advocate for its interests, and builds constructive relationships with governments and financial institutions worldwide. +- **[Finite XRP Supply][]:** When the XRP Ledger began, 100 billion XRP were created, and no more XRP will ever be created. The available supply of XRP decreases slowly over time as small amounts are destroyed to pay transaction fees. +- **[Responsible Software Governance][]:** A team of full-time developers at Ripple & other organizations maintain and continually improve the XRP Ledger's underlying software with contributions from the open-source community. Ripple acts as a steward for the technology and an advocate for its interests. - **[Secure, Adaptable Cryptography][]:** The XRP Ledger relies on industry standard digital signature systems like ECDSA (the same scheme used by Bitcoin) but also supports modern, efficient algorithms like Ed25519. The extensible nature of the XRP Ledger's software makes it possible to add and disable algorithms as the state of the art in cryptography advances. -- **[Modern Features for Smart Contracts][]:** Features like Escrow, Checks, and Payment Channels support cutting-edge financial applications including the [Interledger Protocol](https://interledger.org/). This toolbox of advanced features comes with safety features like a process for amending the network and separate checks against invariant constraints. +- **[Modern Features][]:** Features like Escrow, Checks, and Payment Channels support financial applications atop of the XRP Ledger. This toolbox of advanced features comes with safety features like a process for amending the network and separate checks against invariant constraints. - **[On-Ledger Decentralized Exchange][]:** In addition to all the features that make XRP useful on its own, the XRP Ledger also has a fully-functional accounting system for tracking and trading obligations denominated in any way users want, and an exchange built into the protocol. The XRP Ledger can settle long, cross-currency payment paths and exchanges of multiple currencies in atomic transactions, bridging gaps of trust with XRP. -[Censorship-Resistant Transaction Processing]: https://xrpl.org/xrp-ledger-overview.html#censorship-resistant-transaction-processing -[Fast, Efficient Consensus Algorithm]: https://xrpl.org/xrp-ledger-overview.html#fast-efficient-consensus-algorithm -[Finite XRP Supply]: https://xrpl.org/xrp-ledger-overview.html#finite-xrp-supply -[Responsible Software Governance]: https://xrpl.org/xrp-ledger-overview.html#responsible-software-governance -[Secure, Adaptable Cryptography]: https://xrpl.org/xrp-ledger-overview.html#secure-adaptable-cryptography -[Modern Features for Smart Contracts]: https://xrpl.org/xrp-ledger-overview.html#modern-features-for-smart-contracts -[On-Ledger Decentralized Exchange]: https://xrpl.org/xrp-ledger-overview.html#on-ledger-decentralized-exchange +[Censorship-Resistant Transaction Processing]: https://xrpl.org/transaction-censorship-detection.html#transaction-censorship-detection +[Fast, Efficient Consensus Algorithm]: https://xrpl.org/consensus-research.html#consensus-research +[Finite XRP Supply]: https://xrpl.org/what-is-xrp.html +[Responsible Software Governance]: https://xrpl.org/contribute-code.html#contribute-code-to-the-xrp-ledger +[Secure, Adaptable Cryptography]: https://xrpl.org/cryptographic-keys.html#cryptographic-keys +[Modern Features]: https://xrpl.org/use-specialized-payment-types.html +[On-Ledger Decentralized Exchange]: https://xrpl.org/decentralized-exchange.html#decentralized-exchange ## Source Code diff --git a/src/xrpld/app/paths/Pathfinder.h b/src/xrpld/app/paths/Pathfinder.h index ea3928dff4..b6c8bb8b2d 100644 --- a/src/xrpld/app/paths/Pathfinder.h +++ b/src/xrpld/app/paths/Pathfinder.h @@ -166,7 +166,7 @@ private: int addFlags, std::function const& continueCallback); - // Compute the liquidity for a path. Return tesSUCCESS if it has has enough + // Compute the liquidity for a path. Return tesSUCCESS if it has enough // liquidity to be worth keeping, otherwise an error. TER getPathLiquidity(