Skip to content

Commit 29f791b

Browse files
committed
More bytes -> Bytes changes
1 parent 721923d commit 29f791b

File tree

101 files changed

+245
-158
lines changed

Some content is hidden

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

101 files changed

+245
-158
lines changed

src/ethereum/arrow_glacier/blocks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class Log:
7272

7373
address: Address
7474
topics: Tuple[Hash32, ...]
75-
data: bytes
75+
data: Bytes
7676

7777

7878
@slotted_freezable

src/ethereum/arrow_glacier/bloom.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
from typing import Tuple
2020

21+
from ethereum_types.bytes import Bytes
2122
from ethereum_types.numeric import Uint
2223

2324
from ethereum.crypto.hash import keccak256
@@ -26,7 +27,7 @@
2627
from .fork_types import Bloom
2728

2829

29-
def add_to_bloom(bloom: bytearray, bloom_entry: bytes) -> None:
30+
def add_to_bloom(bloom: bytearray, bloom_entry: Bytes) -> None:
3031
"""
3132
Add a bloom entry to the bloom filter (`bloom`).
3233

src/ethereum/arrow_glacier/utils/hexadecimal.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
Hexadecimal utility functions used in this specification, specific to
1313
Arrow Glacier types.
1414
"""
15+
from ethereum_types.bytes import Bytes
16+
1517
from ethereum.utils.hexadecimal import remove_hex_prefix
1618

1719
from ..fork_types import Address, Bloom, Root
@@ -31,7 +33,7 @@ def hex_to_root(hex_string: str) -> Root:
3133
root : `Root`
3234
Trie root obtained from the given hexadecimal string.
3335
"""
34-
return Root(bytes.fromhex(remove_hex_prefix(hex_string)))
36+
return Root(Bytes.fromhex(remove_hex_prefix(hex_string)))
3537

3638

3739
def hex_to_bloom(hex_string: str) -> Bloom:
@@ -48,7 +50,7 @@ def hex_to_bloom(hex_string: str) -> Bloom:
4850
bloom : `Bloom`
4951
Bloom obtained from the given hexadecimal string.
5052
"""
51-
return Bloom(bytes.fromhex(remove_hex_prefix(hex_string)))
53+
return Bloom(Bytes.fromhex(remove_hex_prefix(hex_string)))
5254

5355

5456
def hex_to_address(hex_string: str) -> Address:
@@ -65,4 +67,4 @@ def hex_to_address(hex_string: str) -> Address:
6567
address : `Address`
6668
The address obtained from the given hexadecimal string.
6769
"""
68-
return Address(bytes.fromhex(remove_hex_prefix(hex_string).rjust(40, "0")))
70+
return Address(Bytes.fromhex(remove_hex_prefix(hex_string).rjust(40, "0")))

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
Implementations of the EVM Arithmetic instructions.
1313
"""
1414

15+
from ethereum_types.bytes import Bytes
1516
from ethereum_types.numeric import U256, Uint
1617

1718
from ethereum.utils.numeric import get_sign
@@ -354,7 +355,7 @@ def signextend(evm: Evm) -> None:
354355
result = value
355356
else:
356357
# U256(0).to_be_bytes() gives b'' instead b'\x00'.
357-
value_bytes = bytes(value.to_be_bytes32())
358+
value_bytes = Bytes(value.to_be_bytes32())
358359
# Now among the obtained value bytes, consider only
359360
# N `least significant bytes`, where N is `byte_num + 1`.
360361
value_bytes = value_bytes[31 - int(byte_num) :]

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
Implementations of the EVM system related instructions.
1313
"""
1414

15-
from ethereum_types.bytes import Bytes0
15+
from ethereum_types.bytes import Bytes, Bytes0
1616
from ethereum_types.numeric import U256, Uint
1717

1818
from ethereum.utils.numeric import ceil32
@@ -680,7 +680,7 @@ def revert(evm: Evm) -> None:
680680
# OPERATION
681681
evm.memory += b"\x00" * extend_memory.expand_by
682682
output = memory_read_bytes(evm.memory, memory_start_index, size)
683-
evm.output = bytes(output)
683+
evm.output = Bytes(output)
684684
raise Revert
685685

686686
# PROGRAM COUNTER

src/ethereum/arrow_glacier/vm/runtime.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@
1313
"""
1414
from typing import Set
1515

