From 4f32fd95d6af22ac18379d5f7a3dc5b3c57bf327 Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Mon, 28 Nov 2022 18:51:38 +0800 Subject: [PATCH] Enable EIP4844 lint and fix Pylint --- Makefile | 8 ++++---- linter.ini | 5 +++++ setup.py | 4 ++++ specs/eip4844/beacon-chain.md | 1 + specs/eip4844/validator.md | 1 + 5 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index c38d39a6d..73450562b 100644 --- a/Makefile +++ b/Makefile @@ -105,12 +105,12 @@ install_test: # Testing against `minimal` config by default test: pyspec . venv/bin/activate; cd $(PY_SPEC_DIR); \ - python3 -m pytest -n 4 --disable-bls --cov=eth2spec.phase0.minimal --cov=eth2spec.altair.minimal --cov=eth2spec.bellatrix.minimal --cov=eth2spec.capella.minimal --cov-report="html:$(COV_HTML_OUT)" --cov-branch eth2spec + python3 -m pytest -n 4 --disable-bls --cov=eth2spec.phase0.minimal --cov=eth2spec.altair.minimal --cov=eth2spec.bellatrix.minimal --cov=eth2spec.capella.minimal --cov=eth2spec.eip4844.minimal --cov-report="html:$(COV_HTML_OUT)" --cov-branch eth2spec # Testing against `minimal` config by default find_test: pyspec . venv/bin/activate; cd $(PY_SPEC_DIR); \ - python3 -m pytest -k=$(K) --disable-bls --cov=eth2spec.phase0.minimal --cov=eth2spec.altair.minimal --cov=eth2spec.bellatrix.minimal --cov=eth2spec.capella.minimal --cov-report="html:$(COV_HTML_OUT)" --cov-branch eth2spec + python3 -m pytest -k=$(K) --disable-bls --cov=eth2spec.phase0.minimal --cov=eth2spec.altair.minimal --cov=eth2spec.bellatrix.minimal --cov=eth2spec.capella.minimal --cov=eth2spec.eip4844.minimal --cov-report="html:$(COV_HTML_OUT)" --cov-branch eth2spec citest: pyspec mkdir -p $(TEST_REPORT_DIR); @@ -142,8 +142,8 @@ codespell: lint: pyspec . venv/bin/activate; cd $(PY_SPEC_DIR); \ flake8 --config $(LINTER_CONFIG_FILE) ./eth2spec \ - && pylint --disable=all --enable unused-argument ./eth2spec/phase0 ./eth2spec/altair ./eth2spec/bellatrix ./eth2spec/capella \ - && mypy --config-file $(LINTER_CONFIG_FILE) -p eth2spec.phase0 -p eth2spec.altair -p eth2spec.bellatrix -p eth2spec.capella + && pylint --rcfile $(LINTER_CONFIG_FILE) ./eth2spec/phase0 ./eth2spec/altair ./eth2spec/bellatrix ./eth2spec/capella ./eth2spec/eip4844 \ + && mypy --config-file $(LINTER_CONFIG_FILE) -p eth2spec.phase0 -p eth2spec.altair -p eth2spec.bellatrix -p eth2spec.capella -p eth2spec.eip4844 lint_generators: pyspec . venv/bin/activate; cd $(TEST_GENERATORS_DIR); \ diff --git a/linter.ini b/linter.ini index 6575642f1..52a3aec0e 100644 --- a/linter.ini +++ b/linter.ini @@ -11,3 +11,8 @@ warn_unused_configs = True warn_redundant_casts = True ignore_missing_imports = True + +# pylint +[MESSAGES CONTROL] +disable = all +enable = unused-argument diff --git a/setup.py b/setup.py index de446bb1c..13ef3c701 100644 --- a/setup.py +++ b/setup.py @@ -588,6 +588,7 @@ class NoopExecutionEngine(ExecutionEngine): pass def get_payload(self: ExecutionEngine, payload_id: PayloadId) -> ExecutionPayload: + # pylint: disable=unused-argument raise NotImplementedError("no default block production") @@ -643,12 +644,14 @@ T = TypeVar('T') # For generic function def no_op(fn): # type: ignore + # pylint: disable=unused-argument def wrapper(*args, **kw): # type: ignore return None return wrapper def get_empty_list_result(fn): # type: ignore + # pylint: disable=unused-argument def wrapper(*args, **kw): # type: ignore return [] return wrapper @@ -664,6 +667,7 @@ get_expected_withdrawals = get_empty_list_result(get_expected_withdrawals) # def retrieve_blobs_sidecar(slot: Slot, beacon_block_root: Root) -> Optional[BlobsSidecar]: + # pylint: disable=unused-argument return "TEST"''' @classmethod diff --git a/specs/eip4844/beacon-chain.md b/specs/eip4844/beacon-chain.md index 600793a3f..1afd21e88 100644 --- a/specs/eip4844/beacon-chain.md +++ b/specs/eip4844/beacon-chain.md @@ -284,6 +284,7 @@ def process_execution_payload(state: BeaconState, payload: ExecutionPayload, exe ```python def process_blob_kzg_commitments(state: BeaconState, body: BeaconBlockBody): + # pylint: disable=unused-argument assert verify_kzg_commitments_against_transactions(body.execution_payload.transactions, body.blob_kzg_commitments) ``` diff --git a/specs/eip4844/validator.md b/specs/eip4844/validator.md index 57a5610ce..1258358a2 100644 --- a/specs/eip4844/validator.md +++ b/specs/eip4844/validator.md @@ -46,6 +46,7 @@ Implementers may also retrieve blobs individually per transaction. ```python def get_blobs_and_kzg_commitments(payload_id: PayloadId) -> Tuple[Sequence[BLSFieldElement], Sequence[KZGCommitment]]: + # pylint: disable=unused-argument ... ```