From 164facb01bcd85f171e35eefdfdbb52ba6af63d5 Mon Sep 17 00:00:00 2001 From: Marius Poke Date: Tue, 5 Dec 2023 13:46:12 +0100 Subject: [PATCH 1/4] ci: updating some workflows and preparing for merge queues (#1464) * update codeql analysis * add merge_group to go linter * update golangci_version in Makefile * add diff condition on linter * add paths to gosec.yml * update md link checker * add merge_group to test.yml * add PR linter * add workflow for adding issue labels --- .github/issue_labeler.yml | 2 + .../{codeql.yml => codeql-analysis.yml} | 34 +++++++------- .github/workflows/golangci-lint.yml | 47 +++++++------------ .github/workflows/gosec.yml | 15 ++++-- .github/workflows/issue_labeler.yml | 15 ++++++ .github/workflows/linkchecker.yml | 14 ------ .github/workflows/lint-pr.yml | 47 +++++++++++++++++++ .github/workflows/md-link-checker.yml | 13 +++++ .github/workflows/test.yml | 1 + Makefile | 2 +- 10 files changed, 126 insertions(+), 64 deletions(-) create mode 100644 .github/issue_labeler.yml rename .github/workflows/{codeql.yml => codeql-analysis.yml} (69%) create mode 100644 .github/workflows/issue_labeler.yml delete mode 100644 .github/workflows/linkchecker.yml create mode 100644 .github/workflows/lint-pr.yml create mode 100644 .github/workflows/md-link-checker.yml diff --git a/.github/issue_labeler.yml b/.github/issue_labeler.yml new file mode 100644 index 0000000000..cd0e25488a --- /dev/null +++ b/.github/issue_labeler.yml @@ -0,0 +1,2 @@ +needs-triage: # if no label is set then set triage + - '' diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql-analysis.yml similarity index 69% rename from .github/workflows/codeql.yml rename to .github/workflows/codeql-analysis.yml index c6fb56c2a6..6d30a0fee4 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql-analysis.yml @@ -2,18 +2,15 @@ name: "CodeQL" on: push: - branches: - - main - - feat/* - - paths-ignore: - - "legacy_ibc_testing" + paths: + - "**.go" pull_request: branches: - main + - release/* - feat/* - paths-ignore: - - "legacy_ibc_testing" + paths: + - "**.go" schedule: # ┌───────────── minute (0 - 59) # │ ┌───────────── hour (0 - 23) @@ -27,28 +24,33 @@ on: - cron: "30 1 * * 0" jobs: - CodeQL-Build: - # CodeQL runs on ubuntu-latest, windows-latest, and macos-latest + analyze: + name: Analyze runs-on: ubuntu-latest - permissions: - # required for all workflows - security-events: write - - # only required for workflows in private repositories actions: read contents: read + security-events: write steps: - name: Checkout repository uses: actions/checkout@v4 - + - uses: actions/setup-go@v4 + with: + go-version: "1.20" + check-latest: true # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL uses: github/codeql-action/init@v2 # Override language selection by uncommenting this and choosing your languages with: languages: go + queries: +security-and-quality,github/codeql/go/ql/src/experimental/InconsistentCode/DeferInLoop.ql@main,github/codeql/go/ql/src/experimental/Unsafe/WrongUsageOfUnsafe.ql@main,github/codeql/go/ql/src/experimental/CWE-369/DivideByZero.ql@main + packs: +crypto-com/cosmos-sdk-codeql + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below). diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 33a2f62c07..5e70c5d2d7 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -1,47 +1,34 @@ -name: golangci-lint +name: Lint on: push: - tags: - - v* branches: - - master - main + - release/** - feat/* pull_request: + merge_group: permissions: contents: read - # Optional: allow read access to pull request. Use with `only-new-issues` option. - # pull-requests: read jobs: golangci: - name: lint + name: golangci-lint runs-on: ubuntu-latest steps: - uses: actions/setup-go@v4 with: go-version: '1.20' - - uses: actions/checkout@v4 - - name: golangci-lint - uses: golangci/golangci-lint-action@v3 + - uses: technote-space/get-diff-action@v6.1.2 + id: git_diff with: - # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version - version: v1.54.1 - - # Optional: working directory, useful for monorepos - # working-directory: somedir - - # Optional: golangci-lint command line arguments. - args: --config=.golangci.yml - - # Optional: show only new issues if it's a pull request. The default value is `false`. - # only-new-issues: true - - # Optional: if set to true then the all caching functionality will be complete disabled, - # takes precedence over all other caching options. - # skip-cache: true - - # Optional: if set to true then the action don't cache or restore ~/go/pkg. - # skip-pkg-cache: true + PATTERNS: | + **/*.go + go.mod + go.sum + **/go.mod + **/go.sum + - uses: actions/checkout@v4 + - name: run linting + if: env.GIT_DIFF + run: | + make lint - # Optional: if set to true then the action don't cache or restore ~/.cache/go-build. - # skip-build-cache: true diff --git a/.github/workflows/gosec.yml b/.github/workflows/gosec.yml index d01bfd37f4..3955b92323 100644 --- a/.github/workflows/gosec.yml +++ b/.github/workflows/gosec.yml @@ -1,13 +1,22 @@ -name: gosec +name: Run Gosec on: - push: + pull_request: + paths: + - "**/*.go" + - "go.mod" + - "go.sum" branches: - main - feat/* - pull_request: + push: branches: - main - feat/* + paths: + - "**/*.go" + - "go.mod" + - "go.sum" + jobs: Gosec: runs-on: ubuntu-latest diff --git a/.github/workflows/issue_labeler.yml b/.github/workflows/issue_labeler.yml new file mode 100644 index 0000000000..cc3e78fe99 --- /dev/null +++ b/.github/workflows/issue_labeler.yml @@ -0,0 +1,15 @@ +name: "Issue Labeler" +on: + issues: + types: [opened] + +jobs: + triage: + runs-on: ubuntu-latest + steps: + - uses: github/issue-labeler@v3.3 + if: join(github.event.issue.labels) == '' + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}" + configuration-path: .github/issue_labeler.yml + enable-versioned-regex: 0 diff --git a/.github/workflows/linkchecker.yml b/.github/workflows/linkchecker.yml deleted file mode 100644 index a1afa643cf..0000000000 --- a/.github/workflows/linkchecker.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: Check Markdown links -on: push -jobs: - markdown-link-check: - runs-on: ubuntu-latest - steps: - # Check out the latest version of the code - - uses: actions/checkout@v4 - - # Checks the status of hyperlinks in *.md files in docs/ - - uses: gaurav-nelson/github-action-markdown-link-check@1.0.15 - with: - folder-path: "docs" - file-path: './README.md' \ No newline at end of file diff --git a/.github/workflows/lint-pr.yml b/.github/workflows/lint-pr.yml new file mode 100644 index 0000000000..18027164fc --- /dev/null +++ b/.github/workflows/lint-pr.yml @@ -0,0 +1,47 @@ +name: "Lint PR" + +on: + pull_request_target: + types: + - opened + - edited + - synchronize + +permissions: + contents: read + +jobs: + main: + permissions: + pull-requests: read # for amannn/action-semantic-pull-request to analyze PRs + statuses: write # for amannn/action-semantic-pull-request to mark status of analyzed PR + runs-on: ubuntu-latest + steps: + - uses: amannn/action-semantic-pull-request@v5.4.0 + id: lint_pr_title + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - uses: marocchino/sticky-pull-request-comment@v2 + # When the previous steps fails, the workflow would stop. By adding this + # condition you can continue the execution with the populated error message. + if: always() && (steps.lint_pr_title.outputs.error_message != null) + with: + header: pr-title-lint-error + message: | + Hey there and thank you for opening this pull request! 👋🏼 + + We require pull request titles to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed title needs to be adjusted. + + Details: + + ``` + ${{ steps.lint_pr_title.outputs.error_message }} + ``` + + # Delete a previous comment when the issue has been resolved + - if: ${{ steps.lint_pr_title.outputs.error_message == null }} + uses: marocchino/sticky-pull-request-comment@v2 + with: + header: pr-title-lint-error + delete: true diff --git a/.github/workflows/md-link-checker.yml b/.github/workflows/md-link-checker.yml new file mode 100644 index 0000000000..981bc1b601 --- /dev/null +++ b/.github/workflows/md-link-checker.yml @@ -0,0 +1,13 @@ +name: Check Markdown links +on: + pull_request: + paths: + - "**.md" + - "!.github/**" + - "!.changelog/**" +jobs: + markdown-link-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: gaurav-nelson/github-action-markdown-link-check@1.0.15 \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index efd2860398..35d1f05c64 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,6 +2,7 @@ name: Test on: workflow_call: pull_request: + merge_group: push: branches: - main diff --git a/Makefile b/Makefile index 33420f4c4e..27719a9942 100644 --- a/Makefile +++ b/Makefile @@ -96,7 +96,7 @@ test-trace: ### Linting ### ############################################################################### -golangci_version=v1.52.2 +golangci_version=v1.54.1 lint: @echo "--> Running linter" From d2e82f1c884660f15db6910e54a9e1b1b9af4ff8 Mon Sep 17 00:00:00 2001 From: Philip Offtermatt <57488781+p-offtermatt@users.noreply.github.com> Date: Tue, 5 Dec 2023 16:21:31 +0100 Subject: [PATCH 2/4] docs: Add all md files in root dir to linkchecker (#1483) * Add all md files in root dir to linkchecker * Add whole repo to linkchecker * Fix links * Fix link: into -> intro * Remove excluded folders in the linkchecker workflow * Revert changes to .changelog folder * Ignore links to .changelog directory and utilize config file * Check repo root and docs/docs separately * Change job names * Add back trigger condition for link checker --- .github/PULL_REQUEST_TEMPLATE/production.md | 2 +- .github/workflows/md-link-checker.yml | 24 +++- CHANGELOG.md | 4 +- CONTRIBUTING.md | 4 +- RELEASE_NOTES.md | 4 + STATE-COMPATIBILITY.md | 2 +- TESTING.md | 12 +- UPGRADING.md | 6 +- tests/difference/core/README.md | 135 -------------------- 9 files changed, 38 insertions(+), 155 deletions(-) delete mode 100644 tests/difference/core/README.md diff --git a/.github/PULL_REQUEST_TEMPLATE/production.md b/.github/PULL_REQUEST_TEMPLATE/production.md index d8151fe707..dc614480b4 100644 --- a/.github/PULL_REQUEST_TEMPLATE/production.md +++ b/.github/PULL_REQUEST_TEMPLATE/production.md @@ -23,7 +23,7 @@ I have... * [ ] Confirmed this PR does not introduce changes requiring state migrations, OR migration code has been added to consumer and/or provider modules * [ ] Targeted the correct branch (see [PR Targeting](https://github.com/cosmos/interchain-security/blob/main/CONTRIBUTING.md#pr-targeting)) * [ ] Provided a link to the relevant issue or specification -* [ ] Followed the guidelines for [building SDK modules](https://github.com/cosmos/cosmos-sdk/blob/main/docs/docs/building-modules) +* [ ] Followed the guidelines for [building SDK modules](https://github.com/cosmos/cosmos-sdk/blob/main/docs/build/building-modules/00-intro.md) * [ ] Included the necessary unit and integration [tests](https://github.com/cosmos/interchain-security/blob/main/CONTRIBUTING.md#testing) * [ ] Added a changelog entry to `CHANGELOG.md` * [ ] Included comments for [documenting Go code](https://blog.golang.org/godoc) diff --git a/.github/workflows/md-link-checker.yml b/.github/workflows/md-link-checker.yml index 981bc1b601..136475f428 100644 --- a/.github/workflows/md-link-checker.yml +++ b/.github/workflows/md-link-checker.yml @@ -2,12 +2,26 @@ name: Check Markdown links on: pull_request: paths: - - "**.md" - - "!.github/**" - - "!.changelog/**" + - "*.md" + - "docs/docs/**.md" jobs: - markdown-link-check: + repo-root: runs-on: ubuntu-latest steps: + # Check out the latest version of the code - uses: actions/checkout@v4 - - uses: gaurav-nelson/github-action-markdown-link-check@1.0.15 \ No newline at end of file + # Checks the status of hyperlinks in *.md files in the repo root + - uses: gaurav-nelson/github-action-markdown-link-check@1.0.15 + with: + folder-path: '.' + max-depth: 1 + + docs: + runs-on: ubuntu-latest + steps: + # Check out the latest version of the code + - uses: actions/checkout@v4 + # Checks the status of hyperlinks in *.md files in the docs/docs folder + - uses: gaurav-nelson/github-action-markdown-link-check@1.0.15 + with: + folder-path: 'docs/docs' diff --git a/CHANGELOG.md b/CHANGELOG.md index aa1db086d1..ea360f3039 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -161,9 +161,9 @@ Date: June 1st, 2023 Unlike prior releases, the ICS `v2.0.0` release will be based on the main branch. `v2.0.0` will contain all the accumulated PRs from the various releases below, along with other PRs that were merged, but not released to production. After `v2.0.0`, we plan to revamp release practices, and how we modularize the repo for consumer/provider. -Upgrading a provider from `v1.1.0-multiden` to `v2.0.0` will require state migrations. See [migration.go](./x/ccv/provider/keeper/migration.go). See the provider module's `ConsensusVersion` in [module](./x/ccv/provider/module.go) +Upgrading a provider from `v1.1.0-multiden` to `v2.0.0` will require state migrations. See [migration.go](x/ccv/provider/keeper/migration.go). See the provider module's `ConsensusVersion` in [module](x/ccv/provider/module.go) -Upgrading a consumer from `v1.2.0-multiden` to `v2.0.0` will NOT require state migrations. See the consumer module's `ConsensusVersion` in [module](./x/ccv/consumer/module.go) +Upgrading a consumer from `v1.2.0-multiden` to `v2.0.0` will NOT require state migrations. See the consumer module's `ConsensusVersion` in [module](x/ccv/consumer/module.go) Some PRs from v2.0.0 may reappear from other releases below. This is due to the fact that ICS v1.1.0 deviates from the commit ordering of the main branch, and other releases thereafter are based on v1.1.0. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 90456c842f..1e6643bbeb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -109,7 +109,7 @@ If your architecture decision is a simple change, you may contribute directly wi In certain circumstances, the architecture decision may require changes to the ICS spec. Note that the spec is responsible for defining language-agnostic, implementation-agnostic behaviors for the ICS protocol. Whereas ADRs are responsible for communicating implementation decisions contained within this repo. -To create an ADR, follow the [template](./docs/docs/adrs/adr-template.md) and [doc](./docs/docs/adrs/Readme.md). If you would like to see examples of how these are written, please refer to the current [ADRs](https://github.com/cosmos/interchain-security/tree/main/docs/architecture). +To create an ADR, follow the [template](docs/docs/adrs/adr-template.md) and [doc](docs/docs/adrs/intro.md). If you would like to see examples of how these are written, please refer to the current [ADRs](docs/docs/adrs). ### ADR Proposals @@ -149,7 +149,7 @@ will do it anyway using a pre-configured setup of the programming language mode) ### Testing -Appropriate tests should be written with a new feature, and all existing tests should pass. See [docs/testing.md](./docs/old/testing.md) for more information. +Appropriate tests should be written with a new feature, and all existing tests should pass. See [docs/testing.md](TESTING.md) for more information. ### Pull Requests diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index a09f9a4ba7..67c8bec990 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -14,12 +14,16 @@ ❗ ***Note this release is ONLY relevant to *** ## 📝 Changelog +** REMOVE THE LINE BELOW TO ENABLE THE MARKDOWN LINK CHECKER FOR RELEASE ** + Check out the [changelog](https://github.com/cosmos/interchain-security/blob//CHANGELOG.md) for a list of relevant changes or [compare all changes](https://github.com/cosmos/interchain-security/compare/release/...) from last release. Refer to the [upgrading guide](https://github.com/cosmos/interchain-security/blob/release//UPGRADING.md) when migrating from `` to ``. +** REMOVE THE LINE BELOW TO ENABLE THE MARKDOWN LINK CHECKER FOR RELEASE ** + ## 🚀 Highlights diff --git a/STATE-COMPATIBILITY.md b/STATE-COMPATIBILITY.md index b62c00c7a4..a68d813be2 100644 --- a/STATE-COMPATIBILITY.md +++ b/STATE-COMPATIBILITY.md @@ -86,7 +86,7 @@ in CometBFT [v0.34.29](https://github.com/cometbft/cometbft/releases/tag/v0.34.2 > This is an error code that is returned by the transaction flow. In the case of > success, it is `0`. On a general error, it is `1`. Additionally, each module > defines its custom error codes. - > For example, `x/provider` currently has [these error codes](./x/ccv/provider/types/errors.go) defined. + > For example, `x/provider` currently has [these error codes](x/ccv/provider/types/errors.go) defined. > > As a result, it is important to avoid changing custom error codes or change > the semantics of what is valid logic in transaction flows. diff --git a/TESTING.md b/TESTING.md index 40117f9127..bb05ff9f1c 100644 --- a/TESTING.md +++ b/TESTING.md @@ -6,21 +6,21 @@ To increase confidence in the correctness of the Interchain Security code we con Unit tests are useful for simple standalone functionality, and CRUD operations. Unit tests should use golang's standard testing package, and be defined in files formatted as ```_test.go``` in the same directory as the file being tested, following standard conventions. -[Mocked external keepers](../../testutil/keeper/mocks.go) (implemented with [gomock](https://github.com/golang/mock)) are available for testing code that briefly interacts with external modules, but still only a single function/method relevant to ccv, and a single chain. Ie. do not use mocked external keepers to test the integration of the ccv module with external modules, or integration between consumer and provider. +[Mocked external keepers](testutil/keeper/mocks.go) (implemented with [gomock](https://github.com/golang/mock)) are available for testing code that briefly interacts with external modules, but still only a single function/method relevant to ccv, and a single chain. Ie. do not use mocked external keepers to test the integration of the ccv module with external modules, or integration between consumer and provider. ## Integration Tests -[integration-tests](../../tests/integration/) utilize the [IBC Testing Package](https://github.com/cosmos/ibc-go/tree/main/testing), and test functionality that is wider in scope than a unit test, but still able to be validated in-memory. Ie. code where advancing blocks would be useful, simulated handshakes, simulated packet relays, etc. +[integration-tests](tests/integration/) utilize the [IBC Testing Package](https://github.com/cosmos/ibc-go/tree/main/testing), and test functionality that is wider in scope than a unit test, but still able to be validated in-memory. Ie. code where advancing blocks would be useful, simulated handshakes, simulated packet relays, etc. -To run integration tests against your own consumer/provider implementations, use [instance_test.go](../../tests/integration/instance_test.go) as an example. All you'll need to do is make sure your applications implement the necessary interfaces defined in [interfaces.go](../../testutil/integration/interfaces.go), pattern match [specific_setup.go](../../testutil/ibc_testing/specific_setup.go), then pass in the appropriate types and parameters to the suite, as is done in `instance_test.go` for the dummy provider/consumer implementations. +To run integration tests against your own consumer/provider implementations, use [instance_test.go](tests/integration/instance_test.go) as an example. All you'll need to do is make sure your applications implement the necessary interfaces defined in [interfaces.go](testutil/integration/interfaces.go), pattern match [specific_setup.go](testutil/ibc_testing/specific_setup.go), then pass in the appropriate types and parameters to the suite, as is done in `instance_test.go` for the dummy provider/consumer implementations. ## Differential Tests (WIP) -[Differential tests](../../tests/difference/) is similar to integration tests, but they compare the system state to an expected state generated from a model implementation. +[Differential tests](tests/difference/) is similar to integration tests, but they compare the system state to an expected state generated from a model implementation. ## End-to-End (E2E) Tests -[E2E tests](../../tests/e2e/) run true consumer and provider chain binaries within a docker container and are relevant to the highest level of functionality. E2E tests use queries/transactions invoked from CLI to drive and validate the code. +[E2E tests](tests/e2e/) run true consumer and provider chain binaries within a docker container and are relevant to the highest level of functionality. E2E tests use queries/transactions invoked from CLI to drive and validate the code. ## Running Tests Tests can be run using `make`: @@ -103,7 +103,7 @@ gofmt -w -s -e . go vet ./... ``` -Some useful tools are included in the repository using [pre-commit](https://pre-commit.com/hooks.html). pre-commit lets you run developer tools either on every git commit, or manually with `pre-commit run --all-files`. See the [config](../../.pre-commit-config.yaml) for details. In this repo the hooks are not installed to git, as that can be cumbersome, but it is still possible to benefit from them. +Some useful tools are included in the repository using [pre-commit](https://pre-commit.com/hooks.html). pre-commit lets you run developer tools either on every git commit, or manually with `pre-commit run --all-files`. See the [config](.pre-commit-config.yaml) for details. In this repo the hooks are not installed to git, as that can be cumbersome, but it is still possible to benefit from them. ```bash ## Prerequisites diff --git a/UPGRADING.md b/UPGRADING.md index 588a135bdb..347511a902 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -10,7 +10,7 @@ The following should be considered as complementary to [Cosmos SDK v0.47 UPGRADI #### Protobuf -Protobuf code generation, linting and formatting have been updated to leverage the `ghcr.io/cosmos/proto-builder:0.11.5` docker container. Replicated Security protobuf definitions are now packaged and published to [buf.build/cosmos/interchain-security](buf.build/cosmos/interchain-security) via CI workflows. The `third_party/proto` directory has been removed in favour of dependency management using [buf.build](https://docs.buf.build/introduction). +Protobuf code generation, linting and formatting have been updated to leverage the `ghcr.io/cosmos/proto-builder:0.11.5` docker container. Replicated Security protobuf definitions are now packaged and published to [buf.build/cosmos/interchain-security](https://buf.build/cosmos/interchain-security) via CI workflows. The `third_party/proto` directory has been removed in favour of dependency management using [buf.build](https://docs.buf.build/introduction). #### App modules @@ -66,8 +66,8 @@ import ( ### Provider -Upgrading a provider from `v1.1.0-multiden` to `v2.0.0` will require state migrations. See [migration.go](./x/ccv/provider/keeper/migration.go). See the provider module's `ConsensusVersion` in [module](./x/ccv/provider/module.go). +Upgrading a provider from `v1.1.0-multiden` to `v2.0.0` will require state migrations. See [migration.go](x/ccv/provider/keeper/migration.go). See the provider module's `ConsensusVersion` in [module](x/ccv/provider/module.go). ### Consumer -Upgrading a consumer from `v1.2.0-multiden` to `v2.0.0` will NOT require state migrations. See the consumer module's `ConsensusVersion` in [module](./x/ccv/consumer/module.go). \ No newline at end of file +Upgrading a consumer from `v1.2.0-multiden` to `v2.0.0` will NOT require state migrations. See the consumer module's `ConsensusVersion` in [module](x/ccv/consumer/module.go). \ No newline at end of file diff --git a/tests/difference/core/README.md b/tests/difference/core/README.md deleted file mode 100644 index 1d9bbf04e2..0000000000 --- a/tests/difference/core/README.md +++ /dev/null @@ -1,135 +0,0 @@ -# Differential testing for Interchain Security 'core' protocol - -This directory contains model and trace generation code for the differential approach to testing Interchain Security. In particular, this work is used to test 'core' (normal operation) features of the protocol. - -At a high level, the model consists of one Provider chain and one Consumer chain. There is a single delegator account on the Provider, whose actions will change the delegation and thus the tokens and voting power of the validators. The voting power changes are relayed to the Consumer chain. The entire cycle of unbonding operation maturity is captured, because the Consumer will send unbonding maturity packets. Moreoever, slashing is modelled, as the Consumer can initiate slashing actions. - -## Scope - -### Tested (Unchecked means that work is in progress. Checked means the work is complete.) - -The following aspects of the system are tested - -- [x] Sending VSC packets from provider to one consumer -- [x] Sending VSC maturities from one consumer to provider -- [x] Slashing logic (not including actual token burning) -- [x] Validator power change -- [x] Validators leaving or joining the active validor set -- [x] Consumer initiated slashing -- [x] Delegation operations -- [x] Undelegation operations -- [x] Validator unbonding -- [x] Valiator jailing -- [x] Validator tombstoning -- [x] Packet acknowledgements -- [x] The 'Bond Based Consumer Voting Power' property ([link](https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/system_model_and_properties.md#system-properties)) -- [x] The 'Validator Set Replication' property ([link](https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/system_model_and_properties.md#system-properties)) -- [ ] The 'Slashable Consumer Misbehavior' property ([link](https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/system_model_and_properties.md#system-properties)) (_maybe_) -- [ ] PendingVSC when consumer start (_maybe_) -- [ ] Redelegation operations -- [ ] Unjailing operations - -### NOT Tested - -The following aspects of the system are not tested by this work. - -- Completing the IBC handshakes -- Repairing an expired IBC channel through governance -- Slashing with non-zero slash factors -- Submitting proposals -- Executing proposals -- Adding a new consumer chain -- Removing a consumer chain for any reason -- Distribution of rewards -- Provider Governance -- Consumer Governance/Democracy -- Anything to do with cosmwasm -- Client expiry -- Packet timeouts -- Restarting any chain from exported state -- Any logic that deals with having _more than one consumer chain_ -- Multiple delegator accounts - -## Usage - -### Overview - -This typescript project contains code for - -- Modelling the aspects of the system listed under TESTED above -- Generating and executing actions against a model system based on those aspects, in order to explore various behaviors. The actions are generated using heuristics and randomness. -- Recording traces of executions to file -- Choosing a set of traces in a manner convenient for testing the SUT. -- Replaying a given existing trace against a new model instance, for debugging purposes. - -### Usage prerequisities - -```bash -# nodejs version 16 is required. -node --version -# yarn package manager is required -yarn --version -# setup the project -yarn install -``` - -### Commands - -There are several top level yarn project scripts which can be run via - -```bash -yarn -``` - -as per the `scripts` entry in [package.json](./package.json). The most important of these are - -```bash -# install the project -yarn install; -# build in watch mode. Repeatedly build the project when the src changes -# recommended to run in background process -yarn build:watch -# start main.ts - the entry point to the program -yarn start -# test - run the tests in __tests__ -yarn test -``` - -The actual functionality has entrypoint in [src/main.ts](./src/main.ts). Please see the file for details. The available functionalities are - -```bash -# generate traces for x seconds -yarn start gen -# check properties for x seconds -yarn start properties -# create a subset of traces -yarn start subset -# replay a trace from a file (for debugging) -yarn start replay -``` - -### Workflow - -A workflow of updating the model and generating new traces for testing against the SUT might look like - -```bash -# Generate traces for 30 seconds -yarn start gen 30 -# Collect and compact a subset of these traces -yarn start subset 200 -``` - -### Extending the model - -All of the semantic logic of the model that relates to how the system is supposed to work is contained in [src/model.ts](./src/model.ts). All of the logic for generating actions (and thus traces) against the model is contained in [src/main.ts](./src/main.ts). The remaining files are less important. - -### Ensuring a consistent Trace format - -The golang test driver must be able to parse the traces output by this Typescript project. Several tools exist to generate golang type definitions from json files. I strongly suggest using [gojsonstruct](https://github.com/twpayne/go-jsonstruct) to generate a new golang definition whenever the json trace format changes. The steps to do this are - -```bash -# Pass the content of traces.json to gojsonstruct binary which will output a golang type definition -gojsonstruct < > trace.go -``` - -The `trace.go` file output from the above command should be reconciled with the content in `difftest/trace.go`. From 583d178a23689317dbd5273cb4fb621339318fcc Mon Sep 17 00:00:00 2001 From: Milan Mulji <98309852+mmulji-ic@users.noreply.github.com> Date: Tue, 5 Dec 2023 16:57:52 +0100 Subject: [PATCH 3/4] docs: A number of UI changes for Docusaurus (#1366) * A number of minor ui changes * Update docs/docusaurus.config.js Co-authored-by: MSalopek * Update docs/docusaurus.config.js Co-authored-by: MSalopek * Reverted some changes based on review comments * chore: add math formula deps * fix: rm underline on title cards; update highlight bg and font color * Added missing acorns * docs: rm curly braces from ADR template * docs: fix warnings; fix errs; use min-h-screen for content --------- Co-authored-by: MSalopek --- ...m-dos-fixes => adr-004-denom-dos-fixes.md} | 0 docs/docs/adrs/adr-template.md | 8 +- docs/docs/adrs/intro.md | 2 +- docs/docusaurus.config.js | 33 +-- docs/package-lock.json | 238 ++++++++++++++++++ docs/package.json | 2 + docs/src/css/base.css | 18 +- docs/src/css/custom.css | 65 +++-- docs/static/img/hub.svg | 1 + 9 files changed, 324 insertions(+), 43 deletions(-) rename docs/docs/adrs/{adr-004-denom-dos-fixes => adr-004-denom-dos-fixes.md} (100%) create mode 100644 docs/static/img/hub.svg diff --git a/docs/docs/adrs/adr-004-denom-dos-fixes b/docs/docs/adrs/adr-004-denom-dos-fixes.md similarity index 100% rename from docs/docs/adrs/adr-004-denom-dos-fixes rename to docs/docs/adrs/adr-004-denom-dos-fixes.md diff --git a/docs/docs/adrs/adr-template.md b/docs/docs/adrs/adr-template.md index b9e3af1678..6bb23001e6 100644 --- a/docs/docs/adrs/adr-template.md +++ b/docs/docs/adrs/adr-template.md @@ -2,16 +2,16 @@ sidebar_position: 2 title: ADR Template --- -# ADR {ADR-NUMBER}: {TITLE} +# ADR [ADR-NUMBER]: [TITLE] ## Changelog -* {date}: {changelog} +* [date]: [changelog] ## Status > A decision may be "proposed" if it hasn't been agreed upon yet, or "accepted" once it is agreed upon. If a later ADR changes or reverses a decision, it may be marked as "deprecated" or "superseded" with a reference to its replacement. -{Deprecated|Proposed|Accepted} +[Deprecated|Proposed|Accepted] ## Context @@ -38,4 +38,4 @@ If the proposed change will be large, please also indicate a way to do the chang > Are there any relevant PR comments, issues that led up to this, or articles referenced for why we made the given design choice? If so link them here! -* {reference link} +* [references] diff --git a/docs/docs/adrs/intro.md b/docs/docs/adrs/intro.md index 38021f1619..497115e563 100644 --- a/docs/docs/adrs/intro.md +++ b/docs/docs/adrs/intro.md @@ -34,7 +34,7 @@ To suggest an ADR, please make use of the [ADR template](./adr-template.md) prov - [ADR 001: Key Assignment](./adr-001-key-assignment.md) - [ADR 002: Jail Throttling](./adr-002-throttle.md) -- [ADR 004: Denom DOS fixes](./adr-004-denom-dos-fixes) +- [ADR 004: Denom DOS fixes](./adr-004-denom-dos-fixes.md) - [ADR 005: Cryptographic verification of equivocation evidence](./adr-005-cryptographic-equivocation-verification.md) - [ADR 008: Throttle with retries](./adr-008-throttle-retries.md) - [ADR 009: Soft Opt-Out](./adr-009-soft-opt-out.md) diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index c94afa04dc..e9c2b1e75c 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -1,8 +1,10 @@ // @ts-check // Note: type annotations allow type checking and IDEs autocompletion +import remarkMath from "remark-math"; +import rehypeKatex from "rehype-katex"; -const lightCodeTheme = require('prism-react-renderer').themes.github; -const darkCodeTheme = require('prism-react-renderer').themes.dracula; +const lightCodeTheme = require("prism-react-renderer").themes.github; +const darkCodeTheme = require("prism-react-renderer").themes.dracula; /** @type {import('@docusaurus/types').Config} */ const config = { @@ -35,7 +37,7 @@ const config = { /** @type {import('@docusaurus/preset-classic').Options} */ ({ docs: { - sidebarPath: require.resolve('./sidebars.js'), + sidebarPath: require.resolve("./sidebars.js"), routeBasePath: "/", versions: { current: { @@ -43,6 +45,8 @@ const config = { // banner: "current", }, }, + remarkPlugins: [remarkMath], + rehypePlugins: [rehypeKatex], }, theme: { @@ -62,19 +66,19 @@ const config = { }, }, colorMode: { - defaultMode: 'dark', - disableSwitch: true, + defaultMode: "dark", + disableSwitch: false, respectPrefersColorScheme: false, }, navbar: { title: "Interchain Security", hideOnScroll: false, - // logo: { - // alt: "Interchain Security Logo", - // src: "img/logo-sdk.svg", - // href: "/", - // target: "_self", - // }, + logo: { + alt: "Interchain Security Logo", + src: "/img/hub.svg", + href: "/", + target: "_self", + }, items: [ { href: "https://github.com/cosmos/interchain-security", @@ -96,7 +100,7 @@ const config = { { items: [ { - html: `Cosmos Logo`, + html: `Interchain Security Logo`, }, ], }, @@ -164,7 +168,8 @@ const config = { ], }, ], - copyright: "Informal Systems", + copyright: + "The development of Interchain Security is primarily led by Informal Systems. Funding for this development comes primarily from the Interchain Foundation, a Swiss non-profit.", }, prism: { theme: lightCodeTheme, @@ -206,7 +211,7 @@ const config = { toExtensions: ["html"], redirects: [ { - from: ["/", "/main", "/master"], + from: ["/main", "/master"], to: "/", }, ], diff --git a/docs/package-lock.json b/docs/package-lock.json index c2c2bb49aa..baf20cd715 100644 --- a/docs/package-lock.json +++ b/docs/package-lock.json @@ -21,6 +21,8 @@ "prism-react-renderer": "^2.3.0", "react": "^18.2.0", "react-dom": "^18.2.0", + "rehype-katex": "^7.0.0", + "remark-math": "^6.0.0", "tailwindcss": "^3.3.5" }, "devDependencies": { @@ -3499,6 +3501,11 @@ "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==" }, + "node_modules/@types/katex": { + "version": "0.16.7", + "resolved": "https://registry.npmjs.org/@types/katex/-/katex-0.16.7.tgz", + "integrity": "sha512-HMwFiRujE5PjrgwHQ25+bsLJgowjGjm5Z8FVSf0N6PwgJrwxH0QxzHYDcKsTfV3wva0vzrpqMTJS2jXPr5BMEQ==" + }, "node_modules/@types/mdast": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.3.tgz", @@ -6954,6 +6961,52 @@ "node": ">= 0.4" } }, + "node_modules/hast-util-from-dom": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/hast-util-from-dom/-/hast-util-from-dom-5.0.0.tgz", + "integrity": "sha512-d6235voAp/XR3Hh5uy7aGLbM3S4KamdW0WEgOaU1YoewnuYw4HXb5eRtv9g65m/RFGEfUY1Mw4UqCc5Y8L4Stg==", + "dependencies": { + "@types/hast": "^3.0.0", + "hastscript": "^8.0.0", + "web-namespaces": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/hast-util-from-html": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/hast-util-from-html/-/hast-util-from-html-2.0.1.tgz", + "integrity": "sha512-RXQBLMl9kjKVNkJTIO6bZyb2n+cUH8LFaSSzo82jiLT6Tfc+Pt7VQCS+/h3YwG4jaNE2TA2sdJisGWR+aJrp0g==", + "dependencies": { + "@types/hast": "^3.0.0", + "devlop": "^1.1.0", + "hast-util-from-parse5": "^8.0.0", + "parse5": "^7.0.0", + "vfile": "^6.0.0", + "vfile-message": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/hast-util-from-html-isomorphic": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/hast-util-from-html-isomorphic/-/hast-util-from-html-isomorphic-2.0.0.tgz", + "integrity": "sha512-zJfpXq44yff2hmE0XmwEOzdWin5xwH+QIhMLOScpX91e/NSGPsAzNCvLQDIEPyO2TXi+lBmU6hjLIhV8MwP2kw==", + "dependencies": { + "@types/hast": "^3.0.0", + "hast-util-from-dom": "^5.0.0", + "hast-util-from-html": "^2.0.0", + "unist-util-remove-position": "^5.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/hast-util-from-parse5": { "version": "8.0.1", "resolved": "https://registry.npmjs.org/hast-util-from-parse5/-/hast-util-from-parse5-8.0.1.tgz", @@ -6973,6 +7026,18 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/hast-util-is-element": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/hast-util-is-element/-/hast-util-is-element-3.0.0.tgz", + "integrity": "sha512-Val9mnv2IWpLbNPqc/pUem+a7Ipj2aHacCwgNfTiK0vJKl0LF+4Ba4+v1oPHFpf3bLYmreq0/l3Gud9S5OH42g==", + "dependencies": { + "@types/hast": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/hast-util-parse-selector": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/hast-util-parse-selector/-/hast-util-parse-selector-4.0.0.tgz", @@ -7093,6 +7158,21 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/hast-util-to-text": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/hast-util-to-text/-/hast-util-to-text-4.0.0.tgz", + "integrity": "sha512-EWiE1FSArNBPUo1cKWtzqgnuRQwEeQbQtnFJRYV1hb1BWDgrAlBU0ExptvZMM/KSA82cDpm2sFGf3Dmc5Mza3w==", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/unist": "^3.0.0", + "hast-util-is-element": "^3.0.0", + "unist-util-find-after": "^5.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/hast-util-whitespace": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-3.0.0.tgz", @@ -7983,6 +8063,29 @@ "graceful-fs": "^4.1.6" } }, + "node_modules/katex": { + "version": "0.16.9", + "resolved": "https://registry.npmjs.org/katex/-/katex-0.16.9.tgz", + "integrity": "sha512-fsSYjWS0EEOwvy81j3vRA8TEAhQhKiqO+FQaKWp0m39qwOzHVBgAUBIXWj1pB+O2W3fIpNa6Y9KSKCVbfPhyAQ==", + "funding": [ + "https://opencollective.com/katex", + "https://github.com/sponsors/katex" + ], + "dependencies": { + "commander": "^8.3.0" + }, + "bin": { + "katex": "cli.js" + } + }, + "node_modules/katex/node_modules/commander": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", + "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==", + "engines": { + "node": ">= 12" + } + }, "node_modules/keyv": { "version": "4.5.4", "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", @@ -8413,6 +8516,24 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/mdast-util-math": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-math/-/mdast-util-math-3.0.0.tgz", + "integrity": "sha512-Tl9GBNeG/AhJnQM221bJR2HPvLOSnLE/T9cJI9tlc6zwQk2nPk/4f0cHkOdEixQPC/j8UtKDdITswvLAy1OZ1w==", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "longest-streak": "^3.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.1.0", + "unist-util-remove-position": "^5.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/mdast-util-mdx": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/mdast-util-mdx/-/mdast-util-mdx-3.0.0.tgz", @@ -9162,6 +9283,77 @@ } ] }, + "node_modules/micromark-extension-math": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/micromark-extension-math/-/micromark-extension-math-3.0.0.tgz", + "integrity": "sha512-iJ2Q28vBoEovLN5o3GO12CpqorQRYDPT+p4zW50tGwTfJB+iv/VnB6Ini+gqa24K97DwptMBBIvVX6Bjk49oyQ==", + "dependencies": { + "@types/katex": "^0.16.0", + "devlop": "^1.0.0", + "katex": "^0.16.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-math/node_modules/micromark-factory-space": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-factory-space/-/micromark-factory-space-2.0.0.tgz", + "integrity": "sha512-TKr+LIDX2pkBJXFLzpyPyljzYK3MtmllMUMODTQJIUfDGncESaqB90db9IAUcz4AZAJFdd8U9zOp9ty1458rxg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-extension-math/node_modules/micromark-util-character": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-character/-/micromark-util-character-2.0.1.tgz", + "integrity": "sha512-3wgnrmEAJ4T+mGXAUfMvMAbxU9RDG43XmGce4j6CwPtVxB3vfwXSZ6KhFwDzZ3mZHhmPimMAXg71veiBGzeAZw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-extension-math/node_modules/micromark-util-symbol": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-util-symbol/-/micromark-util-symbol-2.0.0.tgz", + "integrity": "sha512-8JZt9ElZ5kyTnO94muPxIGS8oyElRJaiJO8EzV6ZSyGQ1Is8xwl4Q45qU5UOg+bGH4AikWziz0iN4sFLWs8PGw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ] + }, "node_modules/micromark-extension-mdx-expression": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/micromark-extension-mdx-expression/-/micromark-extension-mdx-expression-3.0.0.tgz", @@ -12343,6 +12535,24 @@ "jsesc": "bin/jsesc" } }, + "node_modules/rehype-katex": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/rehype-katex/-/rehype-katex-7.0.0.tgz", + "integrity": "sha512-h8FPkGE00r2XKU+/acgqwWUlyzve1IiOKwsEkg4pDL3k48PiE0Pt+/uLtVHDVkN1yA4iurZN6UES8ivHVEQV6Q==", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/katex": "^0.16.0", + "hast-util-from-html-isomorphic": "^2.0.0", + "hast-util-to-text": "^4.0.0", + "katex": "^0.16.0", + "unist-util-visit-parents": "^6.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/rehype-raw": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/rehype-raw/-/rehype-raw-7.0.0.tgz", @@ -12427,6 +12637,21 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/remark-math": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/remark-math/-/remark-math-6.0.0.tgz", + "integrity": "sha512-MMqgnP74Igy+S3WwnhQ7kqGlEerTETXMvJhrUzDikVZ2/uogJCb+WHUg97hK9/jcfc0dkD73s3LN8zU49cTEtA==", + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-math": "^3.0.0", + "micromark-extension-math": "^3.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/remark-mdx": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/remark-mdx/-/remark-mdx-3.0.0.tgz", @@ -14026,6 +14251,19 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/unist-util-find-after": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/unist-util-find-after/-/unist-util-find-after-5.0.0.tgz", + "integrity": "sha512-amQa0Ep2m6hE2g72AugUItjbuM8X8cGQnFoHk0pGfrFeT9GZhzN5SW8nRsiGKK7Aif4CrACPENkA6P/Lw6fHGQ==", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/unist-util-is": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-6.0.0.tgz", diff --git a/docs/package.json b/docs/package.json index e3d9566387..45f5ce2823 100644 --- a/docs/package.json +++ b/docs/package.json @@ -27,6 +27,8 @@ "prism-react-renderer": "^2.3.0", "react": "^18.2.0", "react-dom": "^18.2.0", + "rehype-katex": "^7.0.0", + "remark-math": "^6.0.0", "tailwindcss": "^3.3.5" }, "devDependencies": { diff --git a/docs/src/css/base.css b/docs/src/css/base.css index bdc9f13c4a..ee662e6335 100644 --- a/docs/src/css/base.css +++ b/docs/src/css/base.css @@ -9,6 +9,7 @@ -webkit-font-feature-settings: 'kern', 'liga', 'calt', 'zero' 0; text-size-adjust: 100%; -moz-osx-font-smoothing: grayscale; + font-smoothing: antialiased; font-variant-ligatures: contextual common-ligatures; font-kerning: normal; text-rendering: optimizeLegibility; @@ -17,8 +18,8 @@ @apply font-intervar } } - - *, + + *, *::before, *::after { box-sizing: border-box; @@ -26,6 +27,13 @@ } svg { display: inline; } - - ::selection{} -} \ No newline at end of file + + ::selection{ + background-color: var(--ifm-color-primary); + color: white; + } + + &[data-theme="dark"] ::selection{ + color: black; + } +} diff --git a/docs/src/css/custom.css b/docs/src/css/custom.css index 3b4f4baea4..1ae22d5ec1 100644 --- a/docs/src/css/custom.css +++ b/docs/src/css/custom.css @@ -38,7 +38,7 @@ --aa-primary-color-rgb: 0, 0, 0; @media screen and (prefers-reduced-motion) { - transition: ; + transition: none; } --ifm-menu-color-background-active: none; --ifm-menu-color-background-hover: none; @@ -79,10 +79,9 @@ html { @apply no-underline w-full text-2; } } - /* MAINNAV */ .navbar { - @apply py-5 h-auto border-b border-b-docusaurusColorBorder shadow-none bg-docusaurusBgColor; + @apply pb-2 pt-5 h-auto border-b border-b-docusaurusColorBorder shadow-none bg-docusaurusBgColor; &__toggle { @apply bg-card rounded-s h-8 w-8 flex justify-center items-center; @media (min-width: 997px) { @@ -244,7 +243,7 @@ html { @apply m-0; } } - + &[data-theme="dark"] .theme-doc-sidebar-menu .menu__list::before { @apply bg-inactiveLight; } @@ -340,6 +339,10 @@ html { .menu__list-item--collapsed .menu__caret:before { transform: rotateZ(0); } + .menu__caret, + li li .menu__link--sublist-caret::after { + @apply hidden; + } /* TOC */ .table-of-contents__link:hover, @@ -360,7 +363,8 @@ html { .pagination-nav { @apply pb-7 mt-9; & > a { - @apply border-stone-200 hover:border-stone-300 hover:shadow-md rounded-sm p-6 col-span-2; + box-shadow: 0px 0px 80px rgba(0, 0, 0, 0.07); + @apply border-transparent rounded pb-8.5 col-span-2 pt-6 px-6 hover:shadow-none; @media (min-width: 997px) { @apply col-span-1; @@ -375,7 +379,7 @@ html { } } &__sublabel { - @apply mb-3.5 text-slate-500 dark:text-docusaurusColorBase text-3; + @apply mb-3.5 text-gray-1000 dark:text-docusaurusColorBase text-3; } &__label { @apply text-4 font-semibold; @@ -384,9 +388,30 @@ html { } /* FOOTER */ + + &[data-theme="light"] { + .footer__title, .footer__link-item, .footer__copyright { + @apply text-white; + } + + .pagination-nav__sublabel { + @apply text-black; + } + } + + &[data-theme="dark"] { + .footer__title, .footer__link-item, .footer__copyright { + @apply text-black; + } + + .pagination-nav__sublabel { + @apply text-white; + } + } + .footer { - background-color: var(--ifm-background-color); - @apply border-t border-t-docusaurusColorBorder pt-10 mb-10; + background-color: var(--ifm-font-color-base); + @apply border-t border-t-docusaurusColorBorder pt-10; &__link-item { @apply hover:underline; } @@ -424,8 +449,6 @@ html { @apply font-jetbrain mt-3; } - - .markdown { --ifm-heading-vertical-rhythm-bottom: 1; --ifm-h1-vertical-rhythm-bottom: 1; @@ -434,10 +457,10 @@ html { @apply mt-7 pb-8 border-b border-b-border; h1 { - @apply text-7 font-bold leading-10 tracking-tight pt-5; + @apply text-7 font-bold leading-10 tracking-tight; } h2 { - @apply text-5 font-bold leading-9 tracking-tight; + @apply text-6 font-bold leading-9 tracking-tight; } h3 { @apply text-4 font-semibold leading-8 tracking-tight; @@ -455,10 +478,10 @@ html { ul, ol, blockquote { - @apply text-[1.2rem]; + @apply text-[1rem]; } code { - @apply border-0 px-3; + @apply border-0 px-3 align-baseline; } blockquote { @apply my-7; @@ -466,6 +489,7 @@ html { a { @apply underline; /* color: var(--ifm-color-primary ); */ + color: var(--ifm-color-primary); } ol, ul { @@ -484,7 +508,7 @@ html { list-style-type: none; counter-reset: item; & > li { - @apply relative pl-8 mb-4; + @apply relative pl-8 mb-5.5; &::before { counter-increment: item; content: counters(item, ".", decimal-leading-zero) "."; @@ -507,11 +531,14 @@ html { @apply my-5; } } + .card-section { + a { + @apply no-underline; + } + } } - .card-section { - a { - @apply no-underline; - } + .main-wrapper { + @apply min-h-screen; } } diff --git a/docs/static/img/hub.svg b/docs/static/img/hub.svg new file mode 100644 index 0000000000..46ace9e4ab --- /dev/null +++ b/docs/static/img/hub.svg @@ -0,0 +1 @@ + \ No newline at end of file From ac0597fced07ff51f7f272aa92f440d57d4d4548 Mon Sep 17 00:00:00 2001 From: MSalopek Date: Tue, 5 Dec 2023 18:02:37 +0100 Subject: [PATCH 4/4] chore: fix docs deps and deploy workflow (#1485) --- .github/workflows/deploy-docs.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index 60032cbdb1..c4bf213f61 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -31,16 +31,16 @@ jobs: - name: Setup Node.js 🔧 uses: actions/setup-node@v4 with: - node-version: "16.x" + node-version: "21.x" # npm install npm should be removed when https://github.com/npm/cli/issues/4942 is fixed - name: Build 🔧 run: | - npm install -g npm@8.5.5 + npm install -g npm@10.2.4 make build-docs - name: Deploy 🚀 - uses: JamesIves/github-pages-deploy-action@v4.4.3 + uses: JamesIves/github-pages-deploy-action@v4.5.0 with: branch: gh-pages folder: ~/output