Skip to content

Commit 1e79796

Browse files
committed
Type fixes for pyright
1 parent 8b92823 commit 1e79796

File tree

74 files changed

+226
-180
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+226
-180
lines changed

src/ethereum/arrow_glacier/utils/address.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def compute_contract_address(address: Address, nonce: Uint) -> Address:
6565

6666

6767
def compute_create2_contract_address(
68-
address: Address, salt: Bytes32, call_data: bytearray
68+
address: Address, salt: Bytes32, call_data: bytes
6969
) -> Address:
7070
"""
7171
Computes address of the new account that needs to be created, which is

src/ethereum/arrow_glacier/vm/instructions/arithmetic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ def signextend(evm: Evm) -> None:
364364
else:
365365
num_bytes_prepend = U256(32) - (byte_num + U256(1))
366366
result = U256.from_be_bytes(
367-
bytearray([0xFF] * num_bytes_prepend) + value_bytes
367+
bytes([0xFF] * num_bytes_prepend) + value_bytes
368368
)
369369

370370
push(evm.stack, result)

src/ethereum/arrow_glacier/vm/interpreter.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ def execute_code(message: Message) -> Evm:
286286
)
287287
try:
288288
if evm.message.code_address in PRE_COMPILED_CONTRACTS:
289+
assert evm.message.code_address is not None
289290
evm_trace(evm, PrecompileStart(evm.message.code_address))
290291
PRE_COMPILED_CONTRACTS[evm.message.code_address](evm)
291292
evm_trace(evm, PrecompileEnd())

src/ethereum/arrow_glacier/vm/memory.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def memory_write(
3737

3838
def memory_read_bytes(
3939
memory: bytearray, start_position: U256, size: U256
40-
) -> bytearray:
40+
) -> bytes:
4141
"""
4242
Read bytes from memory.
4343
@@ -55,7 +55,7 @@ def memory_read_bytes(
5555
data_bytes :
5656
Data read from memory.
5757
"""
58-
return memory[start_position : Uint(start_position) + Uint(size)]
58+
return bytes(memory[start_position : Uint(start_position) + Uint(size)])
5959

6060

6161
def buffer_read(buffer: Bytes, start_position: U256, size: U256) -> Bytes:

src/ethereum/berlin/utils/address.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def compute_contract_address(address: Address, nonce: Uint) -> Address:
6565

6666

6767
def compute_create2_contract_address(
68-
address: Address, salt: Bytes32, call_data: bytearray
68+
address: Address, salt: Bytes32, call_data: bytes
6969
) -> Address:
7070
"""
7171
Computes address of the new account that needs to be created, which is

src/ethereum/berlin/vm/instructions/arithmetic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ def signextend(evm: Evm) -> None:
364364
else:
365365
num_bytes_prepend = U256(32) - (byte_num + U256(1))
366366
result = U256.from_be_bytes(
367-
bytearray([0xFF] * num_bytes_prepend) + value_bytes
367+
bytes([0xFF] * num_bytes_prepend) + value_bytes
368368
)
369369

370370
push(evm.stack, result)

src/ethereum/berlin/vm/interpreter.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ def execute_code(message: Message) -> Evm:
282282
)
283283
try:
284284
if evm.message.code_address in PRE_COMPILED_CONTRACTS:
285+
assert evm.message.code_address is not None
285286
evm_trace(evm, PrecompileStart(evm.message.code_address))
286287
PRE_COMPILED_CONTRACTS[evm.message.code_address](evm)
287288
evm_trace(evm, PrecompileEnd())

src/ethereum/berlin/vm/memory.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def memory_write(
3737

3838
def memory_read_bytes(
3939
memory: bytearray, start_position: U256, size: U256
40-
) -> bytearray:
40+
) -> bytes:
4141
"""
4242
Read bytes from memory.
4343
@@ -55,7 +55,7 @@ def memory_read_bytes(
5555
data_bytes :
5656
Data read from memory.
5757
"""
58-
return memory[start_position : Uint(start_position) + Uint(size)]
58+
return bytes(memory[start_position : Uint(start_position) + Uint(size)])
5959

6060

6161
def buffer_read(buffer: Bytes, start_position: U256, size: U256) -> Bytes:

src/ethereum/byzantium/vm/instructions/arithmetic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ def signextend(evm: Evm) -> None:
364364
else:
365365
num_bytes_prepend = U256(32) - (byte_num + U256(1))
366366
result = U256.from_be_bytes(
367-
bytearray([0xFF] * num_bytes_prepend) + value_bytes
367+
bytes([0xFF] * num_bytes_prepend) + value_bytes
368368
)
369369

370370
push(evm.stack, result)

src/ethereum/byzantium/vm/interpreter.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ def execute_code(message: Message) -> Evm:
273273
)
274274
try:
275275
if evm.message.code_address in PRE_COMPILED_CONTRACTS:
276+
assert evm.message.code_address is not None
276277
evm_trace(evm, PrecompileStart(evm.message.code_address))
277278
PRE_COMPILED_CONTRACTS[evm.message.code_address](evm)
278279
evm_trace(evm, PrecompileEnd())

0 commit comments

Comments
 (0)