From 4e4f1cb85905aa5f33f1f38e01b6d7034158eed9 Mon Sep 17 00:00:00 2001 From: "Karim H." <98668332+khadni@users.noreply.github.com> Date: Tue, 10 Dec 2024 19:50:49 +0100 Subject: [PATCH] linkcheck script fix (#2196) * test * link fix * exclude ccip directory from internal link checking * fix internal links * use dev server * parallel jobs * Trigger Vercel deployment * update urls * fix ignored files --------- Co-authored-by: Amine E. Co-authored-by: aelmanaa --- .github/workflows/test.yml | 90 ++++++++++++++++--- .../QuickLinks/data/productChainLinks.ts | 4 +- .../ccip/api-reference/v1.5.1/client.mdx | 6 +- src/content/ccip/architecture.mdx | 2 +- .../ccip/concepts/cross-chain-tokens.mdx | 14 +-- src/content/ccip/service-limits.mdx | 28 +++--- .../tutorials/cross-chain-tokens/index.mdx | 2 +- .../chainlink-nodes/v1/node-config.mdx | 4 +- src/features/ccip/GasLimitPool.mdx | 2 +- .../link-check/ignoredfiles-internal.txt | 9 ++ src/scripts/link-check/ignoredfiles.txt | 3 - src/scripts/link-check/linkcheck.ts | 22 ++++- 12 files changed, 137 insertions(+), 49 deletions(-) create mode 100644 src/scripts/link-check/ignoredfiles-internal.txt delete mode 100644 src/scripts/link-check/ignoredfiles.txt diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 797b6bff108..57fc5ef3655 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,27 +2,89 @@ name: Test on: [push, pull_request] jobs: - test: - name: Test + # Job 1: Check Solidity Compilation and Solhint + solidity: runs-on: ubuntu-latest - defaults: - run: - working-directory: ./ steps: - name: Checkout Repo - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 + uses: actions/checkout@v4 + + - name: Cache NPM dependencies + uses: actions/cache@v3 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + - name: Install Dependencies - run: npm i + run: npm ci + - name: Check Solidity Compilation run: npm run sol:compile + - name: Check Solidity Solhint run: npm run lint-solc - - name: Check Eslint + + # Job 2: Check ESLint + eslint: + runs-on: ubuntu-latest + steps: + - name: Checkout Repo + uses: actions/checkout@v4 + + - name: Cache NPM dependencies + uses: actions/cache@v3 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + + - name: Install Dependencies + run: npm ci + + - name: Check ESLint run: npm run lint - - name: Build - run: npm run build - # TODO: fix css files throwing 404 errors - - name: Check internal links + + # Job 3: Check Internal Links + linkcheck-internal: + runs-on: ubuntu-latest + steps: + - name: Checkout Repo + uses: actions/checkout@v4 + + - name: Cache NPM dependencies + uses: actions/cache@v3 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + + - name: Install Dependencies + run: npm ci + + - name: Check Internal Links run: npm run linkcheck-internal - - name: Check types - run: npm run typecheck \ No newline at end of file + + # Job 4: Check Types + typecheck: + runs-on: ubuntu-latest + steps: + - name: Checkout Repo + uses: actions/checkout@v4 + + - name: Cache NPM dependencies + uses: actions/cache@v3 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + + - name: Install Dependencies + run: npm ci + + - name: Check Types + run: npm run typecheck diff --git a/src/components/QuickLinks/data/productChainLinks.ts b/src/components/QuickLinks/data/productChainLinks.ts index 71cbe9b343c..c7af50a780b 100644 --- a/src/components/QuickLinks/data/productChainLinks.ts +++ b/src/components/QuickLinks/data/productChainLinks.ts @@ -101,12 +101,12 @@ export const productChainLinks: ProductChainLinks = { logo: automationLogo, chains: { arbitrum: "/chainlink-automation/overview/supported-networks#arbitrum", - avalanche: "/chainlink-automation/overview/supported-networks#avalanche-mainnet", + avalanche: "/chainlink-automation/overview/supported-networks#avalanche", base: "/chainlink-automation/overview/supported-networks#base", "bnb-chain": "/chainlink-automation/overview/supported-networks#bnb-chain", ethereum: "/chainlink-automation/overview/supported-networks#ethereum", fantom: "/chainlink-automation/overview/supported-networks#fantom", - "gnosis-chain": "/chainlink-automation/overview/supported-networks#gnosis-chain-xdai", + "gnosis-chain": "/chainlink-automation/overview/supported-networks#gnosis", optimism: "/chainlink-automation/overview/supported-networks#optimism", polygon: "/chainlink-automation/overview/supported-networks#polygon", }, diff --git a/src/content/ccip/api-reference/v1.5.1/client.mdx b/src/content/ccip/api-reference/v1.5.1/client.mdx index 38b0136acdf..e019394285c 100644 --- a/src/content/ccip/api-reference/v1.5.1/client.mdx +++ b/src/content/ccip/api-reference/v1.5.1/client.mdx @@ -79,7 +79,9 @@ struct EVM2AnyMessage { | feeToken | address | Address of feeToken. address(0) means you will send msg.value. | | extraArgs | bytes | Populate this with \_argsToBytes(EVMExtraArgsV2). | -### EVMExtraArgsV1 +### EVMExtraArgs + +#### EVMExtraArgsV1 ```solidity bytes4 public constant EVM_EXTRA_ARGS_V1_TAG = 0x97a657c9; @@ -89,7 +91,7 @@ struct EVMExtraArgsV1 { } ``` -### EVMExtraArgsV2 +#### EVMExtraArgsV2 ```solidity bytes4 public constant EVM_EXTRA_ARGS_V2_TAG = 0x181dcf10; diff --git a/src/content/ccip/architecture.mdx b/src/content/ccip/architecture.mdx index b800d8a2636..0e288373da7 100644 --- a/src/content/ccip/architecture.mdx +++ b/src/content/ccip/architecture.mdx @@ -181,7 +181,7 @@ Chainlink CCIP token transfers benefit from rate limits for additional security. You can find the complete list of lanes and their rate limits on the [CCIP Directory](/ccip/directory) page. -The rate limits are enforced at both the source and destination blockchains for maximum security. If these rate limits are reached, descriptive errors with detailed information are generated and returned to the sender. This enables CCIP users to gracefully handle these errors within their dApps to preserve the end-user experience. A comprehensive list of errors and their descriptions is available on the [errors API reference](/ccip/api-reference/v1.5.1/errors#ratelimiter) page. +The rate limits are enforced at both the source and destination blockchains for maximum security. If these rate limits are reached, descriptive errors with detailed information are generated and returned to the sender. This enables CCIP users to gracefully handle these errors within their dApps to preserve the end-user experience. A comprehensive list of errors and their descriptions is available on the [errors API reference](/ccip/api-reference/v1.5.1/errors#rate-limiter-errors) page. ### Token pool rate limit diff --git a/src/content/ccip/concepts/cross-chain-tokens.mdx b/src/content/ccip/concepts/cross-chain-tokens.mdx index 444bf17c418..ea23b44a9a4 100644 --- a/src/content/ccip/concepts/cross-chain-tokens.mdx +++ b/src/content/ccip/concepts/cross-chain-tokens.mdx @@ -450,7 +450,7 @@ The **Token Pool contract** is responsible for executing the cross-chain token t - **BurnMintTokenPool**: Handles the burning, or minting of tokens depending whether it is the source or destination blockchain. - **LockReleaseTokenPool**: Handles the locking or releasing of tokens depending on whether it is the source or destination blockchain. -For more information on the token pool contracts and their functionalities, refer to the [Requirement for Token Pools](#requirement-for-token-pools) section. +For more information on the token pool contracts and their functionalities, refer to the [Requirement for Token Pools](#requirements-for-token-pools) section. ### Registration @@ -548,13 +548,15 @@ The configuration of token pools includes adding new blockchains, setting remote - **Usage**: - To add a new blockchain, the pool owner provides the remote chain selector, pool address, token address, and rate limiter configurations. - To remove a blockchain, the `allowed` flag is set to `false`, and the chain is removed from the list of supported chains. -1. [`setRemotePool`](/ccip/api-reference/v1.5.1/token-pool#setremotepool): +1. [`addRemotePool`](/ccip/api-reference/v1.5.1/token-pool#addremotepool): - - **Purpose**: Set the remote pool's address to link the current token pool to a corresponding pool on a remote blockchain. + - **Purpose**: Adds a new remote pool address for a specific blockchain, enabling support for multiple pools per chain. - **Details**: - - This function is used to establish the connection between token pools on different blockchains. - - It validates the provided chain selector and updates the remote pool address for the selected chain. - - **Usage**: This function sets or updates the remote pool address for a specific blockchain. + - Allows adding multiple pools for a single chain selector, which is crucial during pool upgrades + - Maintains support for in-flight messages from existing pools while adding new ones + - Validates chain selector support and prevents duplicate pool additions + - Each pool address is hashed and stored for efficient lookup + - **Usage**: This function is particularly useful during pool upgrades, allowing seamless transitions between pool versions while maintaining transaction support. 1. [`setChainRateLimiterConfig`](/ccip/api-reference/v1.5.1/token-pool#setchainratelimiterconfig): diff --git a/src/content/ccip/service-limits.mdx b/src/content/ccip/service-limits.mdx index ff397bd72f8..ea5a737b31a 100644 --- a/src/content/ccip/service-limits.mdx +++ b/src/content/ccip/service-limits.mdx @@ -21,20 +21,20 @@ import CcipCommon from "@features/ccip/CcipCommon.astro" use this [contact form](https://chain.link/ccip-contact?v=Tokens:%20Gas%20limit%20update) to request assistance. -| Item | Description | Limit | -| -------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- | -| Maximum message `data` length | `data` payload sent within the [CCIP message](/ccip/api-reference/v1.5.1/client#evm2anymessage) | 30 kilobytes | -| Message Gas Limit | User specified [gas limit](/ccip/api-reference/v1.5.1/client#evmextraargsv1) | 3,000,000 | -| Maximum number of tokens | Maximum number of distinct tokens a user can transfer in a single transaction | 1 | -| Smart Execution time window | Maximum duration for the execution of a [CCIP message](/ccip/api-reference/v1.5.1/client#evm2anymessage) | 8 hours | -| Token Pool Execution Gas Limit | Maximum gas for executing the combined steps in token pools during cross-chain transfers, including: (1) `balanceOf` check before minting/releasing, (2) `releaseOrMint` function, and (3) `balanceOf` check after minting/releasing. For more details on building custom token pools and handling gas constraints, refer to the [Token Pools documentation](/ccip/concepts/cross-chain-tokens#requirement-for-token-pools). | 90,000 | +| Item | Description | Limit | +| -------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- | +| Maximum message `data` length | `data` payload sent within the [CCIP message](/ccip/api-reference/v1.5.1/client#evm2anymessage) | 30 kilobytes | +| Message Gas Limit | User specified [gas limit](/ccip/api-reference/v1.5.1/client#evmextraargsv1) | 3,000,000 | +| Maximum number of tokens | Maximum number of distinct tokens a user can transfer in a single transaction | 1 | +| Smart Execution time window | Maximum duration for the execution of a [CCIP message](/ccip/api-reference/v1.5.1/client#evm2anymessage) | 8 hours | +| Token Pool Execution Gas Limit | Maximum gas for executing the combined steps in token pools during cross-chain transfers, including: (1) `balanceOf` check before minting/releasing, (2) `releaseOrMint` function, and (3) `balanceOf` check after minting/releasing. For more details on building custom token pools and handling gas constraints, refer to the [Token Pools documentation](/ccip/concepts/cross-chain-tokens#requirements-for-token-pools). | 90,000 | ## Testnet -| Item | Description | Limit | -| -------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- | -| Maximum message `data` length | `data` payload sent within the [CCIP message](/ccip/api-reference/v1.5.1/client#evm2anymessage) | 30 kilobytes | -| Message Gas Limit | User specified [gas limit](/ccip/api-reference/v1.5.1/client#evmextraargsv1) | 3,000,000 | -| Maximum number of tokens | Maximum number of distinct tokens a user can transfer in a single transaction | 1 | -| Smart Execution timeframe | Maximum duration for the execution of a [CCIP message](/ccip/api-reference/v1.5.1/client#evm2anymessage) | 8 hours | -| Token Pool Execution Gas Limit | Maximum gas for executing the combined steps in token pools during cross-chain transfers, including: (1) `balanceOf` check before minting/releasing, (2) `releaseOrMint` function, and (3) `balanceOf` check after minting/releasing. For more details on building custom token pools and handling gas constraints, refer to the [Token Pools documentation](/ccip/concepts/cross-chain-tokens#requirement-for-token-pools). | 90,000 | +| Item | Description | Limit | +| -------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- | +| Maximum message `data` length | `data` payload sent within the [CCIP message](/ccip/api-reference/v1.5.1/client#evm2anymessage) | 30 kilobytes | +| Message Gas Limit | User specified [gas limit](/ccip/api-reference/v1.5.1/client#evmextraargsv1) | 3,000,000 | +| Maximum number of tokens | Maximum number of distinct tokens a user can transfer in a single transaction | 1 | +| Smart Execution timeframe | Maximum duration for the execution of a [CCIP message](/ccip/api-reference/v1.5.1/client#evm2anymessage) | 8 hours | +| Token Pool Execution Gas Limit | Maximum gas for executing the combined steps in token pools during cross-chain transfers, including: (1) `balanceOf` check before minting/releasing, (2) `releaseOrMint` function, and (3) `balanceOf` check after minting/releasing. For more details on building custom token pools and handling gas constraints, refer to the [Token Pools documentation](/ccip/concepts/cross-chain-tokens#requirements-for-token-pools). | 90,000 | diff --git a/src/content/ccip/tutorials/cross-chain-tokens/index.mdx b/src/content/ccip/tutorials/cross-chain-tokens/index.mdx index 5bd2de0711f..cd17d7739fe 100644 --- a/src/content/ccip/tutorials/cross-chain-tokens/index.mdx +++ b/src/content/ccip/tutorials/cross-chain-tokens/index.mdx @@ -31,7 +31,7 @@ In the following tutorials, we will walk through each step of the process to giv 1. **Token Deployment**: If the token is not yet deployed, you'll deploy an [ERC20-compatible token](/ccip/concepts/cross-chain-tokens#requirements-for-cross-chain-tokens). 2. **Admin Registration**: The token administrator must be registered in the [`TokenAdminRegistry`](/ccip/api-reference/v1.5.1/token-admin-registry) via self-service. -3. **Pool Deployment and Configuration**: [Token pools](/ccip/concepts/cross-chain-tokens#requirement-for-token-pools) are deployed, linked to tokens, and configured to manage cross-chain token transfers. +3. **Pool Deployment and Configuration**: [Token pools](/ccip/concepts/cross-chain-tokens#requirements-for-token-pools) are deployed, linked to tokens, and configured to manage cross-chain token transfers. The tutorials will implement the logic of this process, which involves deploying and configuring token pools and registering administrative roles, step-by-step. diff --git a/src/content/chainlink-nodes/v1/node-config.mdx b/src/content/chainlink-nodes/v1/node-config.mdx index 9388cfd0820..57d2cdbdedc 100644 --- a/src/content/chainlink-nodes/v1/node-config.mdx +++ b/src/content/chainlink-nodes/v1/node-config.mdx @@ -640,7 +640,7 @@ HTTPWriteTimeout controls how long the Chainlink node's API server can hold a so HTTPPort = 6688 # Default ``` -HTTPPort is the port used for the Chainlink Node API, [CLI](/docs/configuration-variables/#cli-client), and GUI. +HTTPPort is the port used for the Chainlink Node API, CLI, and GUI. ### SecureCookies @@ -9257,7 +9257,7 @@ Finality for a block is solely defined by the finality related tags provided by FlagsContractAddress = '0xae4E781a6218A8031764928E88d457937A954fC3' # Example ``` -FlagsContractAddress can optionally point to a [Flags contract](../contracts/src/v0.8/Flags.sol). If set, the node will lookup that contract for each job that supports flags contracts (currently OCR and FM jobs are supported). If the job's contractAddress is set as hibernating in the FlagsContractAddress address, it overrides the standard update parameters (such as heartbeat/threshold). +FlagsContractAddress can optionally point to a [Flags contract](https://github.com/smartcontractkit/chainlink/blob/develop/contracts/src/v0.8/Flags.sol). If set, the node will lookup that contract for each job that supports flags contracts (currently OCR and FM jobs are supported). If the job's contractAddress is set as hibernating in the FlagsContractAddress address, it overrides the standard update parameters (such as heartbeat/threshold). ### LinkContractAddress diff --git a/src/features/ccip/GasLimitPool.mdx b/src/features/ccip/GasLimitPool.mdx index 3558172cf0f..9b78656cf36 100644 --- a/src/features/ccip/GasLimitPool.mdx +++ b/src/features/ccip/GasLimitPool.mdx @@ -5,5 +5,5 @@ import { Aside } from "@components" limit restrictions. The `releaseOrMint` function and other operations (e.g., balance checks) must not exceed the **90,000** gas limit on the destination blockchain. Failure to meet these requirements can lead to [manual execution](/ccip/concepts/manual-execution). For more details, refer to the [Requirements for Token - Pools](/ccip/concepts/cross-chain-tokens#requirement-for-token-pools). + Pools](/ccip/concepts/cross-chain-tokens#requirements-for-token-pools). diff --git a/src/scripts/link-check/ignoredfiles-internal.txt b/src/scripts/link-check/ignoredfiles-internal.txt new file mode 100644 index 00000000000..736e34c88a3 --- /dev/null +++ b/src/scripts/link-check/ignoredfiles-internal.txt @@ -0,0 +1,9 @@ +# TODO: linkcheck is not playing well with some css files generated at build time +assets\/.*.css$ +_astro\/.*.css$ + +# Exclude /ccip/directory/* URLs from internal link checking +\/ccip\/directory\/.* + +sitemap-index.xml +@vite/client \ No newline at end of file diff --git a/src/scripts/link-check/ignoredfiles.txt b/src/scripts/link-check/ignoredfiles.txt deleted file mode 100644 index bde15fcc5c2..00000000000 --- a/src/scripts/link-check/ignoredfiles.txt +++ /dev/null @@ -1,3 +0,0 @@ -# TODO: linkcheck is not playing well with some css files generated at build time -assets\/.*.css$ -_astro\/.*.css$ \ No newline at end of file diff --git a/src/scripts/link-check/linkcheck.ts b/src/scripts/link-check/linkcheck.ts index 4e6e963bd2e..395ce4657ee 100644 --- a/src/scripts/link-check/linkcheck.ts +++ b/src/scripts/link-check/linkcheck.ts @@ -63,10 +63,26 @@ const processSiteMap = (baseUrl: string): string => { const regex = /(?.*?)<\/loc>/gm const links: string[] = [] + // Use the appropriate ignore file based on mode + const ignoredPatternsFile = + mode === "external" + ? `${cwd()}/src/scripts/link-check/ignoredfiles-external.txt` + : `${cwd()}/src/scripts/link-check/ignoredfiles-internal.txt` + + const ignoredPatterns = readFileSync(ignoredPatternsFile, "utf8") + .split("\n") + .filter((line) => line && !line.startsWith("#")) + .map((pattern) => new RegExp(pattern)) + for (const loc of data.matchAll(regex)) { const link = loc.groups?.link if (link) { - links.push(link.replace("https://docs.chain.link", baseUrl)) + const normalizedLink = link.replace("https://docs.chain.link", baseUrl) + // Only add the link if it doesn't match any of the ignored patterns + const shouldInclude = !ignoredPatterns.some((pattern) => pattern.test(normalizedLink)) + if (shouldInclude) { + links.push(normalizedLink) + } } } @@ -91,7 +107,7 @@ try { exit(1) } -server = spawn("npm", ["run", "preview"], { +server = spawn("npm", ["run", "dev"], { stdio: ["ignore", "pipe", "pipe"], }) @@ -121,7 +137,7 @@ server.stdout.on("data", (data) => { "--input-file", linksFile, "--skip-file", - `${cwd()}/src/scripts/link-check/ignoredfiles.txt`, + `${cwd()}/src/scripts/link-check/ignoredfiles-internal.txt`, "--hosts", baseUrl, ]