Skip to content

Commit 7eab0c0

Browse files
committed
chore(forks): Fix issues from lint after rebase with Osaka latest
1 parent cbf3b9a commit 7eab0c0

File tree

9 files changed

+18
-19
lines changed

9 files changed

+18
-19
lines changed

src/ethereum/amsterdam/bloom.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ def add_to_bloom(bloom: bytearray, bloom_entry: Bytes) -> None:
4242
bloom_entry :
4343
An entry which is to be added to bloom filter.
4444
"""
45-
hash = keccak256(bloom_entry)
45+
hashed = keccak256(bloom_entry)
4646

4747
for idx in (0, 2, 4):
4848
# Obtain the least significant 11 bits from the pair of bytes
4949
# (16 bits), and set this bit in bloom bytearray.
5050
# The obtained bit is 0-indexed in the bloom filter from the least
5151
# significant bit to the most significant bit.
52-
bit_to_set = Uint.from_be_bytes(hash[idx : idx + 2]) & Uint(0x07FF)
52+
bit_to_set = Uint.from_be_bytes(hashed[idx : idx + 2]) & Uint(0x07FF)
5353
# Below is the index of the bit in the bytearray (where 0-indexed
5454
# byte is the most significant byte)
5555
bit_index = 0x07FF - int(bit_to_set)

src/ethereum/amsterdam/fork.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ def check_transaction(
458458
NoBlobDataError :
459459
If the transaction is a type 3 but has no blobs.
460460
BlobCountExceededError :
461-
If the transaction is a type 3 and has nore blobs than the limit.
461+
If the transaction is a type 3 and has more blobs than the limit.
462462
TransactionTypeContractCreationError:
463463
If the transaction type is not allowed to create contracts.
464464
EmptyAuthorizationListError :

src/ethereum/amsterdam/fork_types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
Introduction
1010
------------
1111
12-
Types re-used throughout the specification, which are specific to Ethereum.
12+
Types reused throughout the specification, which are specific to Ethereum.
1313
"""
1414

1515
from dataclasses import dataclass

src/ethereum/amsterdam/vm/gas.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ def calculate_memory_gas_cost(size_in_bytes: Uint) -> Uint:
160160
total_gas_cost = linear_cost + quadratic_cost
161161
try:
162162
return total_gas_cost
163-
except ValueError:
164-
raise OutOfGasError
163+
except ValueError as e:
164+
raise OutOfGasError from e
165165

166166

167167
def calculate_gas_extend_memory(
@@ -264,7 +264,7 @@ def max_message_call_gas(gas: Uint) -> Uint:
264264

265265
def init_code_cost(init_code_length: Uint) -> Uint:
266266
"""
267-
Calculates the gas to be charged for the init code in CREAT*
267+
Calculates the gas to be charged for the init code in CREATE*
268268
opcodes as well as create transactions.
269269
270270
Parameters

src/ethereum/amsterdam/vm/instructions/block.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ def block_hash(evm: Evm) -> None:
5252
# Default hash to 0, if the block of interest is not yet on the chain
5353
# (including the block which has the current executing transaction),
5454
# or if the block's age is more than 256.
55-
hash = b"\x00"
55+
current_block_hash = b"\x00"
5656
else:
57-
hash = evm.message.block_env.block_hashes[
57+
current_block_hash = evm.message.block_env.block_hashes[
5858
-(current_block_number - block_number)
5959
]
6060

61-
push(evm.stack, U256.from_be_bytes(hash))
61+
push(evm.stack, U256.from_be_bytes(current_block_hash))
6262

6363
# PROGRAM COUNTER
6464
evm.pc += Uint(1)

src/ethereum/amsterdam/vm/instructions/keccak.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ def keccak(evm: Evm) -> None:
5656
# OPERATION
5757
evm.memory += b"\x00" * extend_memory.expand_by
5858
data = memory_read_bytes(evm.memory, memory_start_index, size)
59-
hash = keccak256(data)
59+
hashed = keccak256(data)
6060

61-
push(evm.stack, U256.from_be_bytes(hash))
61+
push(evm.stack, U256.from_be_bytes(hashed))
6262

6363
# PROGRAM COUNTER
6464
evm.pc += Uint(1)

src/ethereum/amsterdam/vm/interpreter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,8 +310,8 @@ def execute_code(message: Message) -> Evm:
310310
while evm.running and evm.pc < ulen(evm.code):
311311
try:
312312
op = Ops(evm.code[evm.pc])
313-
except ValueError:
314-
raise InvalidOpcode(evm.code[evm.pc])
313+
except ValueError as e:
314+
raise InvalidOpcode(evm.code[evm.pc]) from e
315315

316316
evm_trace(evm, OpStart(op))
317317
op_implementation[op](evm)

src/ethereum/amsterdam/vm/precompiled_contracts/bls12_381/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@
2525
curve_order,
2626
is_inf,
2727
is_on_curve,
28+
normalize,
2829
)
2930
from py_ecc.optimized_bls12_381.optimized_curve import (
3031
multiply as bls12_multiply,
3132
)
32-
from py_ecc.optimized_bls12_381.optimized_curve import normalize
3333
from py_ecc.typing import Optimized_Point3D as Point3D
3434

3535
from ....vm.memory import buffer_read
@@ -547,7 +547,7 @@ def bytes_to_g2(
547547
return _bytes_to_g2_cached(data, subgroup_check)
548548

549549

550-
def FQ2_to_bytes(fq2: FQ2) -> Bytes:
550+
def fq2_to_bytes(fq2: FQ2) -> Bytes:
551551
"""
552552
Encode a FQ2 point to 128 bytes.
553553
@@ -582,7 +582,7 @@ def g2_to_bytes(
582582
The encoded data.
583583
"""
584584
x_coords, y_coords = normalize(g2_point)
585-
return FQ2_to_bytes(x_coords) + FQ2_to_bytes(y_coords)
585+
return fq2_to_bytes(x_coords) + fq2_to_bytes(y_coords)
586586

587587

588588
def decode_g2_scalar_pair(

src/ethereum/amsterdam/vm/precompiled_contracts/bls12_381/bls12_381_pairing.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@
1313
"""
1414

1515
from ethereum_types.numeric import Uint
16-
from py_ecc.optimized_bls12_381 import FQ12, curve_order, is_inf
16+
from py_ecc.optimized_bls12_381 import FQ12, curve_order, is_inf, pairing
1717
from py_ecc.optimized_bls12_381 import multiply as bls12_multiply
18-
from py_ecc.optimized_bls12_381 import pairing
1918

2019
from ....vm import Evm
2120
from ....vm.gas import charge_gas

0 commit comments

Comments
 (0)