mirror of
https://github.com/status-im/eth2.0-specs.git
synced 2025-02-03 14:24:24 +00:00
Merge pull request #2803 from ralexstokes/clean-up-linter
add `pylint` to catch unused args
This commit is contained in:
commit
02b32100ed
2
Makefile
2
Makefile
@ -130,9 +130,11 @@ codespell:
|
|||||||
codespell . --skip ./.git -I .codespell-whitelist
|
codespell . --skip ./.git -I .codespell-whitelist
|
||||||
|
|
||||||
# TODO: add future protocol upgrade patch packages to linting.
|
# TODO: add future protocol upgrade patch packages to linting.
|
||||||
|
# NOTE: we use `pylint` just for catching unused arguments in spec code
|
||||||
lint: pyspec
|
lint: pyspec
|
||||||
. venv/bin/activate; cd $(PY_SPEC_DIR); \
|
. venv/bin/activate; cd $(PY_SPEC_DIR); \
|
||||||
flake8 --config $(LINTER_CONFIG_FILE) ./eth2spec \
|
flake8 --config $(LINTER_CONFIG_FILE) ./eth2spec \
|
||||||
|
&& pylint --disable=all --enable unused-argument ./eth2spec/phase0 ./eth2spec/altair ./eth2spec/bellatrix \
|
||||||
&& mypy --config-file $(LINTER_CONFIG_FILE) -p eth2spec.phase0 -p eth2spec.altair -p eth2spec.bellatrix
|
&& mypy --config-file $(LINTER_CONFIG_FILE) -p eth2spec.phase0 -p eth2spec.altair -p eth2spec.bellatrix
|
||||||
|
|
||||||
lint_generators: pyspec
|
lint_generators: pyspec
|
||||||
|
4
setup.py
4
setup.py
@ -514,7 +514,7 @@ def get_pow_block(hash: Bytes32) -> Optional[PowBlock]:
|
|||||||
return PowBlock(block_hash=hash, parent_hash=Bytes32(), total_difficulty=uint256(0))
|
return PowBlock(block_hash=hash, parent_hash=Bytes32(), total_difficulty=uint256(0))
|
||||||
|
|
||||||
|
|
||||||
def get_execution_state(execution_state_root: Bytes32) -> ExecutionState:
|
def get_execution_state(_execution_state_root: Bytes32) -> ExecutionState:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@ -1008,7 +1008,7 @@ setup(
|
|||||||
python_requires=">=3.8, <4",
|
python_requires=">=3.8, <4",
|
||||||
extras_require={
|
extras_require={
|
||||||
"test": ["pytest>=4.4", "pytest-cov", "pytest-xdist"],
|
"test": ["pytest>=4.4", "pytest-cov", "pytest-xdist"],
|
||||||
"lint": ["flake8==3.7.7", "mypy==0.812"],
|
"lint": ["flake8==3.7.7", "mypy==0.812", "pylint==2.12.2"],
|
||||||
"generator": ["python-snappy==0.5.4"],
|
"generator": ["python-snappy==0.5.4"],
|
||||||
},
|
},
|
||||||
install_requires=[
|
install_requires=[
|
||||||
|
@ -521,7 +521,7 @@ def process_deposit(state: BeaconState, deposit: Deposit) -> None:
|
|||||||
signing_root = compute_signing_root(deposit_message, domain)
|
signing_root = compute_signing_root(deposit_message, domain)
|
||||||
# Initialize validator if the deposit signature is valid
|
# Initialize validator if the deposit signature is valid
|
||||||
if bls.Verify(pubkey, signing_root, deposit.data.signature):
|
if bls.Verify(pubkey, signing_root, deposit.data.signature):
|
||||||
state.validators.append(get_validator_from_deposit(state, deposit))
|
state.validators.append(get_validator_from_deposit(deposit))
|
||||||
state.balances.append(amount)
|
state.balances.append(amount)
|
||||||
state.previous_epoch_participation.append(ParticipationFlags(0b0000_0000))
|
state.previous_epoch_participation.append(ParticipationFlags(0b0000_0000))
|
||||||
state.current_epoch_participation.append(ParticipationFlags(0b0000_0000))
|
state.current_epoch_participation.append(ParticipationFlags(0b0000_0000))
|
||||||
|
@ -1832,7 +1832,7 @@ def process_attestation(state: BeaconState, attestation: Attestation) -> None:
|
|||||||
##### Deposits
|
##### Deposits
|
||||||
|
|
||||||
```python
|
```python
|
||||||
def get_validator_from_deposit(state: BeaconState, deposit: Deposit) -> Validator:
|
def get_validator_from_deposit(deposit: Deposit) -> Validator:
|
||||||
amount = deposit.data.amount
|
amount = deposit.data.amount
|
||||||
effective_balance = min(amount - amount % EFFECTIVE_BALANCE_INCREMENT, MAX_EFFECTIVE_BALANCE)
|
effective_balance = min(amount - amount % EFFECTIVE_BALANCE_INCREMENT, MAX_EFFECTIVE_BALANCE)
|
||||||
|
|
||||||
@ -1877,7 +1877,7 @@ def process_deposit(state: BeaconState, deposit: Deposit) -> None:
|
|||||||
return
|
return
|
||||||
|
|
||||||
# Add validator and balance entries
|
# Add validator and balance entries
|
||||||
state.validators.append(get_validator_from_deposit(state, deposit))
|
state.validators.append(get_validator_from_deposit(deposit))
|
||||||
state.balances.append(amount)
|
state.balances.append(amount)
|
||||||
else:
|
else:
|
||||||
# Increase balance by deposit amount
|
# Increase balance by deposit amount
|
||||||
|
Loading…
x
Reference in New Issue
Block a user