Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce the use of path aliases in @dendreth/relay #365

Merged
merged 13 commits into from
Sep 5, 2024
Merged

Commits on Sep 5, 2024

  1. Configuration menu
    Copy the full SHA
    ea9a1b7 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    7141903 View commit details
    Browse the repository at this point in the history
  3. config(@dendreth/solidity): Update hardhat.config.ts to use `tsconf…

    …ig-paths`
    
    Hardhat does not natively support TypeScript path aliases out of the box.
    However, we can use `tsconfig-paths` package to achieve this.
    
    With this we fix errors like this:
    ```
    An unexpected error occurred:
    
    Error: Your application tried to access @, but it isn't declared in your dependencies;
    this makes the require call ambiguous and unsound.
    
    Required package: @ (via "@/constants/network_config.json")
    Required by: <path>/DendrETH/relay/utils/
    ```
    EmilIvanichkovv authored and Dimo99 committed Sep 5, 2024
    Configuration menu
    Copy the full SHA
    26804bd View commit details
    Browse the repository at this point in the history
  4. build(check:build): Refactor script to run tsc with --build flag

    The --build option can be seen as a build orchestrator that finds referenced
    projects, checks if they are up-to-date, and builds out-of-date projects in the
    correct order.
    
    The path aliases changes we want to introduce, forces the need of
    referenced projects.
    EmilIvanichkovv authored and Dimo99 committed Sep 5, 2024
    Configuration menu
    Copy the full SHA
    7679454 View commit details
    Browse the repository at this point in the history
  5. config(tsconfig.json): Streamline the configuration to work with path…

    … aliases
    
    `compilerOptions` updates:
    - "composite": true
    - "rootDir": "./"
    - "declaration": true
    - "declarationMap": true
    
    Add `references` to the `relay` workspace
    Make sure all ts files are included
    EmilIvanichkovv authored and Dimo99 committed Sep 5, 2024
    Configuration menu
    Copy the full SHA
    1c3a316 View commit details
    Browse the repository at this point in the history
  6. config(tsconfig.json): Make sure all json files are included

    This change resolves problems like this:
    ```
    error TS6307: File '<path>/DendrETH/beacon-light-client/plonky2/input_fetchers/balance_verification/abi/lido_accounting_oracle_abi.json' is not listed within the file list of project '<path>DendrETH/relay/tsconfig.json'. Projects must list all files or use an 'include' pattern.
    
    7 import accountingOracleAbi from '../../abi/lido_accounting_oracle_abi.json';
    ```
    EmilIvanichkovv authored and Dimo99 committed Sep 5, 2024
    Configuration menu
    Copy the full SHA
    50dd0ee View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    91c519f View commit details
    Browse the repository at this point in the history
  8. config(relay): Add @lodestar/types in paths.

    This change fixes following problems:
    ```
    relay/implementations/beacon-api.ts:543:9 - error TS2742: The inferred type of 'getBeaconBlock' cannot be named without a reference to '../../.yarn/unplugged/@lodestar-types-npm-1.17.0-1607a25762/node_modules/@lodestar/types/lib/utils/executionAddress'. This is likely not portable. A type annotation is necessary.
    
    543   async getBeaconBlock(slot: bigint) {
                ~~~~~~~~~~~~~~
    
    relay/implementations/beacon-api.ts:574:9 - error TS2742: The inferred type of 'getBeaconState' cannot be named without a reference to '../../.yarn/unplugged/@lodestar-types-npm-1.17.0-1607a25762/node_modules/@lodestar/types/lib/utils/executionAddress'. This is likely not portable. A type annotation is necessary.
    
    574   async getBeaconState(slot: bigint) {
                ~~~~~~~~~~~~~~
    
    Found 2 errors.
    ```
    EmilIvanichkovv authored and Dimo99 committed Sep 5, 2024
    Configuration menu
    Copy the full SHA
    8b07858 View commit details
    Browse the repository at this point in the history
  9. config(tsconfig.json): Exclude dist dir

    This fixes problems like:
    ```
    error TS5055: Cannot write file <file-path> because it would overwrite input file.
    ```
    EmilIvanichkovv authored and Dimo99 committed Sep 5, 2024
    Configuration menu
    Copy the full SHA
    9135d99 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    a4b164e View commit details
    Browse the repository at this point in the history
  11. config(@dendreth/balance-verification): Add project references

    The `@dendreth/balance-verification` workspace rely on files from `@dendreth/relay`.
    That is why we need to add this reference.
    
    With this change following problem was resolved:
    Running `yarn build-plonky-2` ends in:
    ```
    error TS2688: Cannot find type definition file for 'node'.
      The file is in the program because:
        Entry point of type library 'node' specified in compilerOptions
    
    relay/implementations/beacon-api.ts:543:9 - error TS2742: The inferred type of 'getBeaconBlock' cannot be named without a reference to '../../.yarn/unplugged/@lodestar-types-npm-1.17.0-1607a25762/node_modules/@lodestar/types/lib/utils/executionAddress'. This is likely not portable. A type annotation is necessary.
    
    543   async getBeaconBlock(slot: bigint) {
                ~~~~~~~~~~~~~~
    
    relay/implementations/beacon-api.ts:574:9 - error TS2742: The inferred type of 'getBeaconState' cannot be named without a reference to '../../.yarn/unplugged/@lodestar-types-npm-1.17.0-1607a25762/node_modules/@lodestar/types/lib/utils/executionAddress'. This is likely not portable. A type annotation is necessary.
    
    574   async getBeaconState(slot: bigint) {
                ~~~~~~~~~~~~~~
    
    Found 3 errors in the same file, starting at: relay/implementations/beacon-api.ts:543
    ```
    EmilIvanichkovv authored and Dimo99 committed Sep 5, 2024
    Configuration menu
    Copy the full SHA
    9af3cd3 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    0b2d1ea View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    7152557 View commit details
    Browse the repository at this point in the history