16+
from ethereum_types.bytes import Bytes
1617
from ethereum_types.numeric import Uint, ulen
1718

1819
from .instructions import Ops
1920

2021

21-
def get_valid_jump_destinations(code: bytes) -> Set[Uint]:
22+
def get_valid_jump_destinations(code: Bytes) -> Set[Uint]:
2223
"""
2324
Analyze the evm code to obtain the set of valid jump destinations.
2425

src/ethereum/berlin/blocks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class Log:
6666

6767
address: Address
6868
topics: Tuple[Hash32, ...]
69-
data: bytes
69+
data: Bytes
7070

7171

7272
@slotted_freezable

src/ethereum/berlin/bloom.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
from typing import Tuple
2020

21+
from ethereum_types.bytes import Bytes
2122
from ethereum_types.numeric import Uint
2223

2324
from ethereum.crypto.hash import keccak256
@@ -26,7 +27,7 @@
2627
from .fork_types import Bloom
2728

2829

29-
def add_to_bloom(bloom: bytearray, bloom_entry: bytes) -> None:
30+
def add_to_bloom(bloom: bytearray, bloom_entry: Bytes) -> None:
3031
"""
3132
Add a bloom entry to the bloom filter (`bloom`).
3233

src/ethereum/berlin/utils/hexadecimal.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
Hexadecimal utility functions used in this specification, specific to
1313
Berlin types.
1414
"""
15+
from ethereum_types.bytes import Bytes
16+
1517
from ethereum.utils.hexadecimal import remove_hex_prefix
1618

1719
from ..fork_types import Address, Bloom, Root
@@ -31,7 +33,7 @@ def hex_to_root(hex_string: str) -> Root:
3133
root : `Root`
3234
Trie root obtained from the given hexadecimal string.
3335
"""
34-
return Root(bytes.fromhex(remove_hex_prefix(hex_string)))
36+
return Root(Bytes.fromhex(remove_hex_prefix(hex_string)))
3537

3638

3739
def hex_to_bloom(hex_string: str) -> Bloom:
@@ -48,7 +50,7 @@ def hex_to_bloom(hex_string: str) -> Bloom:
4850
bloom : `Bloom`
4951
Bloom obtained from the given hexadecimal string.
5052
"""
51-
return Bloom(bytes.fromhex(remove_hex_prefix(hex_string)))
53+
return Bloom(Bytes.fromhex(remove_hex_prefix(hex_string)))
5254

5355

5456
def hex_to_address(hex_string: str) -> Address:
@@ -65,4 +67,4 @@ def hex_to_address(hex_string: str) -> Address:
6567
address : `Address`
6668
The address obtained from the given hexadecimal string.
6769
"""
68-
return Address(bytes.fromhex(remove_hex_prefix(hex_string).rjust(40, "0")))
70+
return Address(Bytes.fromhex(remove_hex_prefix(hex_string).rjust(40, "0")))

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
Implementations of the EVM Arithmetic instructions.
1313
"""
1414

15+
from ethereum_types.bytes import Bytes
1516
from ethereum_types.numeric import U256, Uint
1617

1718
from ethereum.utils.numeric import get_sign
@@ -354,7 +355,7 @@ def signextend(evm: Evm) -> None:
354355
result = value
355356
else:
356357
# U256(0).to_be_bytes() gives b'' instead b'\x00'.
357-
value_bytes = bytes(value.to_be_bytes32())
358+
value_bytes = Bytes(value.to_be_bytes32())
358359
# Now among the obtained value bytes, consider only
359360
# N `least significant bytes`, where N is `byte_num + 1`.
360361
value_bytes = value_bytes[31 - int(byte_num) :]

0 commit comments

Comments
 (0)