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

backport: merge bitcoin#24778, #24766, #24849, #24844, #24853, #24895, #24802, #24932, partial bitcoin#23212, #23462 (lint backports) #6428

Open
wants to merge 14 commits into
base: develop
Choose a base branch
from

Conversation

kwvg
Copy link
Collaborator

@kwvg kwvg commented Nov 24, 2024

Additional Information

  • Dependency for backport: merge bitcoin#24794, #23524, #24902, #24915, #24916, #24929, #23506, #24840, #24982, partial bitcoin#25288 (lint backports: part 2) #6429

  • Even though support for Python scripts was extended to lint-all in bitcoin#24762 (dash#6023), the changes needed were not extended to parallelized linting added in dash#4637.

    This meant the match expression didn't include non-shell scripts and additionally, parallel interpreted all scripts as Bash scripts. This has been resolved in this PR.

  • bitcoin#23212 is partial as --ignore-missing-imports has not been removed from mypy arguments as the version of mypy used in the PR (0.910) isn't syntax aware to imports like here and here.

    Lint errors:
    dash@96b217d539f7:/src/dash$ ./test/lint/lint-python.sh
    Consider install flake8-cached for cached flake8 results.
    [...]
    test/functional/test_framework/crypto/muhash.py:9: error: Skipping analyzing ".chacha20": found module but no type hints or library stubs  [import]
    test/functional/test_framework/crypto/ellswift.py:15: error: Cannot find implementation or library stub for module named "test_framework.crypto.secp256k1"  [import]
    test/functional/test_framework/crypto/bip324_cipher.py:16: error: Skipping analyzing ".chacha20": found module but no type hints or library stubs  [import]
    test/functional/test_framework/crypto/bip324_cipher.py:17: error: Skipping analyzing ".poly1305": found module but no type hints or library stubs  [import]
    test/functional/test_framework/messages.py:29: error: Cannot find implementation or library stub for module named "test_framework.crypto.siphash"  [import]
    test/functional/test_framework/messages.py:32: error: Cannot find implementation or library stub for module named "dash_hash"  [import]
    test/functional/test_framework/script.py:20: error: Cannot find implementation or library stub for module named "test_framework.crypto.ripemd160"  [import]
    test/functional/test_framework/key.py:16: error: Cannot find implementation or library stub for module named "test_framework.crypto"  [import]
    test/functional/test_framework/v2_p2p.py:9: error: Cannot find implementation or library stub for module named "test_framework.crypto.bip324_cipher"  [import]
    test/functional/test_framework/v2_p2p.py:10: error: Cannot find implementation or library stub for module named "test_framework.crypto.chacha20"  [import]
    test/functional/test_framework/v2_p2p.py:11: error: Cannot find implementation or library stub for module named "test_framework.crypto.ellswift"  [import]
    test/functional/test_framework/v2_p2p.py:12: error: Cannot find implementation or library stub for module named "test_framework.crypto.hkdf"  [import]
    test/functional/p2p_v2_encrypted.py:22: error: Cannot find implementation or library stub for module named "test_framework.crypto.chacha20"  [import]
    test/functional/feature_utxo_set_hash.py:12: error: Cannot find implementation or library stub for module named "test_framework.crypto.muhash"  [import]
    Found 17 errors in 12 files (checked 275 source files)
    

    And upgrading to the latest version of mypy used upstream (1.4.1, source) brings syntax awareness but new errors.

    Lint errors:
    dash@96b217d539f7:/src/dash$ ./test/lint/lint-python.sh
    Consider install flake8-cached for cached flake8 results.
    [...]
    test/functional/test_framework/coverage.py:23: error: Incompatible default for argument "coverage_logfile" (default has type "None", argument has type "str")  [assignment]
    test/functional/test_framework/coverage.py:23: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
    test/functional/test_framework/coverage.py:23: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
    test/functional/test_framework/util.py:322: error: Incompatible default for argument "timeout" (default has type "None", argument has type "int")  [assignment]
    test/functional/test_framework/util.py:322: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
    test/functional/test_framework/util.py:322: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
    test/functional/test_framework/util.py:322: error: Incompatible default for argument "coveragedir" (default has type "None", argument has type "str")  [assignment]
    test/functional/test_framework/messages.py:32: error: Cannot find implementation or library stub for module named "dash_hash"  [import]
    test/functional/test_framework/test_framework.py:122: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
    test/functional/test_framework/test_framework.py:123: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
    test/functional/test_framework/test_framework.py:124: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
    test/functional/test_framework/test_framework.py:125: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
    test/functional/p2p_message_capture.py:48: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
    Found 6 errors in 5 files (checked 275 source files)
    
  • bitcoin#23462 is partial as neither SC2046 nor SC2086 have been enabled. This backport was done for the sole purpose of backporting changes to shell scripts that would be replaced with their Python counterparts in later backports.

    The necessary changes needed to enable SC2046 and SC2086 will be done in a later pull request.

  • actions/checkout does not do a full clone nor tracks the default branch by default. It is already documented that git merge-base (used by lint-git-commit-check.py and lint-whitespace.py, source) doesn't play nice with it (see actions/checkout#423).

    No such issue exists on GitLab (build), but it remains present on GitHub Actions (build). This PR does a full clone, switches to the develop branch, then switches back to the intended commit, as a workaround (see working build here)

  • Changes to run-lint-format-strings.py made in dash#4807 were reverted as they were interfering with lint-format-strings.py

    Lint error:
    dash@96b217d539f7:/src/dash$ ./test/lint/lint-format-strings.py
    Traceback (most recent call last):
      File "/src/dash/test/lint/run-lint-format-strings.py", line 308, in <module>
        main()
      File "/src/dash/test/lint/run-lint-format-strings.py", line 304, in main
        sys.exit(max(exit_codes))
    ValueError: max() arg is an empty sequence
    Traceback (most recent call last):
      File "/src/dash/test/lint/run-lint-format-strings.py", line 308, in <module>
        main()
      File "/src/dash/test/lint/run-lint-format-strings.py", line 304, in main
        sys.exit(max(exit_codes))
    ValueError: max() arg is an empty sequence
    

Breaking Changes

None expected.

Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas (note: N/A)
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation
  • I have assigned this pull request to a milestone (for repository code-owners and collaborators only)

@kwvg kwvg added this to the 22.1 milestone Nov 24, 2024
@kwvg kwvg force-pushed the shtopy branch 2 times, most recently from 544bc0d to 94b14ea Compare November 24, 2024 12:06
@kwvg
Copy link
Collaborator Author

kwvg commented Nov 24, 2024

GitHub Actions run for 4aaa314, https://github.com/kwvg/dash/actions/runs/11996049561.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant