diff --git a/src/ethereum/ethash.py b/src/ethereum/ethash.py index 830eba02ea9..413a056c3ba 100644 --- a/src/ethereum/ethash.py +++ b/src/ethereum/ethash.py @@ -398,8 +398,8 @@ def hashimoto_light( dataset_size: Uint, ) -> Tuple[Bytes, Hash32]: """ - Run the [`hashimoto`] algorithm by generating dataset item using the cache - instead of loading the full dataset into main memory. + Run the [`hashimoto`] algorithm by generating a dataset item using the + cache instead of loading the full dataset into main memory. #### Parameters diff --git a/src/ethereum/exceptions.py b/src/ethereum/exceptions.py index 578b55c5023..dafb73b64fc 100644 --- a/src/ethereum/exceptions.py +++ b/src/ethereum/exceptions.py @@ -18,7 +18,7 @@ class InvalidBlock(EthereumException): class StateWithEmptyAccount(EthereumException): """ - Thrown when the state has empty account. + Thrown when the state has an empty account. """ diff --git a/src/ethereum/forks/amsterdam/blocks.py b/src/ethereum/forks/amsterdam/blocks.py index ba3c27e9e3f..f9670fadc98 100644 --- a/src/ethereum/forks/amsterdam/blocks.py +++ b/src/ethereum/forks/amsterdam/blocks.py @@ -152,7 +152,7 @@ class Header: number: Uint """ - Block number, (height) in the chain. + Block number (height) in the chain. """ gas_limit: Uint @@ -272,7 +272,7 @@ class Block: header: Header """ The block header containing metadata and cryptographic commitments. Refer - [headers] for more details on the fields included in the header. + to [headers] for more details on the fields included in the header. [headers]: ref:ethereum.forks.amsterdam.blocks.Header """ diff --git a/src/ethereum/forks/amsterdam/bloom.py b/src/ethereum/forks/amsterdam/bloom.py index 8a12ec081dd..0e079df6b39 100644 --- a/src/ethereum/forks/amsterdam/bloom.py +++ b/src/ethereum/forks/amsterdam/bloom.py @@ -8,7 +8,7 @@ Introduction ------------ -This modules defines functions for calculating bloom filters of logs. For the +This module defines functions for calculating bloom filters of logs. For the general theory of bloom filters see e.g. `Wikipedia `_. Bloom filters are used to allow for efficient searching of logs by address and/or topic, by rapidly diff --git a/src/ethereum/forks/amsterdam/requests.py b/src/ethereum/forks/amsterdam/requests.py index 929e973e587..542c9264d37 100644 --- a/src/ethereum/forks/amsterdam/requests.py +++ b/src/ethereum/forks/amsterdam/requests.py @@ -1,5 +1,5 @@ """ -Requests were introduced in EIP-7685 as a a general purpose framework for +Requests were introduced in EIP-7685 as a general purpose framework for storing contract-triggered requests. It extends the execution header and body with a single field each to store the request information. This inherently exposes the requests to the consensus layer, which can diff --git a/src/ethereum/forks/amsterdam/state.py b/src/ethereum/forks/amsterdam/state.py index e997411f6da..6571aa05c61 100644 --- a/src/ethereum/forks/amsterdam/state.py +++ b/src/ethereum/forks/amsterdam/state.py @@ -400,7 +400,7 @@ def account_exists(state: State, address: Address) -> bool: def account_has_code_or_nonce(state: State, address: Address) -> bool: """ - Checks if an account has non zero nonce or non empty code. + Checks if an account has non-zero nonce or non-empty code. Parameters ---------- @@ -412,7 +412,7 @@ def account_has_code_or_nonce(state: State, address: Address) -> bool: Returns ------- has_code_or_nonce : `bool` - True if the account has non zero nonce or non empty code, + True if the account has non-zero nonce or non-empty code, False otherwise. """ @@ -517,7 +517,7 @@ def set_account_balance(state: State, address: Address, amount: U256) -> None: Address of the account whose nonce needs to be incremented. amount: - The amount that needs to set in balance. + The amount that needs to be set in the balance. """ @@ -557,7 +557,7 @@ def set_code(state: State, address: Address, code: Bytes) -> None: The current state. address: - Address of the account whose code needs to be update. + Address of the account whose code needs to be updated. code: The bytecode that needs to be set. diff --git a/src/ethereum/forks/amsterdam/trie.py b/src/ethereum/forks/amsterdam/trie.py index 09f67447dbe..77c41f7ff81 100644 --- a/src/ethereum/forks/amsterdam/trie.py +++ b/src/ethereum/forks/amsterdam/trie.py @@ -138,7 +138,7 @@ class BranchNode: def encode_internal_node(node: Optional[InternalNode]) -> Extended: """ Encodes a Merkle Trie node into its RLP form. The RLP will then be - serialized into a `Bytes` and hashed unless it is less that 32 bytes + serialized into a `Bytes` object and hashed unless it is less than 32 bytes when serialized. This function also accepts `None`, representing the absence of a node, diff --git a/src/ethereum/forks/amsterdam/vm/__init__.py b/src/ethereum/forks/amsterdam/vm/__init__.py index b2a8c5e2b9f..641695ea0e7 100644 --- a/src/ethereum/forks/amsterdam/vm/__init__.py +++ b/src/ethereum/forks/amsterdam/vm/__init__.py @@ -63,7 +63,7 @@ class BlockOutput: receipts_trie : `ethereum.fork_types.Root` Trie root of all the receipts in the block. receipt_keys : - Key of all the receipts in the block. + Keys of all the receipts in the block. block_logs : `Bloom` Logs bloom of all the logs included in all the transactions of the block. diff --git a/src/ethereum/forks/amsterdam/vm/eoa_delegation.py b/src/ethereum/forks/amsterdam/vm/eoa_delegation.py index 29909b5fa56..bc96f4c3275 100644 --- a/src/ethereum/forks/amsterdam/vm/eoa_delegation.py +++ b/src/ethereum/forks/amsterdam/vm/eoa_delegation.py @@ -157,8 +157,6 @@ def set_delegation(message: Message) -> U256: ---------- message : Transaction specific items. - env : - External items required for EVM execution. Returns ------- diff --git a/src/ethereum/forks/amsterdam/vm/gas.py b/src/ethereum/forks/amsterdam/vm/gas.py index 360a4430e33..aa07e7cae70 100644 --- a/src/ethereum/forks/amsterdam/vm/gas.py +++ b/src/ethereum/forks/amsterdam/vm/gas.py @@ -232,7 +232,7 @@ def calculate_message_call_gas( account inside a message call. call_stipend : The amount of stipend provided to a message call to execute code while - transferring value(ETH). + transferring value (ETH). Returns ------- @@ -288,7 +288,7 @@ def init_code_cost(init_code_length: Uint) -> Uint: def calculate_excess_blob_gas(parent_header: Header) -> U64: """ - Calculated the excess blob gas for the current block based + Calculates the excess blob gas for the current block based on the gas used in the parent block. Parameters diff --git a/src/ethereum/forks/amsterdam/vm/instructions/arithmetic.py b/src/ethereum/forks/amsterdam/vm/instructions/arithmetic.py index de5d6ab43d5..b7b1a370ad4 100644 --- a/src/ethereum/forks/amsterdam/vm/instructions/arithmetic.py +++ b/src/ethereum/forks/amsterdam/vm/instructions/arithmetic.py @@ -84,7 +84,7 @@ def sub(evm: Evm) -> None: def mul(evm: Evm) -> None: """ - Multiply the top two elements of the stack, and pushes the result back + Multiplies the top two elements of the stack, and pushes the result back on the stack. Parameters @@ -353,7 +353,7 @@ def signextend(evm: Evm) -> None: # Can't extend any further result = value else: - # U256(0).to_be_bytes() gives b'' instead b'\x00'. + # U256(0).to_be_bytes() gives b'' instead of b'\x00'. value_bytes = Bytes(value.to_be_bytes32()) # Now among the obtained value bytes, consider only # N `least significant bytes`, where N is `byte_num + 1`. diff --git a/src/ethereum/forks/amsterdam/vm/instructions/block.py b/src/ethereum/forks/amsterdam/vm/instructions/block.py index 78783751dd5..e563a2e96e8 100644 --- a/src/ethereum/forks/amsterdam/vm/instructions/block.py +++ b/src/ethereum/forks/amsterdam/vm/instructions/block.py @@ -101,7 +101,7 @@ def coinbase(evm: Evm) -> None: def timestamp(evm: Evm) -> None: """ Push the current block's timestamp onto the stack. Here the timestamp - being referred is actually the unix timestamp in seconds. + being referred to is actually the unix timestamp in seconds. Here the current block refers to the block in which the currently executing transaction/call resides. diff --git a/src/ethereum/forks/amsterdam/vm/instructions/environment.py b/src/ethereum/forks/amsterdam/vm/instructions/environment.py index 83690434658..28c595ee514 100644 --- a/src/ethereum/forks/amsterdam/vm/instructions/environment.py +++ b/src/ethereum/forks/amsterdam/vm/instructions/environment.py @@ -426,7 +426,7 @@ def returndatasize(evm: Evm) -> None: def returndatacopy(evm: Evm) -> None: """ - Copies data from the return data buffer code to memory. + Copies data from the return data buffer to memory. Parameters ---------- diff --git a/src/ethereum/forks/amsterdam/vm/instructions/memory.py b/src/ethereum/forks/amsterdam/vm/instructions/memory.py index 631d33a7fd6..6e111051ee3 100644 --- a/src/ethereum/forks/amsterdam/vm/instructions/memory.py +++ b/src/ethereum/forks/amsterdam/vm/instructions/memory.py @@ -93,7 +93,7 @@ def mstore8(evm: Evm) -> None: def mload(evm: Evm) -> None: """ - Load word from memory. + Loads a word from memory. Parameters ---------- @@ -123,7 +123,7 @@ def mload(evm: Evm) -> None: def msize(evm: Evm) -> None: """ - Push the size of active memory in bytes onto the stack. + Pushes the size of active memory in bytes onto the stack. Parameters ---------- @@ -146,7 +146,7 @@ def msize(evm: Evm) -> None: def mcopy(evm: Evm) -> None: """ - Copy the bytes in memory from one location to another. + Copies the bytes in memory from one location to another. Parameters ---------- diff --git a/src/ethereum/forks/amsterdam/vm/instructions/stack.py b/src/ethereum/forks/amsterdam/vm/instructions/stack.py index e381b52c370..0007a28acd4 100644 --- a/src/ethereum/forks/amsterdam/vm/instructions/stack.py +++ b/src/ethereum/forks/amsterdam/vm/instructions/stack.py @@ -23,7 +23,7 @@ def pop(evm: Evm) -> None: """ - Remove item from stack. + Removes an item from the stack. Parameters ---------- @@ -46,7 +46,7 @@ def pop(evm: Evm) -> None: def push_n(evm: Evm, num_bytes: int) -> None: """ - Pushes a N-byte immediate onto the stack. Push zero if num_bytes is zero. + Pushes an N-byte immediate onto the stack. Push zero if num_bytes is zero. Parameters ---------- @@ -79,7 +79,7 @@ def push_n(evm: Evm, num_bytes: int) -> None: def dup_n(evm: Evm, item_number: int) -> None: """ - Duplicate the Nth stack item (from top of the stack) to the top of stack. + Duplicates the Nth stack item (from top of the stack) to the top of stack. Parameters ---------- @@ -107,7 +107,7 @@ def dup_n(evm: Evm, item_number: int) -> None: def swap_n(evm: Evm, item_number: int) -> None: """ - Swap the top and the `item_number` element of the stack, where + Swaps the top and the `item_number` element of the stack, where the top of the stack is position zero. If `item_number` is zero, this function does nothing (which should not be diff --git a/src/ethereum/forks/amsterdam/vm/instructions/system.py b/src/ethereum/forks/amsterdam/vm/instructions/system.py index fea7a0c1b9d..44c36ae000f 100644 --- a/src/ethereum/forks/amsterdam/vm/instructions/system.py +++ b/src/ethereum/forks/amsterdam/vm/instructions/system.py @@ -193,8 +193,8 @@ def create2(evm: Evm) -> None: """ Creates a new account with associated code. - It's similar to CREATE opcode except that the address of new account - depends on the init_code instead of the nonce of sender. + It's similar to the CREATE opcode except that the address of the new + account depends on the init_code instead of the nonce of sender. Parameters ---------- diff --git a/src/ethereum/forks/amsterdam/vm/precompiled_contracts/bls12_381/bls12_381_pairing.py b/src/ethereum/forks/amsterdam/vm/precompiled_contracts/bls12_381/bls12_381_pairing.py index 6cb29a32fd9..c7a62cb49c0 100644 --- a/src/ethereum/forks/amsterdam/vm/precompiled_contracts/bls12_381/bls12_381_pairing.py +++ b/src/ethereum/forks/amsterdam/vm/precompiled_contracts/bls12_381/bls12_381_pairing.py @@ -33,7 +33,7 @@ def bls12_pairing(evm: Evm) -> None: Raises ------ InvalidParameter - If the input length is invalid or if sub-group check fails. + If the input length is invalid or if the subgroup check fails. """ data = evm.message.data @@ -54,12 +54,12 @@ def bls12_pairing(evm: Evm) -> None: g1_slice = data[g1_start : g1_start + Uint(128)] g1_point = bytes_to_g1(bytes(g1_slice)) if not is_inf(bls12_multiply(g1_point, curve_order)): - raise InvalidParameter("Sub-group check failed for G1 point.") + raise InvalidParameter("Subgroup check failed for G1 point.") g2_slice = data[g2_start : g2_start + Uint(256)] g2_point = bytes_to_g2(bytes(g2_slice)) if not is_inf(bls12_multiply(g2_point, curve_order)): - raise InvalidParameter("Sub-group check failed for G2 point.") + raise InvalidParameter("Subgroup check failed for G2 point.") result *= pairing(g2_point, g1_point) diff --git a/src/ethereum/forks/amsterdam/vm/precompiled_contracts/ecrecover.py b/src/ethereum/forks/amsterdam/vm/precompiled_contracts/ecrecover.py index d2eeaf75df1..d8f6602e556 100644 --- a/src/ethereum/forks/amsterdam/vm/precompiled_contracts/ecrecover.py +++ b/src/ethereum/forks/amsterdam/vm/precompiled_contracts/ecrecover.py @@ -8,7 +8,7 @@ Introduction ------------ -Implementation of the ECRECOVER precompiled contract. +Implementation of the `ECRECOVER` precompiled contract. """ from ethereum_types.numeric import U256 diff --git a/src/ethereum/forks/amsterdam/vm/precompiled_contracts/mapping.py b/src/ethereum/forks/amsterdam/vm/precompiled_contracts/mapping.py index a80e2b02354..7486203c3e6 100644 --- a/src/ethereum/forks/amsterdam/vm/precompiled_contracts/mapping.py +++ b/src/ethereum/forks/amsterdam/vm/precompiled_contracts/mapping.py @@ -8,7 +8,7 @@ Introduction ------------ -Mapping of precompiled contracts their implementations. +Mapping of precompiled contracts to their implementations. """ from typing import Callable, Dict diff --git a/src/ethereum/forks/amsterdam/vm/precompiled_contracts/modexp.py b/src/ethereum/forks/amsterdam/vm/precompiled_contracts/modexp.py index 5e7e895b91a..bf828ee8f6e 100644 --- a/src/ethereum/forks/amsterdam/vm/precompiled_contracts/modexp.py +++ b/src/ethereum/forks/amsterdam/vm/precompiled_contracts/modexp.py @@ -22,7 +22,7 @@ def modexp(evm: Evm) -> None: """ - Calculates `(base**exp) % modulus` for arbitrary sized `base`, `exp` and. + Calculates `(base**exp) % modulus` for arbitrary sized `base`, `exp` and `modulus`. The return value is the same length as the modulus. """ data = evm.message.data diff --git a/src/ethereum/forks/amsterdam/vm/precompiled_contracts/p256verify.py b/src/ethereum/forks/amsterdam/vm/precompiled_contracts/p256verify.py index 6f6e7ff4e9d..106dd548a61 100644 --- a/src/ethereum/forks/amsterdam/vm/precompiled_contracts/p256verify.py +++ b/src/ethereum/forks/amsterdam/vm/precompiled_contracts/p256verify.py @@ -5,9 +5,10 @@ :backlinks: none :local: -Introduction. +Introduction ------------ -Implementation of the P256VERIFY precompiled contract. + +Implementation of the `P256VERIFY` precompiled contract. """ from ethereum_types.numeric import U256 diff --git a/src/ethereum/forks/amsterdam/vm/precompiled_contracts/point_evaluation.py b/src/ethereum/forks/amsterdam/vm/precompiled_contracts/point_evaluation.py index 760af477364..ce4eed71294 100644 --- a/src/ethereum/forks/amsterdam/vm/precompiled_contracts/point_evaluation.py +++ b/src/ethereum/forks/amsterdam/vm/precompiled_contracts/point_evaluation.py @@ -8,7 +8,7 @@ Introduction ------------ -Implementation of the POINT EVALUATION precompiled contract. +Implementation of the `POINT EVALUATION` precompiled contract. """ from ethereum_types.bytes import Bytes, Bytes32, Bytes48 diff --git a/src/ethereum/forks/amsterdam/vm/runtime.py b/src/ethereum/forks/amsterdam/vm/runtime.py index 505b3488de8..0aa5ddd5e20 100644 --- a/src/ethereum/forks/amsterdam/vm/runtime.py +++ b/src/ethereum/forks/amsterdam/vm/runtime.py @@ -21,7 +21,7 @@ def get_valid_jump_destinations(code: Bytes) -> Set[Uint]: """ - Analyze the evm code to obtain the set of valid jump destinations. + Analyze the EVM code to obtain the set of valid jump destinations. Valid jump destinations are defined as follows: * The jump destination is less than the length of the code. diff --git a/src/ethereum/forks/arrow_glacier/blocks.py b/src/ethereum/forks/arrow_glacier/blocks.py index 23bc1c4bd66..497a331c0dd 100644 --- a/src/ethereum/forks/arrow_glacier/blocks.py +++ b/src/ethereum/forks/arrow_glacier/blocks.py @@ -121,7 +121,7 @@ class Header: number: Uint """ - Block number, (height) in the chain. + Block number (height) in the chain. """ gas_limit: Uint @@ -207,7 +207,7 @@ class Block: header: Header """ The block header containing metadata and cryptographic commitments. Refer - [headers] for more details on the fields included in the header. + to [headers] for more details on the fields included in the header. [headers]: ref:ethereum.forks.arrow_glacier.blocks.Header """ diff --git a/src/ethereum/forks/arrow_glacier/bloom.py b/src/ethereum/forks/arrow_glacier/bloom.py index 8a12ec081dd..0e079df6b39 100644 --- a/src/ethereum/forks/arrow_glacier/bloom.py +++ b/src/ethereum/forks/arrow_glacier/bloom.py @@ -8,7 +8,7 @@ Introduction ------------ -This modules defines functions for calculating bloom filters of logs. For the +This module defines functions for calculating bloom filters of logs. For the general theory of bloom filters see e.g. `Wikipedia `_. Bloom filters are used to allow for efficient searching of logs by address and/or topic, by rapidly diff --git a/src/ethereum/forks/arrow_glacier/state.py b/src/ethereum/forks/arrow_glacier/state.py index 5fbcf920cd2..91a0b28a1eb 100644 --- a/src/ethereum/forks/arrow_glacier/state.py +++ b/src/ethereum/forks/arrow_glacier/state.py @@ -367,7 +367,7 @@ def account_exists(state: State, address: Address) -> bool: def account_has_code_or_nonce(state: State, address: Address) -> bool: """ - Checks if an account has non zero nonce or non empty code. + Checks if an account has non-zero nonce or non-empty code. Parameters ---------- @@ -379,7 +379,7 @@ def account_has_code_or_nonce(state: State, address: Address) -> bool: Returns ------- has_code_or_nonce : `bool` - True if the account has non zero nonce or non empty code, + True if the account has non-zero nonce or non-empty code, False otherwise. """ @@ -500,7 +500,7 @@ def set_account_balance(state: State, address: Address, amount: U256) -> None: Address of the account whose nonce needs to be incremented. amount: - The amount that needs to set in balance. + The amount that needs to be set in the balance. """ @@ -520,7 +520,7 @@ def touch_account(state: State, address: Address) -> None: The current state. address: - The address of the account that need to initialised. + The address of the account that needs to be initialized. """ if not account_exists(state, address): @@ -557,7 +557,7 @@ def set_code(state: State, address: Address, code: Bytes) -> None: The current state. address: - Address of the account whose code needs to be update. + Address of the account whose code needs to be updated. code: The bytecode that needs to be set. diff --git a/src/ethereum/forks/arrow_glacier/trie.py b/src/ethereum/forks/arrow_glacier/trie.py index d81b24e6684..fce5af9482f 100644 --- a/src/ethereum/forks/arrow_glacier/trie.py +++ b/src/ethereum/forks/arrow_glacier/trie.py @@ -128,7 +128,7 @@ class BranchNode: def encode_internal_node(node: Optional[InternalNode]) -> Extended: """ Encodes a Merkle Trie node into its RLP form. The RLP will then be - serialized into a `Bytes` and hashed unless it is less that 32 bytes + serialized into a `Bytes` and hashed unless it is less than 32 bytes when serialized. This function also accepts `None`, representing the absence of a node, diff --git a/src/ethereum/forks/arrow_glacier/vm/__init__.py b/src/ethereum/forks/arrow_glacier/vm/__init__.py index 40ee422fb61..ebbb4448291 100644 --- a/src/ethereum/forks/arrow_glacier/vm/__init__.py +++ b/src/ethereum/forks/arrow_glacier/vm/__init__.py @@ -62,7 +62,7 @@ class BlockOutput: receipts_trie : `ethereum.fork_types.Root` Trie root of all the receipts in the block. receipt_keys : - Key of all the receipts in the block. + Keys of all the receipts in the block. block_logs : `Bloom` Logs bloom of all the logs included in all the transactions of the block. diff --git a/src/ethereum/forks/arrow_glacier/vm/gas.py b/src/ethereum/forks/arrow_glacier/vm/gas.py index b5c96dea850..4f2dde3b9d7 100644 --- a/src/ethereum/forks/arrow_glacier/vm/gas.py +++ b/src/ethereum/forks/arrow_glacier/vm/gas.py @@ -211,7 +211,7 @@ def calculate_message_call_gas( account inside a message call. call_stipend : The amount of stipend provided to a message call to execute code while - transferring value(ETH). + transferring value (ETH). Returns ------- diff --git a/src/ethereum/forks/arrow_glacier/vm/instructions/arithmetic.py b/src/ethereum/forks/arrow_glacier/vm/instructions/arithmetic.py index de5d6ab43d5..b7b1a370ad4 100644 --- a/src/ethereum/forks/arrow_glacier/vm/instructions/arithmetic.py +++ b/src/ethereum/forks/arrow_glacier/vm/instructions/arithmetic.py @@ -84,7 +84,7 @@ def sub(evm: Evm) -> None: def mul(evm: Evm) -> None: """ - Multiply the top two elements of the stack, and pushes the result back + Multiplies the top two elements of the stack, and pushes the result back on the stack. Parameters @@ -353,7 +353,7 @@ def signextend(evm: Evm) -> None: # Can't extend any further result = value else: - # U256(0).to_be_bytes() gives b'' instead b'\x00'. + # U256(0).to_be_bytes() gives b'' instead of b'\x00'. value_bytes = Bytes(value.to_be_bytes32()) # Now among the obtained value bytes, consider only # N `least significant bytes`, where N is `byte_num + 1`. diff --git a/src/ethereum/forks/arrow_glacier/vm/instructions/block.py b/src/ethereum/forks/arrow_glacier/vm/instructions/block.py index ecbeac10f42..bbf01739ff2 100644 --- a/src/ethereum/forks/arrow_glacier/vm/instructions/block.py +++ b/src/ethereum/forks/arrow_glacier/vm/instructions/block.py @@ -87,7 +87,7 @@ def coinbase(evm: Evm) -> None: def timestamp(evm: Evm) -> None: """ Push the current block's timestamp onto the stack. Here the timestamp - being referred is actually the unix timestamp in seconds. + being referred to is actually the unix timestamp in seconds. Here the current block refers to the block in which the currently executing transaction/call resides. diff --git a/src/ethereum/forks/arrow_glacier/vm/instructions/environment.py b/src/ethereum/forks/arrow_glacier/vm/instructions/environment.py index 1abfaeafa9c..2a7b4346619 100644 --- a/src/ethereum/forks/arrow_glacier/vm/instructions/environment.py +++ b/src/ethereum/forks/arrow_glacier/vm/instructions/environment.py @@ -423,7 +423,7 @@ def returndatasize(evm: Evm) -> None: def returndatacopy(evm: Evm) -> None: """ - Copies data from the return data buffer code to memory. + Copies data from the return data buffer to memory. Parameters ---------- diff --git a/src/ethereum/forks/arrow_glacier/vm/instructions/memory.py b/src/ethereum/forks/arrow_glacier/vm/instructions/memory.py index fdd95188438..3a242ba2f7a 100644 --- a/src/ethereum/forks/arrow_glacier/vm/instructions/memory.py +++ b/src/ethereum/forks/arrow_glacier/vm/instructions/memory.py @@ -90,7 +90,7 @@ def mstore8(evm: Evm) -> None: def mload(evm: Evm) -> None: """ - Load word from memory. + Loads a word from memory. Parameters ---------- @@ -120,7 +120,7 @@ def mload(evm: Evm) -> None: def msize(evm: Evm) -> None: """ - Push the size of active memory in bytes onto the stack. + Pushes the size of active memory in bytes onto the stack. Parameters ---------- diff --git a/src/ethereum/forks/arrow_glacier/vm/instructions/stack.py b/src/ethereum/forks/arrow_glacier/vm/instructions/stack.py index bdf232db6a8..0fc0d3fe4b5 100644 --- a/src/ethereum/forks/arrow_glacier/vm/instructions/stack.py +++ b/src/ethereum/forks/arrow_glacier/vm/instructions/stack.py @@ -23,7 +23,7 @@ def pop(evm: Evm) -> None: """ - Remove item from stack. + Removes an item from the stack. Parameters ---------- @@ -46,7 +46,7 @@ def pop(evm: Evm) -> None: def push_n(evm: Evm, num_bytes: int) -> None: """ - Pushes a N-byte immediate onto the stack. + Pushes an N-byte immediate onto the stack. Parameters ---------- @@ -76,7 +76,7 @@ def push_n(evm: Evm, num_bytes: int) -> None: def dup_n(evm: Evm, item_number: int) -> None: """ - Duplicate the Nth stack item (from top of the stack) to the top of stack. + Duplicates the Nth stack item (from top of the stack) to the top of stack. Parameters ---------- @@ -104,7 +104,7 @@ def dup_n(evm: Evm, item_number: int) -> None: def swap_n(evm: Evm, item_number: int) -> None: """ - Swap the top and the `item_number` element of the stack, where + Swaps the top and the `item_number` element of the stack, where the top of the stack is position zero. If `item_number` is zero, this function does nothing (which should not be diff --git a/src/ethereum/forks/arrow_glacier/vm/instructions/system.py b/src/ethereum/forks/arrow_glacier/vm/instructions/system.py index 2ef31f9595e..44ba77a073c 100644 --- a/src/ethereum/forks/arrow_glacier/vm/instructions/system.py +++ b/src/ethereum/forks/arrow_glacier/vm/instructions/system.py @@ -179,8 +179,8 @@ def create2(evm: Evm) -> None: """ Creates a new account with associated code. - It's similar to CREATE opcode except that the address of new account - depends on the init_code instead of the nonce of sender. + It's similar to the CREATE opcode except that the address of the new + account depends on the init_code instead of the nonce of sender. Parameters ---------- diff --git a/src/ethereum/forks/arrow_glacier/vm/precompiled_contracts/ecrecover.py b/src/ethereum/forks/arrow_glacier/vm/precompiled_contracts/ecrecover.py index d2eeaf75df1..d8f6602e556 100644 --- a/src/ethereum/forks/arrow_glacier/vm/precompiled_contracts/ecrecover.py +++ b/src/ethereum/forks/arrow_glacier/vm/precompiled_contracts/ecrecover.py @@ -8,7 +8,7 @@ Introduction ------------ -Implementation of the ECRECOVER precompiled contract. +Implementation of the `ECRECOVER` precompiled contract. """ from ethereum_types.numeric import U256 diff --git a/src/ethereum/forks/arrow_glacier/vm/precompiled_contracts/mapping.py b/src/ethereum/forks/arrow_glacier/vm/precompiled_contracts/mapping.py index 827c44cfac7..44013f70e89 100644 --- a/src/ethereum/forks/arrow_glacier/vm/precompiled_contracts/mapping.py +++ b/src/ethereum/forks/arrow_glacier/vm/precompiled_contracts/mapping.py @@ -8,7 +8,7 @@ Introduction ------------ -Mapping of precompiled contracts their implementations. +Mapping of precompiled contracts to their implementations. """ from typing import Callable, Dict diff --git a/src/ethereum/forks/arrow_glacier/vm/precompiled_contracts/modexp.py b/src/ethereum/forks/arrow_glacier/vm/precompiled_contracts/modexp.py index 462341f69fd..755a396ddac 100644 --- a/src/ethereum/forks/arrow_glacier/vm/precompiled_contracts/modexp.py +++ b/src/ethereum/forks/arrow_glacier/vm/precompiled_contracts/modexp.py @@ -23,7 +23,7 @@ def modexp(evm: Evm) -> None: """ - Calculates `(base**exp) % modulus` for arbitrary sized `base`, `exp` and. + Calculates `(base**exp) % modulus` for arbitrary sized `base`, `exp` and `modulus`. The return value is the same length as the modulus. """ data = evm.message.data diff --git a/src/ethereum/forks/arrow_glacier/vm/runtime.py b/src/ethereum/forks/arrow_glacier/vm/runtime.py index 505b3488de8..0aa5ddd5e20 100644 --- a/src/ethereum/forks/arrow_glacier/vm/runtime.py +++ b/src/ethereum/forks/arrow_glacier/vm/runtime.py @@ -21,7 +21,7 @@ def get_valid_jump_destinations(code: Bytes) -> Set[Uint]: """ - Analyze the evm code to obtain the set of valid jump destinations. + Analyze the EVM code to obtain the set of valid jump destinations. Valid jump destinations are defined as follows: * The jump destination is less than the length of the code. diff --git a/src/ethereum/forks/berlin/blocks.py b/src/ethereum/forks/berlin/blocks.py index 8f460316dae..a52af69baed 100644 --- a/src/ethereum/forks/berlin/blocks.py +++ b/src/ethereum/forks/berlin/blocks.py @@ -113,7 +113,7 @@ class Header: number: Uint """ - Block number, (height) in the chain. + Block number (height) in the chain. """ gas_limit: Uint @@ -184,7 +184,7 @@ class Block: header: Header """ The block header containing metadata and cryptographic commitments. Refer - [headers] for more details on the fields included in the header. + to [headers] for more details on the fields included in the header. [headers]: ref:ethereum.forks.berlin.blocks.Header """ diff --git a/src/ethereum/forks/berlin/bloom.py b/src/ethereum/forks/berlin/bloom.py index 8a12ec081dd..0e079df6b39 100644 --- a/src/ethereum/forks/berlin/bloom.py +++ b/src/ethereum/forks/berlin/bloom.py @@ -8,7 +8,7 @@ Introduction ------------ -This modules defines functions for calculating bloom filters of logs. For the +This module defines functions for calculating bloom filters of logs. For the general theory of bloom filters see e.g. `Wikipedia `_. Bloom filters are used to allow for efficient searching of logs by address and/or topic, by rapidly diff --git a/src/ethereum/forks/berlin/state.py b/src/ethereum/forks/berlin/state.py index 5fbcf920cd2..91a0b28a1eb 100644 --- a/src/ethereum/forks/berlin/state.py +++ b/src/ethereum/forks/berlin/state.py @@ -367,7 +367,7 @@ def account_exists(state: State, address: Address) -> bool: def account_has_code_or_nonce(state: State, address: Address) -> bool: """ - Checks if an account has non zero nonce or non empty code. + Checks if an account has non-zero nonce or non-empty code. Parameters ---------- @@ -379,7 +379,7 @@ def account_has_code_or_nonce(state: State, address: Address) -> bool: Returns ------- has_code_or_nonce : `bool` - True if the account has non zero nonce or non empty code, + True if the account has non-zero nonce or non-empty code, False otherwise. """ @@ -500,7 +500,7 @@ def set_account_balance(state: State, address: Address, amount: U256) -> None: Address of the account whose nonce needs to be incremented. amount: - The amount that needs to set in balance. + The amount that needs to be set in the balance. """ @@ -520,7 +520,7 @@ def touch_account(state: State, address: Address) -> None: The current state. address: - The address of the account that need to initialised. + The address of the account that needs to be initialized. """ if not account_exists(state, address): @@ -557,7 +557,7 @@ def set_code(state: State, address: Address, code: Bytes) -> None: The current state. address: - Address of the account whose code needs to be update. + Address of the account whose code needs to be updated. code: The bytecode that needs to be set. diff --git a/src/ethereum/forks/berlin/trie.py b/src/ethereum/forks/berlin/trie.py index a1fc5a03d6d..01e4f062098 100644 --- a/src/ethereum/forks/berlin/trie.py +++ b/src/ethereum/forks/berlin/trie.py @@ -128,7 +128,7 @@ class BranchNode: def encode_internal_node(node: Optional[InternalNode]) -> Extended: """ Encodes a Merkle Trie node into its RLP form. The RLP will then be - serialized into a `Bytes` and hashed unless it is less that 32 bytes + serialized into a `Bytes` and hashed unless it is less than 32 bytes when serialized. This function also accepts `None`, representing the absence of a node, diff --git a/src/ethereum/forks/berlin/vm/__init__.py b/src/ethereum/forks/berlin/vm/__init__.py index b1973823aff..1c6469d033d 100644 --- a/src/ethereum/forks/berlin/vm/__init__.py +++ b/src/ethereum/forks/berlin/vm/__init__.py @@ -61,7 +61,7 @@ class BlockOutput: receipts_trie : `ethereum.fork_types.Root` Trie root of all the receipts in the block. receipt_keys : - Key of all the receipts in the block. + Keys of all the receipts in the block. block_logs : `Bloom` Logs bloom of all the logs included in all the transactions of the block. diff --git a/src/ethereum/forks/berlin/vm/gas.py b/src/ethereum/forks/berlin/vm/gas.py index dcb7dfb30b5..74a186d6c44 100644 --- a/src/ethereum/forks/berlin/vm/gas.py +++ b/src/ethereum/forks/berlin/vm/gas.py @@ -212,7 +212,7 @@ def calculate_message_call_gas( account inside a message call. call_stipend : The amount of stipend provided to a message call to execute code while - transferring value(ETH). + transferring value (ETH). Returns ------- diff --git a/src/ethereum/forks/berlin/vm/instructions/arithmetic.py b/src/ethereum/forks/berlin/vm/instructions/arithmetic.py index de5d6ab43d5..b7b1a370ad4 100644 --- a/src/ethereum/forks/berlin/vm/instructions/arithmetic.py +++ b/src/ethereum/forks/berlin/vm/instructions/arithmetic.py @@ -84,7 +84,7 @@ def sub(evm: Evm) -> None: def mul(evm: Evm) -> None: """ - Multiply the top two elements of the stack, and pushes the result back + Multiplies the top two elements of the stack, and pushes the result back on the stack. Parameters @@ -353,7 +353,7 @@ def signextend(evm: Evm) -> None: # Can't extend any further result = value else: - # U256(0).to_be_bytes() gives b'' instead b'\x00'. + # U256(0).to_be_bytes() gives b'' instead of b'\x00'. value_bytes = Bytes(value.to_be_bytes32()) # Now among the obtained value bytes, consider only # N `least significant bytes`, where N is `byte_num + 1`. diff --git a/src/ethereum/forks/berlin/vm/instructions/block.py b/src/ethereum/forks/berlin/vm/instructions/block.py index ecbeac10f42..bbf01739ff2 100644 --- a/src/ethereum/forks/berlin/vm/instructions/block.py +++ b/src/ethereum/forks/berlin/vm/instructions/block.py @@ -87,7 +87,7 @@ def coinbase(evm: Evm) -> None: def timestamp(evm: Evm) -> None: """ Push the current block's timestamp onto the stack. Here the timestamp - being referred is actually the unix timestamp in seconds. + being referred to is actually the unix timestamp in seconds. Here the current block refers to the block in which the currently executing transaction/call resides. diff --git a/src/ethereum/forks/berlin/vm/instructions/environment.py b/src/ethereum/forks/berlin/vm/instructions/environment.py index 8ff0e0b2f01..7158c504e8c 100644 --- a/src/ethereum/forks/berlin/vm/instructions/environment.py +++ b/src/ethereum/forks/berlin/vm/instructions/environment.py @@ -423,7 +423,7 @@ def returndatasize(evm: Evm) -> None: def returndatacopy(evm: Evm) -> None: """ - Copies data from the return data buffer code to memory. + Copies data from the return data buffer to memory. Parameters ---------- diff --git a/src/ethereum/forks/berlin/vm/instructions/memory.py b/src/ethereum/forks/berlin/vm/instructions/memory.py index fdd95188438..3a242ba2f7a 100644 --- a/src/ethereum/forks/berlin/vm/instructions/memory.py +++ b/src/ethereum/forks/berlin/vm/instructions/memory.py @@ -90,7 +90,7 @@ def mstore8(evm: Evm) -> None: def mload(evm: Evm) -> None: """ - Load word from memory. + Loads a word from memory. Parameters ---------- @@ -120,7 +120,7 @@ def mload(evm: Evm) -> None: def msize(evm: Evm) -> None: """ - Push the size of active memory in bytes onto the stack. + Pushes the size of active memory in bytes onto the stack. Parameters ---------- diff --git a/src/ethereum/forks/berlin/vm/instructions/stack.py b/src/ethereum/forks/berlin/vm/instructions/stack.py index bdf232db6a8..0fc0d3fe4b5 100644 --- a/src/ethereum/forks/berlin/vm/instructions/stack.py +++ b/src/ethereum/forks/berlin/vm/instructions/stack.py @@ -23,7 +23,7 @@ def pop(evm: Evm) -> None: """ - Remove item from stack. + Removes an item from the stack. Parameters ---------- @@ -46,7 +46,7 @@ def pop(evm: Evm) -> None: def push_n(evm: Evm, num_bytes: int) -> None: """ - Pushes a N-byte immediate onto the stack. + Pushes an N-byte immediate onto the stack. Parameters ---------- @@ -76,7 +76,7 @@ def push_n(evm: Evm, num_bytes: int) -> None: def dup_n(evm: Evm, item_number: int) -> None: """ - Duplicate the Nth stack item (from top of the stack) to the top of stack. + Duplicates the Nth stack item (from top of the stack) to the top of stack. Parameters ---------- @@ -104,7 +104,7 @@ def dup_n(evm: Evm, item_number: int) -> None: def swap_n(evm: Evm, item_number: int) -> None: """ - Swap the top and the `item_number` element of the stack, where + Swaps the top and the `item_number` element of the stack, where the top of the stack is position zero. If `item_number` is zero, this function does nothing (which should not be diff --git a/src/ethereum/forks/berlin/vm/instructions/system.py b/src/ethereum/forks/berlin/vm/instructions/system.py index 3b915e29ce2..afd813e3fab 100644 --- a/src/ethereum/forks/berlin/vm/instructions/system.py +++ b/src/ethereum/forks/berlin/vm/instructions/system.py @@ -180,8 +180,8 @@ def create2(evm: Evm) -> None: """ Creates a new account with associated code. - It's similar to CREATE opcode except that the address of new account - depends on the init_code instead of the nonce of sender. + It's similar to the CREATE opcode except that the address of the new + account depends on the init_code instead of the nonce of sender. Parameters ---------- diff --git a/src/ethereum/forks/berlin/vm/precompiled_contracts/ecrecover.py b/src/ethereum/forks/berlin/vm/precompiled_contracts/ecrecover.py index d2eeaf75df1..d8f6602e556 100644 --- a/src/ethereum/forks/berlin/vm/precompiled_contracts/ecrecover.py +++ b/src/ethereum/forks/berlin/vm/precompiled_contracts/ecrecover.py @@ -8,7 +8,7 @@ Introduction ------------ -Implementation of the ECRECOVER precompiled contract. +Implementation of the `ECRECOVER` precompiled contract. """ from ethereum_types.numeric import U256 diff --git a/src/ethereum/forks/berlin/vm/precompiled_contracts/mapping.py b/src/ethereum/forks/berlin/vm/precompiled_contracts/mapping.py index 827c44cfac7..44013f70e89 100644 --- a/src/ethereum/forks/berlin/vm/precompiled_contracts/mapping.py +++ b/src/ethereum/forks/berlin/vm/precompiled_contracts/mapping.py @@ -8,7 +8,7 @@ Introduction ------------ -Mapping of precompiled contracts their implementations. +Mapping of precompiled contracts to their implementations. """ from typing import Callable, Dict diff --git a/src/ethereum/forks/berlin/vm/precompiled_contracts/modexp.py b/src/ethereum/forks/berlin/vm/precompiled_contracts/modexp.py index 462341f69fd..755a396ddac 100644 --- a/src/ethereum/forks/berlin/vm/precompiled_contracts/modexp.py +++ b/src/ethereum/forks/berlin/vm/precompiled_contracts/modexp.py @@ -23,7 +23,7 @@ def modexp(evm: Evm) -> None: """ - Calculates `(base**exp) % modulus` for arbitrary sized `base`, `exp` and. + Calculates `(base**exp) % modulus` for arbitrary sized `base`, `exp` and `modulus`. The return value is the same length as the modulus. """ data = evm.message.data diff --git a/src/ethereum/forks/berlin/vm/runtime.py b/src/ethereum/forks/berlin/vm/runtime.py index 505b3488de8..0aa5ddd5e20 100644 --- a/src/ethereum/forks/berlin/vm/runtime.py +++ b/src/ethereum/forks/berlin/vm/runtime.py @@ -21,7 +21,7 @@ def get_valid_jump_destinations(code: Bytes) -> Set[Uint]: """ - Analyze the evm code to obtain the set of valid jump destinations. + Analyze the EVM code to obtain the set of valid jump destinations. Valid jump destinations are defined as follows: * The jump destination is less than the length of the code. diff --git a/src/ethereum/forks/bpo1/blocks.py b/src/ethereum/forks/bpo1/blocks.py index ffa9c59a9f6..dcfe788d8a9 100644 --- a/src/ethereum/forks/bpo1/blocks.py +++ b/src/ethereum/forks/bpo1/blocks.py @@ -152,7 +152,7 @@ class Header: number: Uint """ - Block number, (height) in the chain. + Block number (height) in the chain. """ gas_limit: Uint @@ -272,7 +272,7 @@ class Block: header: Header """ The block header containing metadata and cryptographic commitments. Refer - [headers] for more details on the fields included in the header. + to [headers] for more details on the fields included in the header. [headers]: ref:ethereum.forks.bpo1.blocks.Header """ diff --git a/src/ethereum/forks/bpo1/bloom.py b/src/ethereum/forks/bpo1/bloom.py index 8a12ec081dd..0e079df6b39 100644 --- a/src/ethereum/forks/bpo1/bloom.py +++ b/src/ethereum/forks/bpo1/bloom.py @@ -8,7 +8,7 @@ Introduction ------------ -This modules defines functions for calculating bloom filters of logs. For the +This module defines functions for calculating bloom filters of logs. For the general theory of bloom filters see e.g. `Wikipedia `_. Bloom filters are used to allow for efficient searching of logs by address and/or topic, by rapidly diff --git a/src/ethereum/forks/bpo1/requests.py b/src/ethereum/forks/bpo1/requests.py index 929e973e587..542c9264d37 100644 --- a/src/ethereum/forks/bpo1/requests.py +++ b/src/ethereum/forks/bpo1/requests.py @@ -1,5 +1,5 @@ """ -Requests were introduced in EIP-7685 as a a general purpose framework for +Requests were introduced in EIP-7685 as a general purpose framework for storing contract-triggered requests. It extends the execution header and body with a single field each to store the request information. This inherently exposes the requests to the consensus layer, which can diff --git a/src/ethereum/forks/bpo1/state.py b/src/ethereum/forks/bpo1/state.py index e997411f6da..6571aa05c61 100644 --- a/src/ethereum/forks/bpo1/state.py +++ b/src/ethereum/forks/bpo1/state.py @@ -400,7 +400,7 @@ def account_exists(state: State, address: Address) -> bool: def account_has_code_or_nonce(state: State, address: Address) -> bool: """ - Checks if an account has non zero nonce or non empty code. + Checks if an account has non-zero nonce or non-empty code. Parameters ---------- @@ -412,7 +412,7 @@ def account_has_code_or_nonce(state: State, address: Address) -> bool: Returns ------- has_code_or_nonce : `bool` - True if the account has non zero nonce or non empty code, + True if the account has non-zero nonce or non-empty code, False otherwise. """ @@ -517,7 +517,7 @@ def set_account_balance(state: State, address: Address, amount: U256) -> None: Address of the account whose nonce needs to be incremented. amount: - The amount that needs to set in balance. + The amount that needs to be set in the balance. """ @@ -557,7 +557,7 @@ def set_code(state: State, address: Address, code: Bytes) -> None: The current state. address: - Address of the account whose code needs to be update. + Address of the account whose code needs to be updated. code: The bytecode that needs to be set. diff --git a/src/ethereum/forks/bpo1/trie.py b/src/ethereum/forks/bpo1/trie.py index 11a2e035ab6..3e6b5cab255 100644 --- a/src/ethereum/forks/bpo1/trie.py +++ b/src/ethereum/forks/bpo1/trie.py @@ -138,7 +138,7 @@ class BranchNode: def encode_internal_node(node: Optional[InternalNode]) -> Extended: """ Encodes a Merkle Trie node into its RLP form. The RLP will then be - serialized into a `Bytes` and hashed unless it is less that 32 bytes + serialized into a `Bytes` and hashed unless it is less than 32 bytes when serialized. This function also accepts `None`, representing the absence of a node, diff --git a/src/ethereum/forks/bpo1/vm/__init__.py b/src/ethereum/forks/bpo1/vm/__init__.py index b2a8c5e2b9f..641695ea0e7 100644 --- a/src/ethereum/forks/bpo1/vm/__init__.py +++ b/src/ethereum/forks/bpo1/vm/__init__.py @@ -63,7 +63,7 @@ class BlockOutput: receipts_trie : `ethereum.fork_types.Root` Trie root of all the receipts in the block. receipt_keys : - Key of all the receipts in the block. + Keys of all the receipts in the block. block_logs : `Bloom` Logs bloom of all the logs included in all the transactions of the block. diff --git a/src/ethereum/forks/bpo1/vm/eoa_delegation.py b/src/ethereum/forks/bpo1/vm/eoa_delegation.py index 29909b5fa56..bc96f4c3275 100644 --- a/src/ethereum/forks/bpo1/vm/eoa_delegation.py +++ b/src/ethereum/forks/bpo1/vm/eoa_delegation.py @@ -157,8 +157,6 @@ def set_delegation(message: Message) -> U256: ---------- message : Transaction specific items. - env : - External items required for EVM execution. Returns ------- diff --git a/src/ethereum/forks/bpo1/vm/gas.py b/src/ethereum/forks/bpo1/vm/gas.py index fc4c8618f50..2bf030e1901 100644 --- a/src/ethereum/forks/bpo1/vm/gas.py +++ b/src/ethereum/forks/bpo1/vm/gas.py @@ -232,7 +232,7 @@ def calculate_message_call_gas( account inside a message call. call_stipend : The amount of stipend provided to a message call to execute code while - transferring value(ETH). + transferring value (ETH). Returns ------- @@ -288,7 +288,7 @@ def init_code_cost(init_code_length: Uint) -> Uint: def calculate_excess_blob_gas(parent_header: Header) -> U64: """ - Calculated the excess blob gas for the current block based + Calculates the excess blob gas for the current block based on the gas used in the parent block. Parameters diff --git a/src/ethereum/forks/bpo1/vm/instructions/arithmetic.py b/src/ethereum/forks/bpo1/vm/instructions/arithmetic.py index de5d6ab43d5..b7b1a370ad4 100644 --- a/src/ethereum/forks/bpo1/vm/instructions/arithmetic.py +++ b/src/ethereum/forks/bpo1/vm/instructions/arithmetic.py @@ -84,7 +84,7 @@ def sub(evm: Evm) -> None: def mul(evm: Evm) -> None: """ - Multiply the top two elements of the stack, and pushes the result back + Multiplies the top two elements of the stack, and pushes the result back on the stack. Parameters @@ -353,7 +353,7 @@ def signextend(evm: Evm) -> None: # Can't extend any further result = value else: - # U256(0).to_be_bytes() gives b'' instead b'\x00'. + # U256(0).to_be_bytes() gives b'' instead of b'\x00'. value_bytes = Bytes(value.to_be_bytes32()) # Now among the obtained value bytes, consider only # N `least significant bytes`, where N is `byte_num + 1`. diff --git a/src/ethereum/forks/bpo1/vm/instructions/block.py b/src/ethereum/forks/bpo1/vm/instructions/block.py index c0520797e58..75810aacd39 100644 --- a/src/ethereum/forks/bpo1/vm/instructions/block.py +++ b/src/ethereum/forks/bpo1/vm/instructions/block.py @@ -101,7 +101,7 @@ def coinbase(evm: Evm) -> None: def timestamp(evm: Evm) -> None: """ Push the current block's timestamp onto the stack. Here the timestamp - being referred is actually the unix timestamp in seconds. + being referred to is actually the unix timestamp in seconds. Here the current block refers to the block in which the currently executing transaction/call resides. diff --git a/src/ethereum/forks/bpo1/vm/instructions/environment.py b/src/ethereum/forks/bpo1/vm/instructions/environment.py index 83690434658..28c595ee514 100644 --- a/src/ethereum/forks/bpo1/vm/instructions/environment.py +++ b/src/ethereum/forks/bpo1/vm/instructions/environment.py @@ -426,7 +426,7 @@ def returndatasize(evm: Evm) -> None: def returndatacopy(evm: Evm) -> None: """ - Copies data from the return data buffer code to memory. + Copies data from the return data buffer to memory. Parameters ---------- diff --git a/src/ethereum/forks/bpo1/vm/instructions/memory.py b/src/ethereum/forks/bpo1/vm/instructions/memory.py index 631d33a7fd6..6e111051ee3 100644 --- a/src/ethereum/forks/bpo1/vm/instructions/memory.py +++ b/src/ethereum/forks/bpo1/vm/instructions/memory.py @@ -93,7 +93,7 @@ def mstore8(evm: Evm) -> None: def mload(evm: Evm) -> None: """ - Load word from memory. + Loads a word from memory. Parameters ---------- @@ -123,7 +123,7 @@ def mload(evm: Evm) -> None: def msize(evm: Evm) -> None: """ - Push the size of active memory in bytes onto the stack. + Pushes the size of active memory in bytes onto the stack. Parameters ---------- @@ -146,7 +146,7 @@ def msize(evm: Evm) -> None: def mcopy(evm: Evm) -> None: """ - Copy the bytes in memory from one location to another. + Copies the bytes in memory from one location to another. Parameters ---------- diff --git a/src/ethereum/forks/bpo1/vm/instructions/stack.py b/src/ethereum/forks/bpo1/vm/instructions/stack.py index e381b52c370..0007a28acd4 100644 --- a/src/ethereum/forks/bpo1/vm/instructions/stack.py +++ b/src/ethereum/forks/bpo1/vm/instructions/stack.py @@ -23,7 +23,7 @@ def pop(evm: Evm) -> None: """ - Remove item from stack. + Removes an item from the stack. Parameters ---------- @@ -46,7 +46,7 @@ def pop(evm: Evm) -> None: def push_n(evm: Evm, num_bytes: int) -> None: """ - Pushes a N-byte immediate onto the stack. Push zero if num_bytes is zero. + Pushes an N-byte immediate onto the stack. Push zero if num_bytes is zero. Parameters ---------- @@ -79,7 +79,7 @@ def push_n(evm: Evm, num_bytes: int) -> None: def dup_n(evm: Evm, item_number: int) -> None: """ - Duplicate the Nth stack item (from top of the stack) to the top of stack. + Duplicates the Nth stack item (from top of the stack) to the top of stack. Parameters ---------- @@ -107,7 +107,7 @@ def dup_n(evm: Evm, item_number: int) -> None: def swap_n(evm: Evm, item_number: int) -> None: """ - Swap the top and the `item_number` element of the stack, where + Swaps the top and the `item_number` element of the stack, where the top of the stack is position zero. If `item_number` is zero, this function does nothing (which should not be diff --git a/src/ethereum/forks/bpo1/vm/instructions/system.py b/src/ethereum/forks/bpo1/vm/instructions/system.py index fea7a0c1b9d..44c36ae000f 100644 --- a/src/ethereum/forks/bpo1/vm/instructions/system.py +++ b/src/ethereum/forks/bpo1/vm/instructions/system.py @@ -193,8 +193,8 @@ def create2(evm: Evm) -> None: """ Creates a new account with associated code. - It's similar to CREATE opcode except that the address of new account - depends on the init_code instead of the nonce of sender. + It's similar to the CREATE opcode except that the address of the new + account depends on the init_code instead of the nonce of sender. Parameters ---------- diff --git a/src/ethereum/forks/bpo1/vm/precompiled_contracts/bls12_381/bls12_381_pairing.py b/src/ethereum/forks/bpo1/vm/precompiled_contracts/bls12_381/bls12_381_pairing.py index 6cb29a32fd9..c7a62cb49c0 100644 --- a/src/ethereum/forks/bpo1/vm/precompiled_contracts/bls12_381/bls12_381_pairing.py +++ b/src/ethereum/forks/bpo1/vm/precompiled_contracts/bls12_381/bls12_381_pairing.py @@ -33,7 +33,7 @@ def bls12_pairing(evm: Evm) -> None: Raises ------ InvalidParameter - If the input length is invalid or if sub-group check fails. + If the input length is invalid or if the subgroup check fails. """ data = evm.message.data @@ -54,12 +54,12 @@ def bls12_pairing(evm: Evm) -> None: g1_slice = data[g1_start : g1_start + Uint(128)] g1_point = bytes_to_g1(bytes(g1_slice)) if not is_inf(bls12_multiply(g1_point, curve_order)): - raise InvalidParameter("Sub-group check failed for G1 point.") + raise InvalidParameter("Subgroup check failed for G1 point.") g2_slice = data[g2_start : g2_start + Uint(256)] g2_point = bytes_to_g2(bytes(g2_slice)) if not is_inf(bls12_multiply(g2_point, curve_order)): - raise InvalidParameter("Sub-group check failed for G2 point.") + raise InvalidParameter("Subgroup check failed for G2 point.") result *= pairing(g2_point, g1_point) diff --git a/src/ethereum/forks/bpo1/vm/precompiled_contracts/ecrecover.py b/src/ethereum/forks/bpo1/vm/precompiled_contracts/ecrecover.py index d2eeaf75df1..d8f6602e556 100644 --- a/src/ethereum/forks/bpo1/vm/precompiled_contracts/ecrecover.py +++ b/src/ethereum/forks/bpo1/vm/precompiled_contracts/ecrecover.py @@ -8,7 +8,7 @@ Introduction ------------ -Implementation of the ECRECOVER precompiled contract. +Implementation of the `ECRECOVER` precompiled contract. """ from ethereum_types.numeric import U256 diff --git a/src/ethereum/forks/bpo1/vm/precompiled_contracts/mapping.py b/src/ethereum/forks/bpo1/vm/precompiled_contracts/mapping.py index a80e2b02354..7486203c3e6 100644 --- a/src/ethereum/forks/bpo1/vm/precompiled_contracts/mapping.py +++ b/src/ethereum/forks/bpo1/vm/precompiled_contracts/mapping.py @@ -8,7 +8,7 @@ Introduction ------------ -Mapping of precompiled contracts their implementations. +Mapping of precompiled contracts to their implementations. """ from typing import Callable, Dict diff --git a/src/ethereum/forks/bpo1/vm/precompiled_contracts/modexp.py b/src/ethereum/forks/bpo1/vm/precompiled_contracts/modexp.py index 5e7e895b91a..bf828ee8f6e 100644 --- a/src/ethereum/forks/bpo1/vm/precompiled_contracts/modexp.py +++ b/src/ethereum/forks/bpo1/vm/precompiled_contracts/modexp.py @@ -22,7 +22,7 @@ def modexp(evm: Evm) -> None: """ - Calculates `(base**exp) % modulus` for arbitrary sized `base`, `exp` and. + Calculates `(base**exp) % modulus` for arbitrary sized `base`, `exp` and `modulus`. The return value is the same length as the modulus. """ data = evm.message.data diff --git a/src/ethereum/forks/bpo1/vm/precompiled_contracts/p256verify.py b/src/ethereum/forks/bpo1/vm/precompiled_contracts/p256verify.py index 6f6e7ff4e9d..106dd548a61 100644 --- a/src/ethereum/forks/bpo1/vm/precompiled_contracts/p256verify.py +++ b/src/ethereum/forks/bpo1/vm/precompiled_contracts/p256verify.py @@ -5,9 +5,10 @@ :backlinks: none :local: -Introduction. +Introduction ------------ -Implementation of the P256VERIFY precompiled contract. + +Implementation of the `P256VERIFY` precompiled contract. """ from ethereum_types.numeric import U256 diff --git a/src/ethereum/forks/bpo1/vm/precompiled_contracts/point_evaluation.py b/src/ethereum/forks/bpo1/vm/precompiled_contracts/point_evaluation.py index 760af477364..ce4eed71294 100644 --- a/src/ethereum/forks/bpo1/vm/precompiled_contracts/point_evaluation.py +++ b/src/ethereum/forks/bpo1/vm/precompiled_contracts/point_evaluation.py @@ -8,7 +8,7 @@ Introduction ------------ -Implementation of the POINT EVALUATION precompiled contract. +Implementation of the `POINT EVALUATION` precompiled contract. """ from ethereum_types.bytes import Bytes, Bytes32, Bytes48 diff --git a/src/ethereum/forks/bpo1/vm/runtime.py b/src/ethereum/forks/bpo1/vm/runtime.py index 505b3488de8..0aa5ddd5e20 100644 --- a/src/ethereum/forks/bpo1/vm/runtime.py +++ b/src/ethereum/forks/bpo1/vm/runtime.py @@ -21,7 +21,7 @@ def get_valid_jump_destinations(code: Bytes) -> Set[Uint]: """ - Analyze the evm code to obtain the set of valid jump destinations. + Analyze the EVM code to obtain the set of valid jump destinations. Valid jump destinations are defined as follows: * The jump destination is less than the length of the code. diff --git a/src/ethereum/forks/bpo2/blocks.py b/src/ethereum/forks/bpo2/blocks.py index 2cf92987397..eb40de4eaf1 100644 --- a/src/ethereum/forks/bpo2/blocks.py +++ b/src/ethereum/forks/bpo2/blocks.py @@ -152,7 +152,7 @@ class Header: number: Uint """ - Block number, (height) in the chain. + Block number (height) in the chain. """ gas_limit: Uint @@ -272,7 +272,7 @@ class Block: header: Header """ The block header containing metadata and cryptographic commitments. Refer - [headers] for more details on the fields included in the header. + to [headers] for more details on the fields included in the header. [headers]: ref:ethereum.forks.bpo2.blocks.Header """ diff --git a/src/ethereum/forks/bpo2/bloom.py b/src/ethereum/forks/bpo2/bloom.py index 8a12ec081dd..0e079df6b39 100644 --- a/src/ethereum/forks/bpo2/bloom.py +++ b/src/ethereum/forks/bpo2/bloom.py @@ -8,7 +8,7 @@ Introduction ------------ -This modules defines functions for calculating bloom filters of logs. For the +This module defines functions for calculating bloom filters of logs. For the general theory of bloom filters see e.g. `Wikipedia `_. Bloom filters are used to allow for efficient searching of logs by address and/or topic, by rapidly diff --git a/src/ethereum/forks/bpo2/requests.py b/src/ethereum/forks/bpo2/requests.py index 929e973e587..542c9264d37 100644 --- a/src/ethereum/forks/bpo2/requests.py +++ b/src/ethereum/forks/bpo2/requests.py @@ -1,5 +1,5 @@ """ -Requests were introduced in EIP-7685 as a a general purpose framework for +Requests were introduced in EIP-7685 as a general purpose framework for storing contract-triggered requests. It extends the execution header and body with a single field each to store the request information. This inherently exposes the requests to the consensus layer, which can diff --git a/src/ethereum/forks/bpo2/state.py b/src/ethereum/forks/bpo2/state.py index e997411f6da..6571aa05c61 100644 --- a/src/ethereum/forks/bpo2/state.py +++ b/src/ethereum/forks/bpo2/state.py @@ -400,7 +400,7 @@ def account_exists(state: State, address: Address) -> bool: def account_has_code_or_nonce(state: State, address: Address) -> bool: """ - Checks if an account has non zero nonce or non empty code. + Checks if an account has non-zero nonce or non-empty code. Parameters ---------- @@ -412,7 +412,7 @@ def account_has_code_or_nonce(state: State, address: Address) -> bool: Returns ------- has_code_or_nonce : `bool` - True if the account has non zero nonce or non empty code, + True if the account has non-zero nonce or non-empty code, False otherwise. """ @@ -517,7 +517,7 @@ def set_account_balance(state: State, address: Address, amount: U256) -> None: Address of the account whose nonce needs to be incremented. amount: - The amount that needs to set in balance. + The amount that needs to be set in the balance. """ @@ -557,7 +557,7 @@ def set_code(state: State, address: Address, code: Bytes) -> None: The current state. address: - Address of the account whose code needs to be update. + Address of the account whose code needs to be updated. code: The bytecode that needs to be set. diff --git a/src/ethereum/forks/bpo2/trie.py b/src/ethereum/forks/bpo2/trie.py index ec585b0d053..314651ab9ec 100644 --- a/src/ethereum/forks/bpo2/trie.py +++ b/src/ethereum/forks/bpo2/trie.py @@ -138,7 +138,7 @@ class BranchNode: def encode_internal_node(node: Optional[InternalNode]) -> Extended: """ Encodes a Merkle Trie node into its RLP form. The RLP will then be - serialized into a `Bytes` and hashed unless it is less that 32 bytes + serialized into a `Bytes` and hashed unless it is less than 32 bytes when serialized. This function also accepts `None`, representing the absence of a node, diff --git a/src/ethereum/forks/bpo2/vm/__init__.py b/src/ethereum/forks/bpo2/vm/__init__.py index b2a8c5e2b9f..641695ea0e7 100644 --- a/src/ethereum/forks/bpo2/vm/__init__.py +++ b/src/ethereum/forks/bpo2/vm/__init__.py @@ -63,7 +63,7 @@ class BlockOutput: receipts_trie : `ethereum.fork_types.Root` Trie root of all the receipts in the block. receipt_keys : - Key of all the receipts in the block. + Keys of all the receipts in the block. block_logs : `Bloom` Logs bloom of all the logs included in all the transactions of the block. diff --git a/src/ethereum/forks/bpo2/vm/eoa_delegation.py b/src/ethereum/forks/bpo2/vm/eoa_delegation.py index 29909b5fa56..bc96f4c3275 100644 --- a/src/ethereum/forks/bpo2/vm/eoa_delegation.py +++ b/src/ethereum/forks/bpo2/vm/eoa_delegation.py @@ -157,8 +157,6 @@ def set_delegation(message: Message) -> U256: ---------- message : Transaction specific items. - env : - External items required for EVM execution. Returns ------- diff --git a/src/ethereum/forks/bpo2/vm/gas.py b/src/ethereum/forks/bpo2/vm/gas.py index 360a4430e33..aa07e7cae70 100644 --- a/src/ethereum/forks/bpo2/vm/gas.py +++ b/src/ethereum/forks/bpo2/vm/gas.py @@ -232,7 +232,7 @@ def calculate_message_call_gas( account inside a message call. call_stipend : The amount of stipend provided to a message call to execute code while - transferring value(ETH). + transferring value (ETH). Returns ------- @@ -288,7 +288,7 @@ def init_code_cost(init_code_length: Uint) -> Uint: def calculate_excess_blob_gas(parent_header: Header) -> U64: """ - Calculated the excess blob gas for the current block based + Calculates the excess blob gas for the current block based on the gas used in the parent block. Parameters diff --git a/src/ethereum/forks/bpo2/vm/instructions/arithmetic.py b/src/ethereum/forks/bpo2/vm/instructions/arithmetic.py index de5d6ab43d5..b7b1a370ad4 100644 --- a/src/ethereum/forks/bpo2/vm/instructions/arithmetic.py +++ b/src/ethereum/forks/bpo2/vm/instructions/arithmetic.py @@ -84,7 +84,7 @@ def sub(evm: Evm) -> None: def mul(evm: Evm) -> None: """ - Multiply the top two elements of the stack, and pushes the result back + Multiplies the top two elements of the stack, and pushes the result back on the stack. Parameters @@ -353,7 +353,7 @@ def signextend(evm: Evm) -> None: # Can't extend any further result = value else: - # U256(0).to_be_bytes() gives b'' instead b'\x00'. + # U256(0).to_be_bytes() gives b'' instead of b'\x00'. value_bytes = Bytes(value.to_be_bytes32()) # Now among the obtained value bytes, consider only # N `least significant bytes`, where N is `byte_num + 1`. diff --git a/src/ethereum/forks/bpo2/vm/instructions/block.py b/src/ethereum/forks/bpo2/vm/instructions/block.py index e3d73657bf9..9923433c7b6 100644 --- a/src/ethereum/forks/bpo2/vm/instructions/block.py +++ b/src/ethereum/forks/bpo2/vm/instructions/block.py @@ -101,7 +101,7 @@ def coinbase(evm: Evm) -> None: def timestamp(evm: Evm) -> None: """ Push the current block's timestamp onto the stack. Here the timestamp - being referred is actually the unix timestamp in seconds. + being referred to is actually the unix timestamp in seconds. Here the current block refers to the block in which the currently executing transaction/call resides. diff --git a/src/ethereum/forks/bpo2/vm/instructions/environment.py b/src/ethereum/forks/bpo2/vm/instructions/environment.py index 83690434658..28c595ee514 100644 --- a/src/ethereum/forks/bpo2/vm/instructions/environment.py +++ b/src/ethereum/forks/bpo2/vm/instructions/environment.py @@ -426,7 +426,7 @@ def returndatasize(evm: Evm) -> None: def returndatacopy(evm: Evm) -> None: """ - Copies data from the return data buffer code to memory. + Copies data from the return data buffer to memory. Parameters ---------- diff --git a/src/ethereum/forks/bpo2/vm/instructions/memory.py b/src/ethereum/forks/bpo2/vm/instructions/memory.py index 631d33a7fd6..6e111051ee3 100644 --- a/src/ethereum/forks/bpo2/vm/instructions/memory.py +++ b/src/ethereum/forks/bpo2/vm/instructions/memory.py @@ -93,7 +93,7 @@ def mstore8(evm: Evm) -> None: def mload(evm: Evm) -> None: """ - Load word from memory. + Loads a word from memory. Parameters ---------- @@ -123,7 +123,7 @@ def mload(evm: Evm) -> None: def msize(evm: Evm) -> None: """ - Push the size of active memory in bytes onto the stack. + Pushes the size of active memory in bytes onto the stack. Parameters ---------- @@ -146,7 +146,7 @@ def msize(evm: Evm) -> None: def mcopy(evm: Evm) -> None: """ - Copy the bytes in memory from one location to another. + Copies the bytes in memory from one location to another. Parameters ---------- diff --git a/src/ethereum/forks/bpo2/vm/instructions/stack.py b/src/ethereum/forks/bpo2/vm/instructions/stack.py index e381b52c370..0007a28acd4 100644 --- a/src/ethereum/forks/bpo2/vm/instructions/stack.py +++ b/src/ethereum/forks/bpo2/vm/instructions/stack.py @@ -23,7 +23,7 @@ def pop(evm: Evm) -> None: """ - Remove item from stack. + Removes an item from the stack. Parameters ---------- @@ -46,7 +46,7 @@ def pop(evm: Evm) -> None: def push_n(evm: Evm, num_bytes: int) -> None: """ - Pushes a N-byte immediate onto the stack. Push zero if num_bytes is zero. + Pushes an N-byte immediate onto the stack. Push zero if num_bytes is zero. Parameters ---------- @@ -79,7 +79,7 @@ def push_n(evm: Evm, num_bytes: int) -> None: def dup_n(evm: Evm, item_number: int) -> None: """ - Duplicate the Nth stack item (from top of the stack) to the top of stack. + Duplicates the Nth stack item (from top of the stack) to the top of stack. Parameters ---------- @@ -107,7 +107,7 @@ def dup_n(evm: Evm, item_number: int) -> None: def swap_n(evm: Evm, item_number: int) -> None: """ - Swap the top and the `item_number` element of the stack, where + Swaps the top and the `item_number` element of the stack, where the top of the stack is position zero. If `item_number` is zero, this function does nothing (which should not be diff --git a/src/ethereum/forks/bpo2/vm/instructions/system.py b/src/ethereum/forks/bpo2/vm/instructions/system.py index fea7a0c1b9d..44c36ae000f 100644 --- a/src/ethereum/forks/bpo2/vm/instructions/system.py +++ b/src/ethereum/forks/bpo2/vm/instructions/system.py @@ -193,8 +193,8 @@ def create2(evm: Evm) -> None: """ Creates a new account with associated code. - It's similar to CREATE opcode except that the address of new account - depends on the init_code instead of the nonce of sender. + It's similar to the CREATE opcode except that the address of the new + account depends on the init_code instead of the nonce of sender. Parameters ---------- diff --git a/src/ethereum/forks/bpo2/vm/precompiled_contracts/bls12_381/bls12_381_pairing.py b/src/ethereum/forks/bpo2/vm/precompiled_contracts/bls12_381/bls12_381_pairing.py index 6cb29a32fd9..c7a62cb49c0 100644 --- a/src/ethereum/forks/bpo2/vm/precompiled_contracts/bls12_381/bls12_381_pairing.py +++ b/src/ethereum/forks/bpo2/vm/precompiled_contracts/bls12_381/bls12_381_pairing.py @@ -33,7 +33,7 @@ def bls12_pairing(evm: Evm) -> None: Raises ------ InvalidParameter - If the input length is invalid or if sub-group check fails. + If the input length is invalid or if the subgroup check fails. """ data = evm.message.data @@ -54,12 +54,12 @@ def bls12_pairing(evm: Evm) -> None: g1_slice = data[g1_start : g1_start + Uint(128)] g1_point = bytes_to_g1(bytes(g1_slice)) if not is_inf(bls12_multiply(g1_point, curve_order)): - raise InvalidParameter("Sub-group check failed for G1 point.") + raise InvalidParameter("Subgroup check failed for G1 point.") g2_slice = data[g2_start : g2_start + Uint(256)] g2_point = bytes_to_g2(bytes(g2_slice)) if not is_inf(bls12_multiply(g2_point, curve_order)): - raise InvalidParameter("Sub-group check failed for G2 point.") + raise InvalidParameter("Subgroup check failed for G2 point.") result *= pairing(g2_point, g1_point) diff --git a/src/ethereum/forks/bpo2/vm/precompiled_contracts/ecrecover.py b/src/ethereum/forks/bpo2/vm/precompiled_contracts/ecrecover.py index d2eeaf75df1..d8f6602e556 100644 --- a/src/ethereum/forks/bpo2/vm/precompiled_contracts/ecrecover.py +++ b/src/ethereum/forks/bpo2/vm/precompiled_contracts/ecrecover.py @@ -8,7 +8,7 @@ Introduction ------------ -Implementation of the ECRECOVER precompiled contract. +Implementation of the `ECRECOVER` precompiled contract. """ from ethereum_types.numeric import U256 diff --git a/src/ethereum/forks/bpo2/vm/precompiled_contracts/mapping.py b/src/ethereum/forks/bpo2/vm/precompiled_contracts/mapping.py index a80e2b02354..7486203c3e6 100644 --- a/src/ethereum/forks/bpo2/vm/precompiled_contracts/mapping.py +++ b/src/ethereum/forks/bpo2/vm/precompiled_contracts/mapping.py @@ -8,7 +8,7 @@ Introduction ------------ -Mapping of precompiled contracts their implementations. +Mapping of precompiled contracts to their implementations. """ from typing import Callable, Dict diff --git a/src/ethereum/forks/bpo2/vm/precompiled_contracts/modexp.py b/src/ethereum/forks/bpo2/vm/precompiled_contracts/modexp.py index 5e7e895b91a..bf828ee8f6e 100644 --- a/src/ethereum/forks/bpo2/vm/precompiled_contracts/modexp.py +++ b/src/ethereum/forks/bpo2/vm/precompiled_contracts/modexp.py @@ -22,7 +22,7 @@ def modexp(evm: Evm) -> None: """ - Calculates `(base**exp) % modulus` for arbitrary sized `base`, `exp` and. + Calculates `(base**exp) % modulus` for arbitrary sized `base`, `exp` and `modulus`. The return value is the same length as the modulus. """ data = evm.message.data diff --git a/src/ethereum/forks/bpo2/vm/precompiled_contracts/p256verify.py b/src/ethereum/forks/bpo2/vm/precompiled_contracts/p256verify.py index 6f6e7ff4e9d..106dd548a61 100644 --- a/src/ethereum/forks/bpo2/vm/precompiled_contracts/p256verify.py +++ b/src/ethereum/forks/bpo2/vm/precompiled_contracts/p256verify.py @@ -5,9 +5,10 @@ :backlinks: none :local: -Introduction. +Introduction ------------ -Implementation of the P256VERIFY precompiled contract. + +Implementation of the `P256VERIFY` precompiled contract. """ from ethereum_types.numeric import U256 diff --git a/src/ethereum/forks/bpo2/vm/precompiled_contracts/point_evaluation.py b/src/ethereum/forks/bpo2/vm/precompiled_contracts/point_evaluation.py index 760af477364..ce4eed71294 100644 --- a/src/ethereum/forks/bpo2/vm/precompiled_contracts/point_evaluation.py +++ b/src/ethereum/forks/bpo2/vm/precompiled_contracts/point_evaluation.py @@ -8,7 +8,7 @@ Introduction ------------ -Implementation of the POINT EVALUATION precompiled contract. +Implementation of the `POINT EVALUATION` precompiled contract. """ from ethereum_types.bytes import Bytes, Bytes32, Bytes48 diff --git a/src/ethereum/forks/bpo2/vm/runtime.py b/src/ethereum/forks/bpo2/vm/runtime.py index 505b3488de8..0aa5ddd5e20 100644 --- a/src/ethereum/forks/bpo2/vm/runtime.py +++ b/src/ethereum/forks/bpo2/vm/runtime.py @@ -21,7 +21,7 @@ def get_valid_jump_destinations(code: Bytes) -> Set[Uint]: """ - Analyze the evm code to obtain the set of valid jump destinations. + Analyze the EVM code to obtain the set of valid jump destinations. Valid jump destinations are defined as follows: * The jump destination is less than the length of the code. diff --git a/src/ethereum/forks/bpo3/blocks.py b/src/ethereum/forks/bpo3/blocks.py index 5104960d8c4..cf2915f7ac8 100644 --- a/src/ethereum/forks/bpo3/blocks.py +++ b/src/ethereum/forks/bpo3/blocks.py @@ -152,7 +152,7 @@ class Header: number: Uint """ - Block number, (height) in the chain. + Block number (height) in the chain. """ gas_limit: Uint @@ -272,7 +272,7 @@ class Block: header: Header """ The block header containing metadata and cryptographic commitments. Refer - [headers] for more details on the fields included in the header. + to [headers] for more details on the fields included in the header. [headers]: ref:ethereum.forks.bpo3.blocks.Header """ diff --git a/src/ethereum/forks/bpo3/bloom.py b/src/ethereum/forks/bpo3/bloom.py index 8a12ec081dd..0e079df6b39 100644 --- a/src/ethereum/forks/bpo3/bloom.py +++ b/src/ethereum/forks/bpo3/bloom.py @@ -8,7 +8,7 @@ Introduction ------------ -This modules defines functions for calculating bloom filters of logs. For the +This module defines functions for calculating bloom filters of logs. For the general theory of bloom filters see e.g. `Wikipedia `_. Bloom filters are used to allow for efficient searching of logs by address and/or topic, by rapidly diff --git a/src/ethereum/forks/bpo3/requests.py b/src/ethereum/forks/bpo3/requests.py index 929e973e587..542c9264d37 100644 --- a/src/ethereum/forks/bpo3/requests.py +++ b/src/ethereum/forks/bpo3/requests.py @@ -1,5 +1,5 @@ """ -Requests were introduced in EIP-7685 as a a general purpose framework for +Requests were introduced in EIP-7685 as a general purpose framework for storing contract-triggered requests. It extends the execution header and body with a single field each to store the request information. This inherently exposes the requests to the consensus layer, which can diff --git a/src/ethereum/forks/bpo3/state.py b/src/ethereum/forks/bpo3/state.py index e997411f6da..6571aa05c61 100644 --- a/src/ethereum/forks/bpo3/state.py +++ b/src/ethereum/forks/bpo3/state.py @@ -400,7 +400,7 @@ def account_exists(state: State, address: Address) -> bool: def account_has_code_or_nonce(state: State, address: Address) -> bool: """ - Checks if an account has non zero nonce or non empty code. + Checks if an account has non-zero nonce or non-empty code. Parameters ---------- @@ -412,7 +412,7 @@ def account_has_code_or_nonce(state: State, address: Address) -> bool: Returns ------- has_code_or_nonce : `bool` - True if the account has non zero nonce or non empty code, + True if the account has non-zero nonce or non-empty code, False otherwise. """ @@ -517,7 +517,7 @@ def set_account_balance(state: State, address: Address, amount: U256) -> None: Address of the account whose nonce needs to be incremented. amount: - The amount that needs to set in balance. + The amount that needs to be set in the balance. """ @@ -557,7 +557,7 @@ def set_code(state: State, address: Address, code: Bytes) -> None: The current state. address: - Address of the account whose code needs to be update. + Address of the account whose code needs to be updated. code: The bytecode that needs to be set. diff --git a/src/ethereum/forks/bpo3/trie.py b/src/ethereum/forks/bpo3/trie.py index 30cf636ca7f..60d669de9d4 100644 --- a/src/ethereum/forks/bpo3/trie.py +++ b/src/ethereum/forks/bpo3/trie.py @@ -138,7 +138,7 @@ class BranchNode: def encode_internal_node(node: Optional[InternalNode]) -> Extended: """ Encodes a Merkle Trie node into its RLP form. The RLP will then be - serialized into a `Bytes` and hashed unless it is less that 32 bytes + serialized into a `Bytes` and hashed unless it is less than 32 bytes when serialized. This function also accepts `None`, representing the absence of a node, diff --git a/src/ethereum/forks/bpo3/vm/__init__.py b/src/ethereum/forks/bpo3/vm/__init__.py index b2a8c5e2b9f..641695ea0e7 100644 --- a/src/ethereum/forks/bpo3/vm/__init__.py +++ b/src/ethereum/forks/bpo3/vm/__init__.py @@ -63,7 +63,7 @@ class BlockOutput: receipts_trie : `ethereum.fork_types.Root` Trie root of all the receipts in the block. receipt_keys : - Key of all the receipts in the block. + Keys of all the receipts in the block. block_logs : `Bloom` Logs bloom of all the logs included in all the transactions of the block. diff --git a/src/ethereum/forks/bpo3/vm/eoa_delegation.py b/src/ethereum/forks/bpo3/vm/eoa_delegation.py index 29909b5fa56..bc96f4c3275 100644 --- a/src/ethereum/forks/bpo3/vm/eoa_delegation.py +++ b/src/ethereum/forks/bpo3/vm/eoa_delegation.py @@ -157,8 +157,6 @@ def set_delegation(message: Message) -> U256: ---------- message : Transaction specific items. - env : - External items required for EVM execution. Returns ------- diff --git a/src/ethereum/forks/bpo3/vm/gas.py b/src/ethereum/forks/bpo3/vm/gas.py index 360a4430e33..aa07e7cae70 100644 --- a/src/ethereum/forks/bpo3/vm/gas.py +++ b/src/ethereum/forks/bpo3/vm/gas.py @@ -232,7 +232,7 @@ def calculate_message_call_gas( account inside a message call. call_stipend : The amount of stipend provided to a message call to execute code while - transferring value(ETH). + transferring value (ETH). Returns ------- @@ -288,7 +288,7 @@ def init_code_cost(init_code_length: Uint) -> Uint: def calculate_excess_blob_gas(parent_header: Header) -> U64: """ - Calculated the excess blob gas for the current block based + Calculates the excess blob gas for the current block based on the gas used in the parent block. Parameters diff --git a/src/ethereum/forks/bpo3/vm/instructions/arithmetic.py b/src/ethereum/forks/bpo3/vm/instructions/arithmetic.py index de5d6ab43d5..b7b1a370ad4 100644 --- a/src/ethereum/forks/bpo3/vm/instructions/arithmetic.py +++ b/src/ethereum/forks/bpo3/vm/instructions/arithmetic.py @@ -84,7 +84,7 @@ def sub(evm: Evm) -> None: def mul(evm: Evm) -> None: """ - Multiply the top two elements of the stack, and pushes the result back + Multiplies the top two elements of the stack, and pushes the result back on the stack. Parameters @@ -353,7 +353,7 @@ def signextend(evm: Evm) -> None: # Can't extend any further result = value else: - # U256(0).to_be_bytes() gives b'' instead b'\x00'. + # U256(0).to_be_bytes() gives b'' instead of b'\x00'. value_bytes = Bytes(value.to_be_bytes32()) # Now among the obtained value bytes, consider only # N `least significant bytes`, where N is `byte_num + 1`. diff --git a/src/ethereum/forks/bpo3/vm/instructions/block.py b/src/ethereum/forks/bpo3/vm/instructions/block.py index 8a90f826cf2..10fcbdbdb57 100644 --- a/src/ethereum/forks/bpo3/vm/instructions/block.py +++ b/src/ethereum/forks/bpo3/vm/instructions/block.py @@ -101,7 +101,7 @@ def coinbase(evm: Evm) -> None: def timestamp(evm: Evm) -> None: """ Push the current block's timestamp onto the stack. Here the timestamp - being referred is actually the unix timestamp in seconds. + being referred to is actually the unix timestamp in seconds. Here the current block refers to the block in which the currently executing transaction/call resides. diff --git a/src/ethereum/forks/bpo3/vm/instructions/environment.py b/src/ethereum/forks/bpo3/vm/instructions/environment.py index 83690434658..28c595ee514 100644 --- a/src/ethereum/forks/bpo3/vm/instructions/environment.py +++ b/src/ethereum/forks/bpo3/vm/instructions/environment.py @@ -426,7 +426,7 @@ def returndatasize(evm: Evm) -> None: def returndatacopy(evm: Evm) -> None: """ - Copies data from the return data buffer code to memory. + Copies data from the return data buffer to memory. Parameters ---------- diff --git a/src/ethereum/forks/bpo3/vm/instructions/memory.py b/src/ethereum/forks/bpo3/vm/instructions/memory.py index 631d33a7fd6..6e111051ee3 100644 --- a/src/ethereum/forks/bpo3/vm/instructions/memory.py +++ b/src/ethereum/forks/bpo3/vm/instructions/memory.py @@ -93,7 +93,7 @@ def mstore8(evm: Evm) -> None: def mload(evm: Evm) -> None: """ - Load word from memory. + Loads a word from memory. Parameters ---------- @@ -123,7 +123,7 @@ def mload(evm: Evm) -> None: def msize(evm: Evm) -> None: """ - Push the size of active memory in bytes onto the stack. + Pushes the size of active memory in bytes onto the stack. Parameters ---------- @@ -146,7 +146,7 @@ def msize(evm: Evm) -> None: def mcopy(evm: Evm) -> None: """ - Copy the bytes in memory from one location to another. + Copies the bytes in memory from one location to another. Parameters ---------- diff --git a/src/ethereum/forks/bpo3/vm/instructions/stack.py b/src/ethereum/forks/bpo3/vm/instructions/stack.py index e381b52c370..0007a28acd4 100644 --- a/src/ethereum/forks/bpo3/vm/instructions/stack.py +++ b/src/ethereum/forks/bpo3/vm/instructions/stack.py @@ -23,7 +23,7 @@ def pop(evm: Evm) -> None: """ - Remove item from stack. + Removes an item from the stack. Parameters ---------- @@ -46,7 +46,7 @@ def pop(evm: Evm) -> None: def push_n(evm: Evm, num_bytes: int) -> None: """ - Pushes a N-byte immediate onto the stack. Push zero if num_bytes is zero. + Pushes an N-byte immediate onto the stack. Push zero if num_bytes is zero. Parameters ---------- @@ -79,7 +79,7 @@ def push_n(evm: Evm, num_bytes: int) -> None: def dup_n(evm: Evm, item_number: int) -> None: """ - Duplicate the Nth stack item (from top of the stack) to the top of stack. + Duplicates the Nth stack item (from top of the stack) to the top of stack. Parameters ---------- @@ -107,7 +107,7 @@ def dup_n(evm: Evm, item_number: int) -> None: def swap_n(evm: Evm, item_number: int) -> None: """ - Swap the top and the `item_number` element of the stack, where + Swaps the top and the `item_number` element of the stack, where the top of the stack is position zero. If `item_number` is zero, this function does nothing (which should not be diff --git a/src/ethereum/forks/bpo3/vm/instructions/system.py b/src/ethereum/forks/bpo3/vm/instructions/system.py index fea7a0c1b9d..44c36ae000f 100644 --- a/src/ethereum/forks/bpo3/vm/instructions/system.py +++ b/src/ethereum/forks/bpo3/vm/instructions/system.py @@ -193,8 +193,8 @@ def create2(evm: Evm) -> None: """ Creates a new account with associated code. - It's similar to CREATE opcode except that the address of new account - depends on the init_code instead of the nonce of sender. + It's similar to the CREATE opcode except that the address of the new + account depends on the init_code instead of the nonce of sender. Parameters ---------- diff --git a/src/ethereum/forks/bpo3/vm/precompiled_contracts/bls12_381/bls12_381_pairing.py b/src/ethereum/forks/bpo3/vm/precompiled_contracts/bls12_381/bls12_381_pairing.py index 6cb29a32fd9..c7a62cb49c0 100644 --- a/src/ethereum/forks/bpo3/vm/precompiled_contracts/bls12_381/bls12_381_pairing.py +++ b/src/ethereum/forks/bpo3/vm/precompiled_contracts/bls12_381/bls12_381_pairing.py @@ -33,7 +33,7 @@ def bls12_pairing(evm: Evm) -> None: Raises ------ InvalidParameter - If the input length is invalid or if sub-group check fails. + If the input length is invalid or if the subgroup check fails. """ data = evm.message.data @@ -54,12 +54,12 @@ def bls12_pairing(evm: Evm) -> None: g1_slice = data[g1_start : g1_start + Uint(128)] g1_point = bytes_to_g1(bytes(g1_slice)) if not is_inf(bls12_multiply(g1_point, curve_order)): - raise InvalidParameter("Sub-group check failed for G1 point.") + raise InvalidParameter("Subgroup check failed for G1 point.") g2_slice = data[g2_start : g2_start + Uint(256)] g2_point = bytes_to_g2(bytes(g2_slice)) if not is_inf(bls12_multiply(g2_point, curve_order)): - raise InvalidParameter("Sub-group check failed for G2 point.") + raise InvalidParameter("Subgroup check failed for G2 point.") result *= pairing(g2_point, g1_point) diff --git a/src/ethereum/forks/bpo3/vm/precompiled_contracts/ecrecover.py b/src/ethereum/forks/bpo3/vm/precompiled_contracts/ecrecover.py index d2eeaf75df1..d8f6602e556 100644 --- a/src/ethereum/forks/bpo3/vm/precompiled_contracts/ecrecover.py +++ b/src/ethereum/forks/bpo3/vm/precompiled_contracts/ecrecover.py @@ -8,7 +8,7 @@ Introduction ------------ -Implementation of the ECRECOVER precompiled contract. +Implementation of the `ECRECOVER` precompiled contract. """ from ethereum_types.numeric import U256 diff --git a/src/ethereum/forks/bpo3/vm/precompiled_contracts/mapping.py b/src/ethereum/forks/bpo3/vm/precompiled_contracts/mapping.py index a80e2b02354..7486203c3e6 100644 --- a/src/ethereum/forks/bpo3/vm/precompiled_contracts/mapping.py +++ b/src/ethereum/forks/bpo3/vm/precompiled_contracts/mapping.py @@ -8,7 +8,7 @@ Introduction ------------ -Mapping of precompiled contracts their implementations. +Mapping of precompiled contracts to their implementations. """ from typing import Callable, Dict diff --git a/src/ethereum/forks/bpo3/vm/precompiled_contracts/modexp.py b/src/ethereum/forks/bpo3/vm/precompiled_contracts/modexp.py index 5e7e895b91a..bf828ee8f6e 100644 --- a/src/ethereum/forks/bpo3/vm/precompiled_contracts/modexp.py +++ b/src/ethereum/forks/bpo3/vm/precompiled_contracts/modexp.py @@ -22,7 +22,7 @@ def modexp(evm: Evm) -> None: """ - Calculates `(base**exp) % modulus` for arbitrary sized `base`, `exp` and. + Calculates `(base**exp) % modulus` for arbitrary sized `base`, `exp` and `modulus`. The return value is the same length as the modulus. """ data = evm.message.data diff --git a/src/ethereum/forks/bpo3/vm/precompiled_contracts/p256verify.py b/src/ethereum/forks/bpo3/vm/precompiled_contracts/p256verify.py index 6f6e7ff4e9d..106dd548a61 100644 --- a/src/ethereum/forks/bpo3/vm/precompiled_contracts/p256verify.py +++ b/src/ethereum/forks/bpo3/vm/precompiled_contracts/p256verify.py @@ -5,9 +5,10 @@ :backlinks: none :local: -Introduction. +Introduction ------------ -Implementation of the P256VERIFY precompiled contract. + +Implementation of the `P256VERIFY` precompiled contract. """ from ethereum_types.numeric import U256 diff --git a/src/ethereum/forks/bpo3/vm/precompiled_contracts/point_evaluation.py b/src/ethereum/forks/bpo3/vm/precompiled_contracts/point_evaluation.py index 760af477364..ce4eed71294 100644 --- a/src/ethereum/forks/bpo3/vm/precompiled_contracts/point_evaluation.py +++ b/src/ethereum/forks/bpo3/vm/precompiled_contracts/point_evaluation.py @@ -8,7 +8,7 @@ Introduction ------------ -Implementation of the POINT EVALUATION precompiled contract. +Implementation of the `POINT EVALUATION` precompiled contract. """ from ethereum_types.bytes import Bytes, Bytes32, Bytes48 diff --git a/src/ethereum/forks/bpo3/vm/runtime.py b/src/ethereum/forks/bpo3/vm/runtime.py index 505b3488de8..0aa5ddd5e20 100644 --- a/src/ethereum/forks/bpo3/vm/runtime.py +++ b/src/ethereum/forks/bpo3/vm/runtime.py @@ -21,7 +21,7 @@ def get_valid_jump_destinations(code: Bytes) -> Set[Uint]: """ - Analyze the evm code to obtain the set of valid jump destinations. + Analyze the EVM code to obtain the set of valid jump destinations. Valid jump destinations are defined as follows: * The jump destination is less than the length of the code. diff --git a/src/ethereum/forks/bpo4/blocks.py b/src/ethereum/forks/bpo4/blocks.py index e63e283b003..735bda3f392 100644 --- a/src/ethereum/forks/bpo4/blocks.py +++ b/src/ethereum/forks/bpo4/blocks.py @@ -152,7 +152,7 @@ class Header: number: Uint """ - Block number, (height) in the chain. + Block number (height) in the chain. """ gas_limit: Uint @@ -272,7 +272,7 @@ class Block: header: Header """ The block header containing metadata and cryptographic commitments. Refer - [headers] for more details on the fields included in the header. + to [headers] for more details on the fields included in the header. [headers]: ref:ethereum.forks.bpo4.blocks.Header """ diff --git a/src/ethereum/forks/bpo4/bloom.py b/src/ethereum/forks/bpo4/bloom.py index 8a12ec081dd..0e079df6b39 100644 --- a/src/ethereum/forks/bpo4/bloom.py +++ b/src/ethereum/forks/bpo4/bloom.py @@ -8,7 +8,7 @@ Introduction ------------ -This modules defines functions for calculating bloom filters of logs. For the +This module defines functions for calculating bloom filters of logs. For the general theory of bloom filters see e.g. `Wikipedia `_. Bloom filters are used to allow for efficient searching of logs by address and/or topic, by rapidly diff --git a/src/ethereum/forks/bpo4/requests.py b/src/ethereum/forks/bpo4/requests.py index 929e973e587..542c9264d37 100644 --- a/src/ethereum/forks/bpo4/requests.py +++ b/src/ethereum/forks/bpo4/requests.py @@ -1,5 +1,5 @@ """ -Requests were introduced in EIP-7685 as a a general purpose framework for +Requests were introduced in EIP-7685 as a general purpose framework for storing contract-triggered requests. It extends the execution header and body with a single field each to store the request information. This inherently exposes the requests to the consensus layer, which can diff --git a/src/ethereum/forks/bpo4/state.py b/src/ethereum/forks/bpo4/state.py index e997411f6da..6571aa05c61 100644 --- a/src/ethereum/forks/bpo4/state.py +++ b/src/ethereum/forks/bpo4/state.py @@ -400,7 +400,7 @@ def account_exists(state: State, address: Address) -> bool: def account_has_code_or_nonce(state: State, address: Address) -> bool: """ - Checks if an account has non zero nonce or non empty code. + Checks if an account has non-zero nonce or non-empty code. Parameters ---------- @@ -412,7 +412,7 @@ def account_has_code_or_nonce(state: State, address: Address) -> bool: Returns ------- has_code_or_nonce : `bool` - True if the account has non zero nonce or non empty code, + True if the account has non-zero nonce or non-empty code, False otherwise. """ @@ -517,7 +517,7 @@ def set_account_balance(state: State, address: Address, amount: U256) -> None: Address of the account whose nonce needs to be incremented. amount: - The amount that needs to set in balance. + The amount that needs to be set in the balance. """ @@ -557,7 +557,7 @@ def set_code(state: State, address: Address, code: Bytes) -> None: The current state. address: - Address of the account whose code needs to be update. + Address of the account whose code needs to be updated. code: The bytecode that needs to be set. diff --git a/src/ethereum/forks/bpo4/trie.py b/src/ethereum/forks/bpo4/trie.py index 59fc45a739b..e25acebe5c5 100644 --- a/src/ethereum/forks/bpo4/trie.py +++ b/src/ethereum/forks/bpo4/trie.py @@ -138,7 +138,7 @@ class BranchNode: def encode_internal_node(node: Optional[InternalNode]) -> Extended: """ Encodes a Merkle Trie node into its RLP form. The RLP will then be - serialized into a `Bytes` and hashed unless it is less that 32 bytes + serialized into a `Bytes` and hashed unless it is less than 32 bytes when serialized. This function also accepts `None`, representing the absence of a node, diff --git a/src/ethereum/forks/bpo4/vm/__init__.py b/src/ethereum/forks/bpo4/vm/__init__.py index b2a8c5e2b9f..641695ea0e7 100644 --- a/src/ethereum/forks/bpo4/vm/__init__.py +++ b/src/ethereum/forks/bpo4/vm/__init__.py @@ -63,7 +63,7 @@ class BlockOutput: receipts_trie : `ethereum.fork_types.Root` Trie root of all the receipts in the block. receipt_keys : - Key of all the receipts in the block. + Keys of all the receipts in the block. block_logs : `Bloom` Logs bloom of all the logs included in all the transactions of the block. diff --git a/src/ethereum/forks/bpo4/vm/eoa_delegation.py b/src/ethereum/forks/bpo4/vm/eoa_delegation.py index 29909b5fa56..bc96f4c3275 100644 --- a/src/ethereum/forks/bpo4/vm/eoa_delegation.py +++ b/src/ethereum/forks/bpo4/vm/eoa_delegation.py @@ -157,8 +157,6 @@ def set_delegation(message: Message) -> U256: ---------- message : Transaction specific items. - env : - External items required for EVM execution. Returns ------- diff --git a/src/ethereum/forks/bpo4/vm/gas.py b/src/ethereum/forks/bpo4/vm/gas.py index 360a4430e33..aa07e7cae70 100644 --- a/src/ethereum/forks/bpo4/vm/gas.py +++ b/src/ethereum/forks/bpo4/vm/gas.py @@ -232,7 +232,7 @@ def calculate_message_call_gas( account inside a message call. call_stipend : The amount of stipend provided to a message call to execute code while - transferring value(ETH). + transferring value (ETH). Returns ------- @@ -288,7 +288,7 @@ def init_code_cost(init_code_length: Uint) -> Uint: def calculate_excess_blob_gas(parent_header: Header) -> U64: """ - Calculated the excess blob gas for the current block based + Calculates the excess blob gas for the current block based on the gas used in the parent block. Parameters diff --git a/src/ethereum/forks/bpo4/vm/instructions/arithmetic.py b/src/ethereum/forks/bpo4/vm/instructions/arithmetic.py index de5d6ab43d5..b7b1a370ad4 100644 --- a/src/ethereum/forks/bpo4/vm/instructions/arithmetic.py +++ b/src/ethereum/forks/bpo4/vm/instructions/arithmetic.py @@ -84,7 +84,7 @@ def sub(evm: Evm) -> None: def mul(evm: Evm) -> None: """ - Multiply the top two elements of the stack, and pushes the result back + Multiplies the top two elements of the stack, and pushes the result back on the stack. Parameters @@ -353,7 +353,7 @@ def signextend(evm: Evm) -> None: # Can't extend any further result = value else: - # U256(0).to_be_bytes() gives b'' instead b'\x00'. + # U256(0).to_be_bytes() gives b'' instead of b'\x00'. value_bytes = Bytes(value.to_be_bytes32()) # Now among the obtained value bytes, consider only # N `least significant bytes`, where N is `byte_num + 1`. diff --git a/src/ethereum/forks/bpo4/vm/instructions/block.py b/src/ethereum/forks/bpo4/vm/instructions/block.py index 221082f23e0..52145aa9f82 100644 --- a/src/ethereum/forks/bpo4/vm/instructions/block.py +++ b/src/ethereum/forks/bpo4/vm/instructions/block.py @@ -101,7 +101,7 @@ def coinbase(evm: Evm) -> None: def timestamp(evm: Evm) -> None: """ Push the current block's timestamp onto the stack. Here the timestamp - being referred is actually the unix timestamp in seconds. + being referred to is actually the unix timestamp in seconds. Here the current block refers to the block in which the currently executing transaction/call resides. diff --git a/src/ethereum/forks/bpo4/vm/instructions/environment.py b/src/ethereum/forks/bpo4/vm/instructions/environment.py index 83690434658..28c595ee514 100644 --- a/src/ethereum/forks/bpo4/vm/instructions/environment.py +++ b/src/ethereum/forks/bpo4/vm/instructions/environment.py @@ -426,7 +426,7 @@ def returndatasize(evm: Evm) -> None: def returndatacopy(evm: Evm) -> None: """ - Copies data from the return data buffer code to memory. + Copies data from the return data buffer to memory. Parameters ---------- diff --git a/src/ethereum/forks/bpo4/vm/instructions/memory.py b/src/ethereum/forks/bpo4/vm/instructions/memory.py index 631d33a7fd6..6e111051ee3 100644 --- a/src/ethereum/forks/bpo4/vm/instructions/memory.py +++ b/src/ethereum/forks/bpo4/vm/instructions/memory.py @@ -93,7 +93,7 @@ def mstore8(evm: Evm) -> None: def mload(evm: Evm) -> None: """ - Load word from memory. + Loads a word from memory. Parameters ---------- @@ -123,7 +123,7 @@ def mload(evm: Evm) -> None: def msize(evm: Evm) -> None: """ - Push the size of active memory in bytes onto the stack. + Pushes the size of active memory in bytes onto the stack. Parameters ---------- @@ -146,7 +146,7 @@ def msize(evm: Evm) -> None: def mcopy(evm: Evm) -> None: """ - Copy the bytes in memory from one location to another. + Copies the bytes in memory from one location to another. Parameters ---------- diff --git a/src/ethereum/forks/bpo4/vm/instructions/stack.py b/src/ethereum/forks/bpo4/vm/instructions/stack.py index e381b52c370..0007a28acd4 100644 --- a/src/ethereum/forks/bpo4/vm/instructions/stack.py +++ b/src/ethereum/forks/bpo4/vm/instructions/stack.py @@ -23,7 +23,7 @@ def pop(evm: Evm) -> None: """ - Remove item from stack. + Removes an item from the stack. Parameters ---------- @@ -46,7 +46,7 @@ def pop(evm: Evm) -> None: def push_n(evm: Evm, num_bytes: int) -> None: """ - Pushes a N-byte immediate onto the stack. Push zero if num_bytes is zero. + Pushes an N-byte immediate onto the stack. Push zero if num_bytes is zero. Parameters ---------- @@ -79,7 +79,7 @@ def push_n(evm: Evm, num_bytes: int) -> None: def dup_n(evm: Evm, item_number: int) -> None: """ - Duplicate the Nth stack item (from top of the stack) to the top of stack. + Duplicates the Nth stack item (from top of the stack) to the top of stack. Parameters ---------- @@ -107,7 +107,7 @@ def dup_n(evm: Evm, item_number: int) -> None: def swap_n(evm: Evm, item_number: int) -> None: """ - Swap the top and the `item_number` element of the stack, where + Swaps the top and the `item_number` element of the stack, where the top of the stack is position zero. If `item_number` is zero, this function does nothing (which should not be diff --git a/src/ethereum/forks/bpo4/vm/instructions/system.py b/src/ethereum/forks/bpo4/vm/instructions/system.py index fea7a0c1b9d..44c36ae000f 100644 --- a/src/ethereum/forks/bpo4/vm/instructions/system.py +++ b/src/ethereum/forks/bpo4/vm/instructions/system.py @@ -193,8 +193,8 @@ def create2(evm: Evm) -> None: """ Creates a new account with associated code. - It's similar to CREATE opcode except that the address of new account - depends on the init_code instead of the nonce of sender. + It's similar to the CREATE opcode except that the address of the new + account depends on the init_code instead of the nonce of sender. Parameters ---------- diff --git a/src/ethereum/forks/bpo4/vm/precompiled_contracts/bls12_381/bls12_381_pairing.py b/src/ethereum/forks/bpo4/vm/precompiled_contracts/bls12_381/bls12_381_pairing.py index 6cb29a32fd9..c7a62cb49c0 100644 --- a/src/ethereum/forks/bpo4/vm/precompiled_contracts/bls12_381/bls12_381_pairing.py +++ b/src/ethereum/forks/bpo4/vm/precompiled_contracts/bls12_381/bls12_381_pairing.py @@ -33,7 +33,7 @@ def bls12_pairing(evm: Evm) -> None: Raises ------ InvalidParameter - If the input length is invalid or if sub-group check fails. + If the input length is invalid or if the subgroup check fails. """ data = evm.message.data @@ -54,12 +54,12 @@ def bls12_pairing(evm: Evm) -> None: g1_slice = data[g1_start : g1_start + Uint(128)] g1_point = bytes_to_g1(bytes(g1_slice)) if not is_inf(bls12_multiply(g1_point, curve_order)): - raise InvalidParameter("Sub-group check failed for G1 point.") + raise InvalidParameter("Subgroup check failed for G1 point.") g2_slice = data[g2_start : g2_start + Uint(256)] g2_point = bytes_to_g2(bytes(g2_slice)) if not is_inf(bls12_multiply(g2_point, curve_order)): - raise InvalidParameter("Sub-group check failed for G2 point.") + raise InvalidParameter("Subgroup check failed for G2 point.") result *= pairing(g2_point, g1_point) diff --git a/src/ethereum/forks/bpo4/vm/precompiled_contracts/ecrecover.py b/src/ethereum/forks/bpo4/vm/precompiled_contracts/ecrecover.py index d2eeaf75df1..d8f6602e556 100644 --- a/src/ethereum/forks/bpo4/vm/precompiled_contracts/ecrecover.py +++ b/src/ethereum/forks/bpo4/vm/precompiled_contracts/ecrecover.py @@ -8,7 +8,7 @@ Introduction ------------ -Implementation of the ECRECOVER precompiled contract. +Implementation of the `ECRECOVER` precompiled contract. """ from ethereum_types.numeric import U256 diff --git a/src/ethereum/forks/bpo4/vm/precompiled_contracts/mapping.py b/src/ethereum/forks/bpo4/vm/precompiled_contracts/mapping.py index a80e2b02354..7486203c3e6 100644 --- a/src/ethereum/forks/bpo4/vm/precompiled_contracts/mapping.py +++ b/src/ethereum/forks/bpo4/vm/precompiled_contracts/mapping.py @@ -8,7 +8,7 @@ Introduction ------------ -Mapping of precompiled contracts their implementations. +Mapping of precompiled contracts to their implementations. """ from typing import Callable, Dict diff --git a/src/ethereum/forks/bpo4/vm/precompiled_contracts/modexp.py b/src/ethereum/forks/bpo4/vm/precompiled_contracts/modexp.py index 5e7e895b91a..bf828ee8f6e 100644 --- a/src/ethereum/forks/bpo4/vm/precompiled_contracts/modexp.py +++ b/src/ethereum/forks/bpo4/vm/precompiled_contracts/modexp.py @@ -22,7 +22,7 @@ def modexp(evm: Evm) -> None: """ - Calculates `(base**exp) % modulus` for arbitrary sized `base`, `exp` and. + Calculates `(base**exp) % modulus` for arbitrary sized `base`, `exp` and `modulus`. The return value is the same length as the modulus. """ data = evm.message.data diff --git a/src/ethereum/forks/bpo4/vm/precompiled_contracts/p256verify.py b/src/ethereum/forks/bpo4/vm/precompiled_contracts/p256verify.py index 6f6e7ff4e9d..106dd548a61 100644 --- a/src/ethereum/forks/bpo4/vm/precompiled_contracts/p256verify.py +++ b/src/ethereum/forks/bpo4/vm/precompiled_contracts/p256verify.py @@ -5,9 +5,10 @@ :backlinks: none :local: -Introduction. +Introduction ------------ -Implementation of the P256VERIFY precompiled contract. + +Implementation of the `P256VERIFY` precompiled contract. """ from ethereum_types.numeric import U256 diff --git a/src/ethereum/forks/bpo4/vm/precompiled_contracts/point_evaluation.py b/src/ethereum/forks/bpo4/vm/precompiled_contracts/point_evaluation.py index 760af477364..ce4eed71294 100644 --- a/src/ethereum/forks/bpo4/vm/precompiled_contracts/point_evaluation.py +++ b/src/ethereum/forks/bpo4/vm/precompiled_contracts/point_evaluation.py @@ -8,7 +8,7 @@ Introduction ------------ -Implementation of the POINT EVALUATION precompiled contract. +Implementation of the `POINT EVALUATION` precompiled contract. """ from ethereum_types.bytes import Bytes, Bytes32, Bytes48 diff --git a/src/ethereum/forks/bpo4/vm/runtime.py b/src/ethereum/forks/bpo4/vm/runtime.py index 505b3488de8..0aa5ddd5e20 100644 --- a/src/ethereum/forks/bpo4/vm/runtime.py +++ b/src/ethereum/forks/bpo4/vm/runtime.py @@ -21,7 +21,7 @@ def get_valid_jump_destinations(code: Bytes) -> Set[Uint]: """ - Analyze the evm code to obtain the set of valid jump destinations. + Analyze the EVM code to obtain the set of valid jump destinations. Valid jump destinations are defined as follows: * The jump destination is less than the length of the code. diff --git a/src/ethereum/forks/bpo5/__init__.py b/src/ethereum/forks/bpo5/__init__.py index 19bb26e43ce..1ef794837da 100644 --- a/src/ethereum/forks/bpo5/__init__.py +++ b/src/ethereum/forks/bpo5/__init__.py @@ -1,5 +1,5 @@ """ -The fifth blob parameter only (BPO) fork, BPO3, includes only changes to the +The fifth blob parameter only (BPO) fork, BPO5, includes only changes to the blob fee schedule. ### Changes diff --git a/src/ethereum/forks/bpo5/blocks.py b/src/ethereum/forks/bpo5/blocks.py index 68c71355194..3bd791f1b88 100644 --- a/src/ethereum/forks/bpo5/blocks.py +++ b/src/ethereum/forks/bpo5/blocks.py @@ -152,7 +152,7 @@ class Header: number: Uint """ - Block number, (height) in the chain. + Block number (height) in the chain. """ gas_limit: Uint @@ -272,7 +272,7 @@ class Block: header: Header """ The block header containing metadata and cryptographic commitments. Refer - [headers] for more details on the fields included in the header. + to [headers] for more details on the fields included in the header. [headers]: ref:ethereum.forks.bpo5.blocks.Header """ diff --git a/src/ethereum/forks/bpo5/bloom.py b/src/ethereum/forks/bpo5/bloom.py index 8a12ec081dd..0e079df6b39 100644 --- a/src/ethereum/forks/bpo5/bloom.py +++ b/src/ethereum/forks/bpo5/bloom.py @@ -8,7 +8,7 @@ Introduction ------------ -This modules defines functions for calculating bloom filters of logs. For the +This module defines functions for calculating bloom filters of logs. For the general theory of bloom filters see e.g. `Wikipedia `_. Bloom filters are used to allow for efficient searching of logs by address and/or topic, by rapidly diff --git a/src/ethereum/forks/bpo5/requests.py b/src/ethereum/forks/bpo5/requests.py index 929e973e587..542c9264d37 100644 --- a/src/ethereum/forks/bpo5/requests.py +++ b/src/ethereum/forks/bpo5/requests.py @@ -1,5 +1,5 @@ """ -Requests were introduced in EIP-7685 as a a general purpose framework for +Requests were introduced in EIP-7685 as a general purpose framework for storing contract-triggered requests. It extends the execution header and body with a single field each to store the request information. This inherently exposes the requests to the consensus layer, which can diff --git a/src/ethereum/forks/bpo5/state.py b/src/ethereum/forks/bpo5/state.py index e997411f6da..6571aa05c61 100644 --- a/src/ethereum/forks/bpo5/state.py +++ b/src/ethereum/forks/bpo5/state.py @@ -400,7 +400,7 @@ def account_exists(state: State, address: Address) -> bool: def account_has_code_or_nonce(state: State, address: Address) -> bool: """ - Checks if an account has non zero nonce or non empty code. + Checks if an account has non-zero nonce or non-empty code. Parameters ---------- @@ -412,7 +412,7 @@ def account_has_code_or_nonce(state: State, address: Address) -> bool: Returns ------- has_code_or_nonce : `bool` - True if the account has non zero nonce or non empty code, + True if the account has non-zero nonce or non-empty code, False otherwise. """ @@ -517,7 +517,7 @@ def set_account_balance(state: State, address: Address, amount: U256) -> None: Address of the account whose nonce needs to be incremented. amount: - The amount that needs to set in balance. + The amount that needs to be set in the balance. """ @@ -557,7 +557,7 @@ def set_code(state: State, address: Address, code: Bytes) -> None: The current state. address: - Address of the account whose code needs to be update. + Address of the account whose code needs to be updated. code: The bytecode that needs to be set. diff --git a/src/ethereum/forks/bpo5/trie.py b/src/ethereum/forks/bpo5/trie.py index 1f32f8db3ee..a024b3433b9 100644 --- a/src/ethereum/forks/bpo5/trie.py +++ b/src/ethereum/forks/bpo5/trie.py @@ -138,7 +138,7 @@ class BranchNode: def encode_internal_node(node: Optional[InternalNode]) -> Extended: """ Encodes a Merkle Trie node into its RLP form. The RLP will then be - serialized into a `Bytes` and hashed unless it is less that 32 bytes + serialized into a `Bytes` and hashed unless it is less than 32 bytes when serialized. This function also accepts `None`, representing the absence of a node, diff --git a/src/ethereum/forks/bpo5/vm/__init__.py b/src/ethereum/forks/bpo5/vm/__init__.py index b2a8c5e2b9f..641695ea0e7 100644 --- a/src/ethereum/forks/bpo5/vm/__init__.py +++ b/src/ethereum/forks/bpo5/vm/__init__.py @@ -63,7 +63,7 @@ class BlockOutput: receipts_trie : `ethereum.fork_types.Root` Trie root of all the receipts in the block. receipt_keys : - Key of all the receipts in the block. + Keys of all the receipts in the block. block_logs : `Bloom` Logs bloom of all the logs included in all the transactions of the block. diff --git a/src/ethereum/forks/bpo5/vm/eoa_delegation.py b/src/ethereum/forks/bpo5/vm/eoa_delegation.py index 29909b5fa56..bc96f4c3275 100644 --- a/src/ethereum/forks/bpo5/vm/eoa_delegation.py +++ b/src/ethereum/forks/bpo5/vm/eoa_delegation.py @@ -157,8 +157,6 @@ def set_delegation(message: Message) -> U256: ---------- message : Transaction specific items. - env : - External items required for EVM execution. Returns ------- diff --git a/src/ethereum/forks/bpo5/vm/gas.py b/src/ethereum/forks/bpo5/vm/gas.py index 360a4430e33..aa07e7cae70 100644 --- a/src/ethereum/forks/bpo5/vm/gas.py +++ b/src/ethereum/forks/bpo5/vm/gas.py @@ -232,7 +232,7 @@ def calculate_message_call_gas( account inside a message call. call_stipend : The amount of stipend provided to a message call to execute code while - transferring value(ETH). + transferring value (ETH). Returns ------- @@ -288,7 +288,7 @@ def init_code_cost(init_code_length: Uint) -> Uint: def calculate_excess_blob_gas(parent_header: Header) -> U64: """ - Calculated the excess blob gas for the current block based + Calculates the excess blob gas for the current block based on the gas used in the parent block. Parameters diff --git a/src/ethereum/forks/bpo5/vm/instructions/arithmetic.py b/src/ethereum/forks/bpo5/vm/instructions/arithmetic.py index de5d6ab43d5..b7b1a370ad4 100644 --- a/src/ethereum/forks/bpo5/vm/instructions/arithmetic.py +++ b/src/ethereum/forks/bpo5/vm/instructions/arithmetic.py @@ -84,7 +84,7 @@ def sub(evm: Evm) -> None: def mul(evm: Evm) -> None: """ - Multiply the top two elements of the stack, and pushes the result back + Multiplies the top two elements of the stack, and pushes the result back on the stack. Parameters @@ -353,7 +353,7 @@ def signextend(evm: Evm) -> None: # Can't extend any further result = value else: - # U256(0).to_be_bytes() gives b'' instead b'\x00'. + # U256(0).to_be_bytes() gives b'' instead of b'\x00'. value_bytes = Bytes(value.to_be_bytes32()) # Now among the obtained value bytes, consider only # N `least significant bytes`, where N is `byte_num + 1`. diff --git a/src/ethereum/forks/bpo5/vm/instructions/block.py b/src/ethereum/forks/bpo5/vm/instructions/block.py index 2712e06ea33..84930244d4c 100644 --- a/src/ethereum/forks/bpo5/vm/instructions/block.py +++ b/src/ethereum/forks/bpo5/vm/instructions/block.py @@ -101,7 +101,7 @@ def coinbase(evm: Evm) -> None: def timestamp(evm: Evm) -> None: """ Push the current block's timestamp onto the stack. Here the timestamp - being referred is actually the unix timestamp in seconds. + being referred to is actually the unix timestamp in seconds. Here the current block refers to the block in which the currently executing transaction/call resides. diff --git a/src/ethereum/forks/bpo5/vm/instructions/environment.py b/src/ethereum/forks/bpo5/vm/instructions/environment.py index 83690434658..28c595ee514 100644 --- a/src/ethereum/forks/bpo5/vm/instructions/environment.py +++ b/src/ethereum/forks/bpo5/vm/instructions/environment.py @@ -426,7 +426,7 @@ def returndatasize(evm: Evm) -> None: def returndatacopy(evm: Evm) -> None: """ - Copies data from the return data buffer code to memory. + Copies data from the return data buffer to memory. Parameters ---------- diff --git a/src/ethereum/forks/bpo5/vm/instructions/memory.py b/src/ethereum/forks/bpo5/vm/instructions/memory.py index 631d33a7fd6..6e111051ee3 100644 --- a/src/ethereum/forks/bpo5/vm/instructions/memory.py +++ b/src/ethereum/forks/bpo5/vm/instructions/memory.py @@ -93,7 +93,7 @@ def mstore8(evm: Evm) -> None: def mload(evm: Evm) -> None: """ - Load word from memory. + Loads a word from memory. Parameters ---------- @@ -123,7 +123,7 @@ def mload(evm: Evm) -> None: def msize(evm: Evm) -> None: """ - Push the size of active memory in bytes onto the stack. + Pushes the size of active memory in bytes onto the stack. Parameters ---------- @@ -146,7 +146,7 @@ def msize(evm: Evm) -> None: def mcopy(evm: Evm) -> None: """ - Copy the bytes in memory from one location to another. + Copies the bytes in memory from one location to another. Parameters ---------- diff --git a/src/ethereum/forks/bpo5/vm/instructions/stack.py b/src/ethereum/forks/bpo5/vm/instructions/stack.py index e381b52c370..0007a28acd4 100644 --- a/src/ethereum/forks/bpo5/vm/instructions/stack.py +++ b/src/ethereum/forks/bpo5/vm/instructions/stack.py @@ -23,7 +23,7 @@ def pop(evm: Evm) -> None: """ - Remove item from stack. + Removes an item from the stack. Parameters ---------- @@ -46,7 +46,7 @@ def pop(evm: Evm) -> None: def push_n(evm: Evm, num_bytes: int) -> None: """ - Pushes a N-byte immediate onto the stack. Push zero if num_bytes is zero. + Pushes an N-byte immediate onto the stack. Push zero if num_bytes is zero. Parameters ---------- @@ -79,7 +79,7 @@ def push_n(evm: Evm, num_bytes: int) -> None: def dup_n(evm: Evm, item_number: int) -> None: """ - Duplicate the Nth stack item (from top of the stack) to the top of stack. + Duplicates the Nth stack item (from top of the stack) to the top of stack. Parameters ---------- @@ -107,7 +107,7 @@ def dup_n(evm: Evm, item_number: int) -> None: def swap_n(evm: Evm, item_number: int) -> None: """ - Swap the top and the `item_number` element of the stack, where + Swaps the top and the `item_number` element of the stack, where the top of the stack is position zero. If `item_number` is zero, this function does nothing (which should not be diff --git a/src/ethereum/forks/bpo5/vm/instructions/system.py b/src/ethereum/forks/bpo5/vm/instructions/system.py index fea7a0c1b9d..44c36ae000f 100644 --- a/src/ethereum/forks/bpo5/vm/instructions/system.py +++ b/src/ethereum/forks/bpo5/vm/instructions/system.py @@ -193,8 +193,8 @@ def create2(evm: Evm) -> None: """ Creates a new account with associated code. - It's similar to CREATE opcode except that the address of new account - depends on the init_code instead of the nonce of sender. + It's similar to the CREATE opcode except that the address of the new + account depends on the init_code instead of the nonce of sender. Parameters ---------- diff --git a/src/ethereum/forks/bpo5/vm/precompiled_contracts/bls12_381/bls12_381_pairing.py b/src/ethereum/forks/bpo5/vm/precompiled_contracts/bls12_381/bls12_381_pairing.py index 6cb29a32fd9..c7a62cb49c0 100644 --- a/src/ethereum/forks/bpo5/vm/precompiled_contracts/bls12_381/bls12_381_pairing.py +++ b/src/ethereum/forks/bpo5/vm/precompiled_contracts/bls12_381/bls12_381_pairing.py @@ -33,7 +33,7 @@ def bls12_pairing(evm: Evm) -> None: Raises ------ InvalidParameter - If the input length is invalid or if sub-group check fails. + If the input length is invalid or if the subgroup check fails. """ data = evm.message.data @@ -54,12 +54,12 @@ def bls12_pairing(evm: Evm) -> None: g1_slice = data[g1_start : g1_start + Uint(128)] g1_point = bytes_to_g1(bytes(g1_slice)) if not is_inf(bls12_multiply(g1_point, curve_order)): - raise InvalidParameter("Sub-group check failed for G1 point.") + raise InvalidParameter("Subgroup check failed for G1 point.") g2_slice = data[g2_start : g2_start + Uint(256)] g2_point = bytes_to_g2(bytes(g2_slice)) if not is_inf(bls12_multiply(g2_point, curve_order)): - raise InvalidParameter("Sub-group check failed for G2 point.") + raise InvalidParameter("Subgroup check failed for G2 point.") result *= pairing(g2_point, g1_point) diff --git a/src/ethereum/forks/bpo5/vm/precompiled_contracts/ecrecover.py b/src/ethereum/forks/bpo5/vm/precompiled_contracts/ecrecover.py index d2eeaf75df1..d8f6602e556 100644 --- a/src/ethereum/forks/bpo5/vm/precompiled_contracts/ecrecover.py +++ b/src/ethereum/forks/bpo5/vm/precompiled_contracts/ecrecover.py @@ -8,7 +8,7 @@ Introduction ------------ -Implementation of the ECRECOVER precompiled contract. +Implementation of the `ECRECOVER` precompiled contract. """ from ethereum_types.numeric import U256 diff --git a/src/ethereum/forks/bpo5/vm/precompiled_contracts/mapping.py b/src/ethereum/forks/bpo5/vm/precompiled_contracts/mapping.py index a80e2b02354..7486203c3e6 100644 --- a/src/ethereum/forks/bpo5/vm/precompiled_contracts/mapping.py +++ b/src/ethereum/forks/bpo5/vm/precompiled_contracts/mapping.py @@ -8,7 +8,7 @@ Introduction ------------ -Mapping of precompiled contracts their implementations. +Mapping of precompiled contracts to their implementations. """ from typing import Callable, Dict diff --git a/src/ethereum/forks/bpo5/vm/precompiled_contracts/modexp.py b/src/ethereum/forks/bpo5/vm/precompiled_contracts/modexp.py index 5e7e895b91a..bf828ee8f6e 100644 --- a/src/ethereum/forks/bpo5/vm/precompiled_contracts/modexp.py +++ b/src/ethereum/forks/bpo5/vm/precompiled_contracts/modexp.py @@ -22,7 +22,7 @@ def modexp(evm: Evm) -> None: """ - Calculates `(base**exp) % modulus` for arbitrary sized `base`, `exp` and. + Calculates `(base**exp) % modulus` for arbitrary sized `base`, `exp` and `modulus`. The return value is the same length as the modulus. """ data = evm.message.data diff --git a/src/ethereum/forks/bpo5/vm/precompiled_contracts/p256verify.py b/src/ethereum/forks/bpo5/vm/precompiled_contracts/p256verify.py index 6f6e7ff4e9d..106dd548a61 100644 --- a/src/ethereum/forks/bpo5/vm/precompiled_contracts/p256verify.py +++ b/src/ethereum/forks/bpo5/vm/precompiled_contracts/p256verify.py @@ -5,9 +5,10 @@ :backlinks: none :local: -Introduction. +Introduction ------------ -Implementation of the P256VERIFY precompiled contract. + +Implementation of the `P256VERIFY` precompiled contract. """ from ethereum_types.numeric import U256 diff --git a/src/ethereum/forks/bpo5/vm/precompiled_contracts/point_evaluation.py b/src/ethereum/forks/bpo5/vm/precompiled_contracts/point_evaluation.py index 760af477364..ce4eed71294 100644 --- a/src/ethereum/forks/bpo5/vm/precompiled_contracts/point_evaluation.py +++ b/src/ethereum/forks/bpo5/vm/precompiled_contracts/point_evaluation.py @@ -8,7 +8,7 @@ Introduction ------------ -Implementation of the POINT EVALUATION precompiled contract. +Implementation of the `POINT EVALUATION` precompiled contract. """ from ethereum_types.bytes import Bytes, Bytes32, Bytes48 diff --git a/src/ethereum/forks/bpo5/vm/runtime.py b/src/ethereum/forks/bpo5/vm/runtime.py index 505b3488de8..0aa5ddd5e20 100644 --- a/src/ethereum/forks/bpo5/vm/runtime.py +++ b/src/ethereum/forks/bpo5/vm/runtime.py @@ -21,7 +21,7 @@ def get_valid_jump_destinations(code: Bytes) -> Set[Uint]: """ - Analyze the evm code to obtain the set of valid jump destinations. + Analyze the EVM code to obtain the set of valid jump destinations. Valid jump destinations are defined as follows: * The jump destination is less than the length of the code. diff --git a/src/ethereum/forks/byzantium/blocks.py b/src/ethereum/forks/byzantium/blocks.py index a70fe41923a..2f027b04dc7 100644 --- a/src/ethereum/forks/byzantium/blocks.py +++ b/src/ethereum/forks/byzantium/blocks.py @@ -112,7 +112,7 @@ class Header: number: Uint """ - Block number, (height) in the chain. + Block number (height) in the chain. """ gas_limit: Uint @@ -183,7 +183,7 @@ class Block: header: Header """ The block header containing metadata and cryptographic commitments. Refer - [headers] for more details on the fields included in the header. + to [headers] for more details on the fields included in the header. [headers]: ref:ethereum.forks.byzantium.blocks.Header """ diff --git a/src/ethereum/forks/byzantium/bloom.py b/src/ethereum/forks/byzantium/bloom.py index 8a12ec081dd..0e079df6b39 100644 --- a/src/ethereum/forks/byzantium/bloom.py +++ b/src/ethereum/forks/byzantium/bloom.py @@ -8,7 +8,7 @@ Introduction ------------ -This modules defines functions for calculating bloom filters of logs. For the +This module defines functions for calculating bloom filters of logs. For the general theory of bloom filters see e.g. `Wikipedia `_. Bloom filters are used to allow for efficient searching of logs by address and/or topic, by rapidly diff --git a/src/ethereum/forks/byzantium/state.py b/src/ethereum/forks/byzantium/state.py index 2e21b4f8140..a0dd7d77ab8 100644 --- a/src/ethereum/forks/byzantium/state.py +++ b/src/ethereum/forks/byzantium/state.py @@ -340,7 +340,7 @@ def account_exists(state: State, address: Address) -> bool: def account_has_code_or_nonce(state: State, address: Address) -> bool: """ - Checks if an account has non zero nonce or non empty code. + Checks if an account has non-zero nonce or non-empty code. Parameters ---------- @@ -352,7 +352,7 @@ def account_has_code_or_nonce(state: State, address: Address) -> bool: Returns ------- has_code_or_nonce : `bool` - True if the account has non zero nonce or non empty code, + True if the account has non-zero nonce or non-empty code, False otherwise. """ @@ -473,7 +473,7 @@ def set_account_balance(state: State, address: Address, amount: U256) -> None: Address of the account whose nonce needs to be incremented. amount: - The amount that needs to set in balance. + The amount that needs to be set in the balance. """ @@ -493,7 +493,7 @@ def touch_account(state: State, address: Address) -> None: The current state. address: - The address of the account that need to initialised. + The address of the account that needs to be initialized. """ if not account_exists(state, address): @@ -530,7 +530,7 @@ def set_code(state: State, address: Address, code: Bytes) -> None: The current state. address: - Address of the account whose code needs to be update. + Address of the account whose code needs to be updated. code: The bytecode that needs to be set. diff --git a/src/ethereum/forks/byzantium/trie.py b/src/ethereum/forks/byzantium/trie.py index 555ec32d3cd..2858183a400 100644 --- a/src/ethereum/forks/byzantium/trie.py +++ b/src/ethereum/forks/byzantium/trie.py @@ -128,7 +128,7 @@ class BranchNode: def encode_internal_node(node: Optional[InternalNode]) -> Extended: """ Encodes a Merkle Trie node into its RLP form. The RLP will then be - serialized into a `Bytes` and hashed unless it is less that 32 bytes + serialized into a `Bytes` and hashed unless it is less than 32 bytes when serialized. This function also accepts `None`, representing the absence of a node, diff --git a/src/ethereum/forks/byzantium/vm/__init__.py b/src/ethereum/forks/byzantium/vm/__init__.py index 6cdd9c9bc74..068648ac368 100644 --- a/src/ethereum/forks/byzantium/vm/__init__.py +++ b/src/ethereum/forks/byzantium/vm/__init__.py @@ -61,7 +61,7 @@ class BlockOutput: receipts_trie : `ethereum.fork_types.Root` Trie root of all the receipts in the block. receipt_keys : - Key of all the receipts in the block. + Keys of all the receipts in the block. block_logs : `Bloom` Logs bloom of all the logs included in all the transactions of the block. diff --git a/src/ethereum/forks/byzantium/vm/gas.py b/src/ethereum/forks/byzantium/vm/gas.py index 69441283693..80d9b2cd767 100644 --- a/src/ethereum/forks/byzantium/vm/gas.py +++ b/src/ethereum/forks/byzantium/vm/gas.py @@ -211,7 +211,7 @@ def calculate_message_call_gas( account inside a message call. call_stipend : The amount of stipend provided to a message call to execute code while - transferring value(ETH). + transferring value (ETH). Returns ------- diff --git a/src/ethereum/forks/byzantium/vm/instructions/arithmetic.py b/src/ethereum/forks/byzantium/vm/instructions/arithmetic.py index de5d6ab43d5..b7b1a370ad4 100644 --- a/src/ethereum/forks/byzantium/vm/instructions/arithmetic.py +++ b/src/ethereum/forks/byzantium/vm/instructions/arithmetic.py @@ -84,7 +84,7 @@ def sub(evm: Evm) -> None: def mul(evm: Evm) -> None: """ - Multiply the top two elements of the stack, and pushes the result back + Multiplies the top two elements of the stack, and pushes the result back on the stack. Parameters @@ -353,7 +353,7 @@ def signextend(evm: Evm) -> None: # Can't extend any further result = value else: - # U256(0).to_be_bytes() gives b'' instead b'\x00'. + # U256(0).to_be_bytes() gives b'' instead of b'\x00'. value_bytes = Bytes(value.to_be_bytes32()) # Now among the obtained value bytes, consider only # N `least significant bytes`, where N is `byte_num + 1`. diff --git a/src/ethereum/forks/byzantium/vm/instructions/block.py b/src/ethereum/forks/byzantium/vm/instructions/block.py index 8b50f1bc07f..0edcbf000d1 100644 --- a/src/ethereum/forks/byzantium/vm/instructions/block.py +++ b/src/ethereum/forks/byzantium/vm/instructions/block.py @@ -87,7 +87,7 @@ def coinbase(evm: Evm) -> None: def timestamp(evm: Evm) -> None: """ Push the current block's timestamp onto the stack. Here the timestamp - being referred is actually the unix timestamp in seconds. + being referred to is actually the unix timestamp in seconds. Here the current block refers to the block in which the currently executing transaction/call resides. diff --git a/src/ethereum/forks/byzantium/vm/instructions/environment.py b/src/ethereum/forks/byzantium/vm/instructions/environment.py index d98f13b0d84..f657e252991 100644 --- a/src/ethereum/forks/byzantium/vm/instructions/environment.py +++ b/src/ethereum/forks/byzantium/vm/instructions/environment.py @@ -403,7 +403,7 @@ def returndatasize(evm: Evm) -> None: def returndatacopy(evm: Evm) -> None: """ - Copies data from the return data buffer code to memory. + Copies data from the return data buffer to memory. Parameters ---------- diff --git a/src/ethereum/forks/byzantium/vm/instructions/memory.py b/src/ethereum/forks/byzantium/vm/instructions/memory.py index fdd95188438..3a242ba2f7a 100644 --- a/src/ethereum/forks/byzantium/vm/instructions/memory.py +++ b/src/ethereum/forks/byzantium/vm/instructions/memory.py @@ -90,7 +90,7 @@ def mstore8(evm: Evm) -> None: def mload(evm: Evm) -> None: """ - Load word from memory. + Loads a word from memory. Parameters ---------- @@ -120,7 +120,7 @@ def mload(evm: Evm) -> None: def msize(evm: Evm) -> None: """ - Push the size of active memory in bytes onto the stack. + Pushes the size of active memory in bytes onto the stack. Parameters ---------- diff --git a/src/ethereum/forks/byzantium/vm/instructions/stack.py b/src/ethereum/forks/byzantium/vm/instructions/stack.py index bdf232db6a8..0fc0d3fe4b5 100644 --- a/src/ethereum/forks/byzantium/vm/instructions/stack.py +++ b/src/ethereum/forks/byzantium/vm/instructions/stack.py @@ -23,7 +23,7 @@ def pop(evm: Evm) -> None: """ - Remove item from stack. + Removes an item from the stack. Parameters ---------- @@ -46,7 +46,7 @@ def pop(evm: Evm) -> None: def push_n(evm: Evm, num_bytes: int) -> None: """ - Pushes a N-byte immediate onto the stack. + Pushes an N-byte immediate onto the stack. Parameters ---------- @@ -76,7 +76,7 @@ def push_n(evm: Evm, num_bytes: int) -> None: def dup_n(evm: Evm, item_number: int) -> None: """ - Duplicate the Nth stack item (from top of the stack) to the top of stack. + Duplicates the Nth stack item (from top of the stack) to the top of stack. Parameters ---------- @@ -104,7 +104,7 @@ def dup_n(evm: Evm, item_number: int) -> None: def swap_n(evm: Evm, item_number: int) -> None: """ - Swap the top and the `item_number` element of the stack, where + Swaps the top and the `item_number` element of the stack, where the top of the stack is position zero. If `item_number` is zero, this function does nothing (which should not be diff --git a/src/ethereum/forks/byzantium/vm/precompiled_contracts/ecrecover.py b/src/ethereum/forks/byzantium/vm/precompiled_contracts/ecrecover.py index d2eeaf75df1..d8f6602e556 100644 --- a/src/ethereum/forks/byzantium/vm/precompiled_contracts/ecrecover.py +++ b/src/ethereum/forks/byzantium/vm/precompiled_contracts/ecrecover.py @@ -8,7 +8,7 @@ Introduction ------------ -Implementation of the ECRECOVER precompiled contract. +Implementation of the `ECRECOVER` precompiled contract. """ from ethereum_types.numeric import U256 diff --git a/src/ethereum/forks/byzantium/vm/precompiled_contracts/mapping.py b/src/ethereum/forks/byzantium/vm/precompiled_contracts/mapping.py index 13746350b51..d866782adc3 100644 --- a/src/ethereum/forks/byzantium/vm/precompiled_contracts/mapping.py +++ b/src/ethereum/forks/byzantium/vm/precompiled_contracts/mapping.py @@ -8,7 +8,7 @@ Introduction ------------ -Mapping of precompiled contracts their implementations. +Mapping of precompiled contracts to their implementations. """ from typing import Callable, Dict diff --git a/src/ethereum/forks/byzantium/vm/precompiled_contracts/modexp.py b/src/ethereum/forks/byzantium/vm/precompiled_contracts/modexp.py index fd0501616c1..8ed5c851a72 100644 --- a/src/ethereum/forks/byzantium/vm/precompiled_contracts/modexp.py +++ b/src/ethereum/forks/byzantium/vm/precompiled_contracts/modexp.py @@ -23,7 +23,7 @@ def modexp(evm: Evm) -> None: """ - Calculates `(base**exp) % modulus` for arbitrary sized `base`, `exp` and. + Calculates `(base**exp) % modulus` for arbitrary sized `base`, `exp` and `modulus`. The return value is the same length as the modulus. """ data = evm.message.data diff --git a/src/ethereum/forks/byzantium/vm/runtime.py b/src/ethereum/forks/byzantium/vm/runtime.py index 505b3488de8..0aa5ddd5e20 100644 --- a/src/ethereum/forks/byzantium/vm/runtime.py +++ b/src/ethereum/forks/byzantium/vm/runtime.py @@ -21,7 +21,7 @@ def get_valid_jump_destinations(code: Bytes) -> Set[Uint]: """ - Analyze the evm code to obtain the set of valid jump destinations. + Analyze the EVM code to obtain the set of valid jump destinations. Valid jump destinations are defined as follows: * The jump destination is less than the length of the code. diff --git a/src/ethereum/forks/cancun/blocks.py b/src/ethereum/forks/cancun/blocks.py index e2668062f63..eb413f52008 100644 --- a/src/ethereum/forks/cancun/blocks.py +++ b/src/ethereum/forks/cancun/blocks.py @@ -151,7 +151,7 @@ class Header: number: Uint """ - Block number, (height) in the chain. + Block number (height) in the chain. """ gas_limit: Uint @@ -261,7 +261,7 @@ class Block: header: Header """ The block header containing metadata and cryptographic commitments. Refer - [headers] for more details on the fields included in the header. + to [headers] for more details on the fields included in the header. [headers]: ref:ethereum.forks.cancun.blocks.Header """ diff --git a/src/ethereum/forks/cancun/bloom.py b/src/ethereum/forks/cancun/bloom.py index 8a12ec081dd..0e079df6b39 100644 --- a/src/ethereum/forks/cancun/bloom.py +++ b/src/ethereum/forks/cancun/bloom.py @@ -8,7 +8,7 @@ Introduction ------------ -This modules defines functions for calculating bloom filters of logs. For the +This module defines functions for calculating bloom filters of logs. For the general theory of bloom filters see e.g. `Wikipedia `_. Bloom filters are used to allow for efficient searching of logs by address and/or topic, by rapidly diff --git a/src/ethereum/forks/cancun/state.py b/src/ethereum/forks/cancun/state.py index e997411f6da..6571aa05c61 100644 --- a/src/ethereum/forks/cancun/state.py +++ b/src/ethereum/forks/cancun/state.py @@ -400,7 +400,7 @@ def account_exists(state: State, address: Address) -> bool: def account_has_code_or_nonce(state: State, address: Address) -> bool: """ - Checks if an account has non zero nonce or non empty code. + Checks if an account has non-zero nonce or non-empty code. Parameters ---------- @@ -412,7 +412,7 @@ def account_has_code_or_nonce(state: State, address: Address) -> bool: Returns ------- has_code_or_nonce : `bool` - True if the account has non zero nonce or non empty code, + True if the account has non-zero nonce or non-empty code, False otherwise. """ @@ -517,7 +517,7 @@ def set_account_balance(state: State, address: Address, amount: U256) -> None: Address of the account whose nonce needs to be incremented. amount: - The amount that needs to set in balance. + The amount that needs to be set in the balance. """ @@ -557,7 +557,7 @@ def set_code(state: State, address: Address, code: Bytes) -> None: The current state. address: - Address of the account whose code needs to be update. + Address of the account whose code needs to be updated. code: The bytecode that needs to be set. diff --git a/src/ethereum/forks/cancun/trie.py b/src/ethereum/forks/cancun/trie.py index 2efc9c07cd3..c6bb4fe928e 100644 --- a/src/ethereum/forks/cancun/trie.py +++ b/src/ethereum/forks/cancun/trie.py @@ -138,7 +138,7 @@ class BranchNode: def encode_internal_node(node: Optional[InternalNode]) -> Extended: """ Encodes a Merkle Trie node into its RLP form. The RLP will then be - serialized into a `Bytes` and hashed unless it is less that 32 bytes + serialized into a `Bytes` and hashed unless it is less than 32 bytes when serialized. This function also accepts `None`, representing the absence of a node, diff --git a/src/ethereum/forks/cancun/vm/__init__.py b/src/ethereum/forks/cancun/vm/__init__.py index 0f03a02cb70..96803699ead 100644 --- a/src/ethereum/forks/cancun/vm/__init__.py +++ b/src/ethereum/forks/cancun/vm/__init__.py @@ -63,7 +63,7 @@ class BlockOutput: receipts_trie : `ethereum.fork_types.Root` Trie root of all the receipts in the block. receipt_keys : - Key of all the receipts in the block. + Keys of all the receipts in the block. block_logs : `Bloom` Logs bloom of all the logs included in all the transactions of the block. diff --git a/src/ethereum/forks/cancun/vm/gas.py b/src/ethereum/forks/cancun/vm/gas.py index 241315a9945..e1ab03155e7 100644 --- a/src/ethereum/forks/cancun/vm/gas.py +++ b/src/ethereum/forks/cancun/vm/gas.py @@ -221,7 +221,7 @@ def calculate_message_call_gas( account inside a message call. call_stipend : The amount of stipend provided to a message call to execute code while - transferring value(ETH). + transferring value (ETH). Returns ------- @@ -277,7 +277,7 @@ def init_code_cost(init_code_length: Uint) -> Uint: def calculate_excess_blob_gas(parent_header: Header) -> U64: """ - Calculated the excess blob gas for the current block based + Calculates the excess blob gas for the current block based on the gas used in the parent block. Parameters diff --git a/src/ethereum/forks/cancun/vm/instructions/arithmetic.py b/src/ethereum/forks/cancun/vm/instructions/arithmetic.py index de5d6ab43d5..b7b1a370ad4 100644 --- a/src/ethereum/forks/cancun/vm/instructions/arithmetic.py +++ b/src/ethereum/forks/cancun/vm/instructions/arithmetic.py @@ -84,7 +84,7 @@ def sub(evm: Evm) -> None: def mul(evm: Evm) -> None: """ - Multiply the top two elements of the stack, and pushes the result back + Multiplies the top two elements of the stack, and pushes the result back on the stack. Parameters @@ -353,7 +353,7 @@ def signextend(evm: Evm) -> None: # Can't extend any further result = value else: - # U256(0).to_be_bytes() gives b'' instead b'\x00'. + # U256(0).to_be_bytes() gives b'' instead of b'\x00'. value_bytes = Bytes(value.to_be_bytes32()) # Now among the obtained value bytes, consider only # N `least significant bytes`, where N is `byte_num + 1`. diff --git a/src/ethereum/forks/cancun/vm/instructions/block.py b/src/ethereum/forks/cancun/vm/instructions/block.py index fac1e1c95f5..4f971a9dbf4 100644 --- a/src/ethereum/forks/cancun/vm/instructions/block.py +++ b/src/ethereum/forks/cancun/vm/instructions/block.py @@ -101,7 +101,7 @@ def coinbase(evm: Evm) -> None: def timestamp(evm: Evm) -> None: """ Push the current block's timestamp onto the stack. Here the timestamp - being referred is actually the unix timestamp in seconds. + being referred to is actually the unix timestamp in seconds. Here the current block refers to the block in which the currently executing transaction/call resides. diff --git a/src/ethereum/forks/cancun/vm/instructions/environment.py b/src/ethereum/forks/cancun/vm/instructions/environment.py index 83690434658..28c595ee514 100644 --- a/src/ethereum/forks/cancun/vm/instructions/environment.py +++ b/src/ethereum/forks/cancun/vm/instructions/environment.py @@ -426,7 +426,7 @@ def returndatasize(evm: Evm) -> None: def returndatacopy(evm: Evm) -> None: """ - Copies data from the return data buffer code to memory. + Copies data from the return data buffer to memory. Parameters ---------- diff --git a/src/ethereum/forks/cancun/vm/instructions/memory.py b/src/ethereum/forks/cancun/vm/instructions/memory.py index 631d33a7fd6..6e111051ee3 100644 --- a/src/ethereum/forks/cancun/vm/instructions/memory.py +++ b/src/ethereum/forks/cancun/vm/instructions/memory.py @@ -93,7 +93,7 @@ def mstore8(evm: Evm) -> None: def mload(evm: Evm) -> None: """ - Load word from memory. + Loads a word from memory. Parameters ---------- @@ -123,7 +123,7 @@ def mload(evm: Evm) -> None: def msize(evm: Evm) -> None: """ - Push the size of active memory in bytes onto the stack. + Pushes the size of active memory in bytes onto the stack. Parameters ---------- @@ -146,7 +146,7 @@ def msize(evm: Evm) -> None: def mcopy(evm: Evm) -> None: """ - Copy the bytes in memory from one location to another. + Copies the bytes in memory from one location to another. Parameters ---------- diff --git a/src/ethereum/forks/cancun/vm/instructions/stack.py b/src/ethereum/forks/cancun/vm/instructions/stack.py index e381b52c370..0007a28acd4 100644 --- a/src/ethereum/forks/cancun/vm/instructions/stack.py +++ b/src/ethereum/forks/cancun/vm/instructions/stack.py @@ -23,7 +23,7 @@ def pop(evm: Evm) -> None: """ - Remove item from stack. + Removes an item from the stack. Parameters ---------- @@ -46,7 +46,7 @@ def pop(evm: Evm) -> None: def push_n(evm: Evm, num_bytes: int) -> None: """ - Pushes a N-byte immediate onto the stack. Push zero if num_bytes is zero. + Pushes an N-byte immediate onto the stack. Push zero if num_bytes is zero. Parameters ---------- @@ -79,7 +79,7 @@ def push_n(evm: Evm, num_bytes: int) -> None: def dup_n(evm: Evm, item_number: int) -> None: """ - Duplicate the Nth stack item (from top of the stack) to the top of stack. + Duplicates the Nth stack item (from top of the stack) to the top of stack. Parameters ---------- @@ -107,7 +107,7 @@ def dup_n(evm: Evm, item_number: int) -> None: def swap_n(evm: Evm, item_number: int) -> None: """ - Swap the top and the `item_number` element of the stack, where + Swaps the top and the `item_number` element of the stack, where the top of the stack is position zero. If `item_number` is zero, this function does nothing (which should not be diff --git a/src/ethereum/forks/cancun/vm/instructions/system.py b/src/ethereum/forks/cancun/vm/instructions/system.py index 89b3b6cfdac..ca462164d29 100644 --- a/src/ethereum/forks/cancun/vm/instructions/system.py +++ b/src/ethereum/forks/cancun/vm/instructions/system.py @@ -191,8 +191,8 @@ def create2(evm: Evm) -> None: """ Creates a new account with associated code. - It's similar to CREATE opcode except that the address of new account - depends on the init_code instead of the nonce of sender. + It's similar to the CREATE opcode except that the address of the new + account depends on the init_code instead of the nonce of sender. Parameters ---------- diff --git a/src/ethereum/forks/cancun/vm/precompiled_contracts/ecrecover.py b/src/ethereum/forks/cancun/vm/precompiled_contracts/ecrecover.py index d2eeaf75df1..d8f6602e556 100644 --- a/src/ethereum/forks/cancun/vm/precompiled_contracts/ecrecover.py +++ b/src/ethereum/forks/cancun/vm/precompiled_contracts/ecrecover.py @@ -8,7 +8,7 @@ Introduction ------------ -Implementation of the ECRECOVER precompiled contract. +Implementation of the `ECRECOVER` precompiled contract. """ from ethereum_types.numeric import U256 diff --git a/src/ethereum/forks/cancun/vm/precompiled_contracts/mapping.py b/src/ethereum/forks/cancun/vm/precompiled_contracts/mapping.py index dc24767ab62..4acff465fb8 100644 --- a/src/ethereum/forks/cancun/vm/precompiled_contracts/mapping.py +++ b/src/ethereum/forks/cancun/vm/precompiled_contracts/mapping.py @@ -8,7 +8,7 @@ Introduction ------------ -Mapping of precompiled contracts their implementations. +Mapping of precompiled contracts to their implementations. """ from typing import Callable, Dict diff --git a/src/ethereum/forks/cancun/vm/precompiled_contracts/modexp.py b/src/ethereum/forks/cancun/vm/precompiled_contracts/modexp.py index 462341f69fd..755a396ddac 100644 --- a/src/ethereum/forks/cancun/vm/precompiled_contracts/modexp.py +++ b/src/ethereum/forks/cancun/vm/precompiled_contracts/modexp.py @@ -23,7 +23,7 @@ def modexp(evm: Evm) -> None: """ - Calculates `(base**exp) % modulus` for arbitrary sized `base`, `exp` and. + Calculates `(base**exp) % modulus` for arbitrary sized `base`, `exp` and `modulus`. The return value is the same length as the modulus. """ data = evm.message.data diff --git a/src/ethereum/forks/cancun/vm/precompiled_contracts/point_evaluation.py b/src/ethereum/forks/cancun/vm/precompiled_contracts/point_evaluation.py index 760af477364..ce4eed71294 100644 --- a/src/ethereum/forks/cancun/vm/precompiled_contracts/point_evaluation.py +++ b/src/ethereum/forks/cancun/vm/precompiled_contracts/point_evaluation.py @@ -8,7 +8,7 @@ Introduction ------------ -Implementation of the POINT EVALUATION precompiled contract. +Implementation of the `POINT EVALUATION` precompiled contract. """ from ethereum_types.bytes import Bytes, Bytes32, Bytes48 diff --git a/src/ethereum/forks/cancun/vm/runtime.py b/src/ethereum/forks/cancun/vm/runtime.py index 505b3488de8..0aa5ddd5e20 100644 --- a/src/ethereum/forks/cancun/vm/runtime.py +++ b/src/ethereum/forks/cancun/vm/runtime.py @@ -21,7 +21,7 @@ def get_valid_jump_destinations(code: Bytes) -> Set[Uint]: """ - Analyze the evm code to obtain the set of valid jump destinations. + Analyze the EVM code to obtain the set of valid jump destinations. Valid jump destinations are defined as follows: * The jump destination is less than the length of the code. diff --git a/src/ethereum/forks/constantinople/blocks.py b/src/ethereum/forks/constantinople/blocks.py index 8d476d8451d..e53cf2c1c65 100644 --- a/src/ethereum/forks/constantinople/blocks.py +++ b/src/ethereum/forks/constantinople/blocks.py @@ -112,7 +112,7 @@ class Header: number: Uint """ - Block number, (height) in the chain. + Block number (height) in the chain. """ gas_limit: Uint @@ -183,7 +183,7 @@ class Block: header: Header """ The block header containing metadata and cryptographic commitments. Refer - [headers] for more details on the fields included in the header. + to [headers] for more details on the fields included in the header. [headers]: ref:ethereum.forks.constantinople.blocks.Header """ diff --git a/src/ethereum/forks/constantinople/bloom.py b/src/ethereum/forks/constantinople/bloom.py index 8a12ec081dd..0e079df6b39 100644 --- a/src/ethereum/forks/constantinople/bloom.py +++ b/src/ethereum/forks/constantinople/bloom.py @@ -8,7 +8,7 @@ Introduction ------------ -This modules defines functions for calculating bloom filters of logs. For the +This module defines functions for calculating bloom filters of logs. For the general theory of bloom filters see e.g. `Wikipedia `_. Bloom filters are used to allow for efficient searching of logs by address and/or topic, by rapidly diff --git a/src/ethereum/forks/constantinople/state.py b/src/ethereum/forks/constantinople/state.py index 2e21b4f8140..a0dd7d77ab8 100644 --- a/src/ethereum/forks/constantinople/state.py +++ b/src/ethereum/forks/constantinople/state.py @@ -340,7 +340,7 @@ def account_exists(state: State, address: Address) -> bool: def account_has_code_or_nonce(state: State, address: Address) -> bool: """ - Checks if an account has non zero nonce or non empty code. + Checks if an account has non-zero nonce or non-empty code. Parameters ---------- @@ -352,7 +352,7 @@ def account_has_code_or_nonce(state: State, address: Address) -> bool: Returns ------- has_code_or_nonce : `bool` - True if the account has non zero nonce or non empty code, + True if the account has non-zero nonce or non-empty code, False otherwise. """ @@ -473,7 +473,7 @@ def set_account_balance(state: State, address: Address, amount: U256) -> None: Address of the account whose nonce needs to be incremented. amount: - The amount that needs to set in balance. + The amount that needs to be set in the balance. """ @@ -493,7 +493,7 @@ def touch_account(state: State, address: Address) -> None: The current state. address: - The address of the account that need to initialised. + The address of the account that needs to be initialized. """ if not account_exists(state, address): @@ -530,7 +530,7 @@ def set_code(state: State, address: Address, code: Bytes) -> None: The current state. address: - Address of the account whose code needs to be update. + Address of the account whose code needs to be updated. code: The bytecode that needs to be set. diff --git a/src/ethereum/forks/constantinople/trie.py b/src/ethereum/forks/constantinople/trie.py index c730e055159..0ff06ea4ec7 100644 --- a/src/ethereum/forks/constantinople/trie.py +++ b/src/ethereum/forks/constantinople/trie.py @@ -128,7 +128,7 @@ class BranchNode: def encode_internal_node(node: Optional[InternalNode]) -> Extended: """ Encodes a Merkle Trie node into its RLP form. The RLP will then be - serialized into a `Bytes` and hashed unless it is less that 32 bytes + serialized into a `Bytes` and hashed unless it is less than 32 bytes when serialized. This function also accepts `None`, representing the absence of a node, diff --git a/src/ethereum/forks/constantinople/vm/__init__.py b/src/ethereum/forks/constantinople/vm/__init__.py index 6cdd9c9bc74..068648ac368 100644 --- a/src/ethereum/forks/constantinople/vm/__init__.py +++ b/src/ethereum/forks/constantinople/vm/__init__.py @@ -61,7 +61,7 @@ class BlockOutput: receipts_trie : `ethereum.fork_types.Root` Trie root of all the receipts in the block. receipt_keys : - Key of all the receipts in the block. + Keys of all the receipts in the block. block_logs : `Bloom` Logs bloom of all the logs included in all the transactions of the block. diff --git a/src/ethereum/forks/constantinople/vm/gas.py b/src/ethereum/forks/constantinople/vm/gas.py index 7ec51fd8b58..940e266b51b 100644 --- a/src/ethereum/forks/constantinople/vm/gas.py +++ b/src/ethereum/forks/constantinople/vm/gas.py @@ -212,7 +212,7 @@ def calculate_message_call_gas( account inside a message call. call_stipend : The amount of stipend provided to a message call to execute code while - transferring value(ETH). + transferring value (ETH). Returns ------- diff --git a/src/ethereum/forks/constantinople/vm/instructions/arithmetic.py b/src/ethereum/forks/constantinople/vm/instructions/arithmetic.py index de5d6ab43d5..b7b1a370ad4 100644 --- a/src/ethereum/forks/constantinople/vm/instructions/arithmetic.py +++ b/src/ethereum/forks/constantinople/vm/instructions/arithmetic.py @@ -84,7 +84,7 @@ def sub(evm: Evm) -> None: def mul(evm: Evm) -> None: """ - Multiply the top two elements of the stack, and pushes the result back + Multiplies the top two elements of the stack, and pushes the result back on the stack. Parameters @@ -353,7 +353,7 @@ def signextend(evm: Evm) -> None: # Can't extend any further result = value else: - # U256(0).to_be_bytes() gives b'' instead b'\x00'. + # U256(0).to_be_bytes() gives b'' instead of b'\x00'. value_bytes = Bytes(value.to_be_bytes32()) # Now among the obtained value bytes, consider only # N `least significant bytes`, where N is `byte_num + 1`. diff --git a/src/ethereum/forks/constantinople/vm/instructions/block.py b/src/ethereum/forks/constantinople/vm/instructions/block.py index 8b50f1bc07f..0edcbf000d1 100644 --- a/src/ethereum/forks/constantinople/vm/instructions/block.py +++ b/src/ethereum/forks/constantinople/vm/instructions/block.py @@ -87,7 +87,7 @@ def coinbase(evm: Evm) -> None: def timestamp(evm: Evm) -> None: """ Push the current block's timestamp onto the stack. Here the timestamp - being referred is actually the unix timestamp in seconds. + being referred to is actually the unix timestamp in seconds. Here the current block refers to the block in which the currently executing transaction/call resides. diff --git a/src/ethereum/forks/constantinople/vm/instructions/environment.py b/src/ethereum/forks/constantinople/vm/instructions/environment.py index f5a0be72f48..8db76a38cc8 100644 --- a/src/ethereum/forks/constantinople/vm/instructions/environment.py +++ b/src/ethereum/forks/constantinople/vm/instructions/environment.py @@ -406,7 +406,7 @@ def returndatasize(evm: Evm) -> None: def returndatacopy(evm: Evm) -> None: """ - Copies data from the return data buffer code to memory. + Copies data from the return data buffer to memory. Parameters ---------- diff --git a/src/ethereum/forks/constantinople/vm/instructions/memory.py b/src/ethereum/forks/constantinople/vm/instructions/memory.py index fdd95188438..3a242ba2f7a 100644 --- a/src/ethereum/forks/constantinople/vm/instructions/memory.py +++ b/src/ethereum/forks/constantinople/vm/instructions/memory.py @@ -90,7 +90,7 @@ def mstore8(evm: Evm) -> None: def mload(evm: Evm) -> None: """ - Load word from memory. + Loads a word from memory. Parameters ---------- @@ -120,7 +120,7 @@ def mload(evm: Evm) -> None: def msize(evm: Evm) -> None: """ - Push the size of active memory in bytes onto the stack. + Pushes the size of active memory in bytes onto the stack. Parameters ---------- diff --git a/src/ethereum/forks/constantinople/vm/instructions/stack.py b/src/ethereum/forks/constantinople/vm/instructions/stack.py index bdf232db6a8..0fc0d3fe4b5 100644 --- a/src/ethereum/forks/constantinople/vm/instructions/stack.py +++ b/src/ethereum/forks/constantinople/vm/instructions/stack.py @@ -23,7 +23,7 @@ def pop(evm: Evm) -> None: """ - Remove item from stack. + Removes an item from the stack. Parameters ---------- @@ -46,7 +46,7 @@ def pop(evm: Evm) -> None: def push_n(evm: Evm, num_bytes: int) -> None: """ - Pushes a N-byte immediate onto the stack. + Pushes an N-byte immediate onto the stack. Parameters ---------- @@ -76,7 +76,7 @@ def push_n(evm: Evm, num_bytes: int) -> None: def dup_n(evm: Evm, item_number: int) -> None: """ - Duplicate the Nth stack item (from top of the stack) to the top of stack. + Duplicates the Nth stack item (from top of the stack) to the top of stack. Parameters ---------- @@ -104,7 +104,7 @@ def dup_n(evm: Evm, item_number: int) -> None: def swap_n(evm: Evm, item_number: int) -> None: """ - Swap the top and the `item_number` element of the stack, where + Swaps the top and the `item_number` element of the stack, where the top of the stack is position zero. If `item_number` is zero, this function does nothing (which should not be diff --git a/src/ethereum/forks/constantinople/vm/instructions/system.py b/src/ethereum/forks/constantinople/vm/instructions/system.py index fadd9634172..af2527d31cc 100644 --- a/src/ethereum/forks/constantinople/vm/instructions/system.py +++ b/src/ethereum/forks/constantinople/vm/instructions/system.py @@ -179,8 +179,8 @@ def create2(evm: Evm) -> None: """ Creates a new account with associated code. - It's similar to CREATE opcode except that the address of new account - depends on the init_code instead of the nonce of sender. + It's similar to the CREATE opcode except that the address of the new + account depends on the init_code instead of the nonce of sender. Parameters ---------- diff --git a/src/ethereum/forks/constantinople/vm/precompiled_contracts/ecrecover.py b/src/ethereum/forks/constantinople/vm/precompiled_contracts/ecrecover.py index d2eeaf75df1..d8f6602e556 100644 --- a/src/ethereum/forks/constantinople/vm/precompiled_contracts/ecrecover.py +++ b/src/ethereum/forks/constantinople/vm/precompiled_contracts/ecrecover.py @@ -8,7 +8,7 @@ Introduction ------------ -Implementation of the ECRECOVER precompiled contract. +Implementation of the `ECRECOVER` precompiled contract. """ from ethereum_types.numeric import U256 diff --git a/src/ethereum/forks/constantinople/vm/precompiled_contracts/mapping.py b/src/ethereum/forks/constantinople/vm/precompiled_contracts/mapping.py index 13746350b51..d866782adc3 100644 --- a/src/ethereum/forks/constantinople/vm/precompiled_contracts/mapping.py +++ b/src/ethereum/forks/constantinople/vm/precompiled_contracts/mapping.py @@ -8,7 +8,7 @@ Introduction ------------ -Mapping of precompiled contracts their implementations. +Mapping of precompiled contracts to their implementations. """ from typing import Callable, Dict diff --git a/src/ethereum/forks/constantinople/vm/precompiled_contracts/modexp.py b/src/ethereum/forks/constantinople/vm/precompiled_contracts/modexp.py index fd0501616c1..8ed5c851a72 100644 --- a/src/ethereum/forks/constantinople/vm/precompiled_contracts/modexp.py +++ b/src/ethereum/forks/constantinople/vm/precompiled_contracts/modexp.py @@ -23,7 +23,7 @@ def modexp(evm: Evm) -> None: """ - Calculates `(base**exp) % modulus` for arbitrary sized `base`, `exp` and. + Calculates `(base**exp) % modulus` for arbitrary sized `base`, `exp` and `modulus`. The return value is the same length as the modulus. """ data = evm.message.data diff --git a/src/ethereum/forks/constantinople/vm/runtime.py b/src/ethereum/forks/constantinople/vm/runtime.py index 505b3488de8..0aa5ddd5e20 100644 --- a/src/ethereum/forks/constantinople/vm/runtime.py +++ b/src/ethereum/forks/constantinople/vm/runtime.py @@ -21,7 +21,7 @@ def get_valid_jump_destinations(code: Bytes) -> Set[Uint]: """ - Analyze the evm code to obtain the set of valid jump destinations. + Analyze the EVM code to obtain the set of valid jump destinations. Valid jump destinations are defined as follows: * The jump destination is less than the length of the code. diff --git a/src/ethereum/forks/dao_fork/__init__.py b/src/ethereum/forks/dao_fork/__init__.py index 7516eb2de4c..a194cdf3e67 100644 --- a/src/ethereum/forks/dao_fork/__init__.py +++ b/src/ethereum/forks/dao_fork/__init__.py @@ -12,7 +12,7 @@ | Network | Block | Expected Date | Fork Hash | | ------- | ----------- | ------------- | ------------ | -| Mainnet | 1,920,000 | July 20, 1026 | `0x91d1f948` | +| Mainnet | 1,920,000 | July 20, 2016 | `0x91d1f948` | ### Releases diff --git a/src/ethereum/forks/dao_fork/blocks.py b/src/ethereum/forks/dao_fork/blocks.py index 8a6db3ea076..f0de09559a1 100644 --- a/src/ethereum/forks/dao_fork/blocks.py +++ b/src/ethereum/forks/dao_fork/blocks.py @@ -112,7 +112,7 @@ class Header: number: Uint """ - Block number, (height) in the chain. + Block number (height) in the chain. """ gas_limit: Uint @@ -183,7 +183,7 @@ class Block: header: Header """ The block header containing metadata and cryptographic commitments. Refer - [headers] for more details on the fields included in the header. + to [headers] for more details on the fields included in the header. [headers]: ref:ethereum.forks.dao_fork.blocks.Header """ diff --git a/src/ethereum/forks/dao_fork/bloom.py b/src/ethereum/forks/dao_fork/bloom.py index 8a12ec081dd..0e079df6b39 100644 --- a/src/ethereum/forks/dao_fork/bloom.py +++ b/src/ethereum/forks/dao_fork/bloom.py @@ -8,7 +8,7 @@ Introduction ------------ -This modules defines functions for calculating bloom filters of logs. For the +This module defines functions for calculating bloom filters of logs. For the general theory of bloom filters see e.g. `Wikipedia `_. Bloom filters are used to allow for efficient searching of logs by address and/or topic, by rapidly diff --git a/src/ethereum/forks/dao_fork/state.py b/src/ethereum/forks/dao_fork/state.py index 8fb03a07fe9..3b6255055d7 100644 --- a/src/ethereum/forks/dao_fork/state.py +++ b/src/ethereum/forks/dao_fork/state.py @@ -340,7 +340,7 @@ def account_exists(state: State, address: Address) -> bool: def account_has_code_or_nonce(state: State, address: Address) -> bool: """ - Checks if an account has non zero nonce or non empty code. + Checks if an account has non-zero nonce or non-empty code. Parameters ---------- @@ -352,7 +352,7 @@ def account_has_code_or_nonce(state: State, address: Address) -> bool: Returns ------- has_code_or_nonce : `bool` - True if the account has non zero nonce or non empty code, + True if the account has non-zero nonce or non-empty code, False otherwise. """ @@ -424,7 +424,7 @@ def set_account_balance(state: State, address: Address, amount: U256) -> None: Address of the account whose nonce needs to be incremented. amount: - The amount that needs to set in balance. + The amount that needs to be set in the balance. """ @@ -444,7 +444,7 @@ def touch_account(state: State, address: Address) -> None: The current state. address: - The address of the account that need to initialised. + The address of the account that needs to be initialized. """ if not account_exists(state, address): @@ -481,7 +481,7 @@ def set_code(state: State, address: Address, code: Bytes) -> None: The current state. address: - Address of the account whose code needs to be update. + Address of the account whose code needs to be updated. code: The bytecode that needs to be set. diff --git a/src/ethereum/forks/dao_fork/trie.py b/src/ethereum/forks/dao_fork/trie.py index 3ce23788534..679922ff44d 100644 --- a/src/ethereum/forks/dao_fork/trie.py +++ b/src/ethereum/forks/dao_fork/trie.py @@ -128,7 +128,7 @@ class BranchNode: def encode_internal_node(node: Optional[InternalNode]) -> Extended: """ Encodes a Merkle Trie node into its RLP form. The RLP will then be - serialized into a `Bytes` and hashed unless it is less that 32 bytes + serialized into a `Bytes` and hashed unless it is less than 32 bytes when serialized. This function also accepts `None`, representing the absence of a node, diff --git a/src/ethereum/forks/dao_fork/vm/__init__.py b/src/ethereum/forks/dao_fork/vm/__init__.py index 21585c758c5..e4739cebdef 100644 --- a/src/ethereum/forks/dao_fork/vm/__init__.py +++ b/src/ethereum/forks/dao_fork/vm/__init__.py @@ -60,7 +60,7 @@ class BlockOutput: receipts_trie : `ethereum.fork_types.Root` Trie root of all the receipts in the block. receipt_keys : - Key of all the receipts in the block. + Keys of all the receipts in the block. block_logs : `Bloom` Logs bloom of all the logs included in all the transactions of the block. diff --git a/src/ethereum/forks/dao_fork/vm/instructions/arithmetic.py b/src/ethereum/forks/dao_fork/vm/instructions/arithmetic.py index de5d6ab43d5..b7b1a370ad4 100644 --- a/src/ethereum/forks/dao_fork/vm/instructions/arithmetic.py +++ b/src/ethereum/forks/dao_fork/vm/instructions/arithmetic.py @@ -84,7 +84,7 @@ def sub(evm: Evm) -> None: def mul(evm: Evm) -> None: """ - Multiply the top two elements of the stack, and pushes the result back + Multiplies the top two elements of the stack, and pushes the result back on the stack. Parameters @@ -353,7 +353,7 @@ def signextend(evm: Evm) -> None: # Can't extend any further result = value else: - # U256(0).to_be_bytes() gives b'' instead b'\x00'. + # U256(0).to_be_bytes() gives b'' instead of b'\x00'. value_bytes = Bytes(value.to_be_bytes32()) # Now among the obtained value bytes, consider only # N `least significant bytes`, where N is `byte_num + 1`. diff --git a/src/ethereum/forks/dao_fork/vm/instructions/block.py b/src/ethereum/forks/dao_fork/vm/instructions/block.py index 8b50f1bc07f..0edcbf000d1 100644 --- a/src/ethereum/forks/dao_fork/vm/instructions/block.py +++ b/src/ethereum/forks/dao_fork/vm/instructions/block.py @@ -87,7 +87,7 @@ def coinbase(evm: Evm) -> None: def timestamp(evm: Evm) -> None: """ Push the current block's timestamp onto the stack. Here the timestamp - being referred is actually the unix timestamp in seconds. + being referred to is actually the unix timestamp in seconds. Here the current block refers to the block in which the currently executing transaction/call resides. diff --git a/src/ethereum/forks/dao_fork/vm/instructions/memory.py b/src/ethereum/forks/dao_fork/vm/instructions/memory.py index fdd95188438..3a242ba2f7a 100644 --- a/src/ethereum/forks/dao_fork/vm/instructions/memory.py +++ b/src/ethereum/forks/dao_fork/vm/instructions/memory.py @@ -90,7 +90,7 @@ def mstore8(evm: Evm) -> None: def mload(evm: Evm) -> None: """ - Load word from memory. + Loads a word from memory. Parameters ---------- @@ -120,7 +120,7 @@ def mload(evm: Evm) -> None: def msize(evm: Evm) -> None: """ - Push the size of active memory in bytes onto the stack. + Pushes the size of active memory in bytes onto the stack. Parameters ---------- diff --git a/src/ethereum/forks/dao_fork/vm/instructions/stack.py b/src/ethereum/forks/dao_fork/vm/instructions/stack.py index bdf232db6a8..0fc0d3fe4b5 100644 --- a/src/ethereum/forks/dao_fork/vm/instructions/stack.py +++ b/src/ethereum/forks/dao_fork/vm/instructions/stack.py @@ -23,7 +23,7 @@ def pop(evm: Evm) -> None: """ - Remove item from stack. + Removes an item from the stack. Parameters ---------- @@ -46,7 +46,7 @@ def pop(evm: Evm) -> None: def push_n(evm: Evm, num_bytes: int) -> None: """ - Pushes a N-byte immediate onto the stack. + Pushes an N-byte immediate onto the stack. Parameters ---------- @@ -76,7 +76,7 @@ def push_n(evm: Evm, num_bytes: int) -> None: def dup_n(evm: Evm, item_number: int) -> None: """ - Duplicate the Nth stack item (from top of the stack) to the top of stack. + Duplicates the Nth stack item (from top of the stack) to the top of stack. Parameters ---------- @@ -104,7 +104,7 @@ def dup_n(evm: Evm, item_number: int) -> None: def swap_n(evm: Evm, item_number: int) -> None: """ - Swap the top and the `item_number` element of the stack, where + Swaps the top and the `item_number` element of the stack, where the top of the stack is position zero. If `item_number` is zero, this function does nothing (which should not be diff --git a/src/ethereum/forks/dao_fork/vm/precompiled_contracts/ecrecover.py b/src/ethereum/forks/dao_fork/vm/precompiled_contracts/ecrecover.py index d2eeaf75df1..d8f6602e556 100644 --- a/src/ethereum/forks/dao_fork/vm/precompiled_contracts/ecrecover.py +++ b/src/ethereum/forks/dao_fork/vm/precompiled_contracts/ecrecover.py @@ -8,7 +8,7 @@ Introduction ------------ -Implementation of the ECRECOVER precompiled contract. +Implementation of the `ECRECOVER` precompiled contract. """ from ethereum_types.numeric import U256 diff --git a/src/ethereum/forks/dao_fork/vm/precompiled_contracts/mapping.py b/src/ethereum/forks/dao_fork/vm/precompiled_contracts/mapping.py index 33412f4c283..1d44a6f2e37 100644 --- a/src/ethereum/forks/dao_fork/vm/precompiled_contracts/mapping.py +++ b/src/ethereum/forks/dao_fork/vm/precompiled_contracts/mapping.py @@ -8,7 +8,7 @@ Introduction ------------ -Mapping of precompiled contracts their implementations. +Mapping of precompiled contracts to their implementations. """ from typing import Callable, Dict diff --git a/src/ethereum/forks/dao_fork/vm/runtime.py b/src/ethereum/forks/dao_fork/vm/runtime.py index 505b3488de8..0aa5ddd5e20 100644 --- a/src/ethereum/forks/dao_fork/vm/runtime.py +++ b/src/ethereum/forks/dao_fork/vm/runtime.py @@ -21,7 +21,7 @@ def get_valid_jump_destinations(code: Bytes) -> Set[Uint]: """ - Analyze the evm code to obtain the set of valid jump destinations. + Analyze the EVM code to obtain the set of valid jump destinations. Valid jump destinations are defined as follows: * The jump destination is less than the length of the code. diff --git a/src/ethereum/forks/frontier/blocks.py b/src/ethereum/forks/frontier/blocks.py index 57adc6dae6e..b9fe4f377f5 100644 --- a/src/ethereum/forks/frontier/blocks.py +++ b/src/ethereum/forks/frontier/blocks.py @@ -112,7 +112,7 @@ class Header: number: Uint """ - Block number, (height) in the chain. + Block number (height) in the chain. """ gas_limit: Uint @@ -183,7 +183,7 @@ class Block: header: Header """ The block header containing metadata and cryptographic commitments. Refer - [headers] for more details on the fields included in the header. + to [headers] for more details on the fields included in the header. [headers]: ref:ethereum.forks.frontier.blocks.Header """ diff --git a/src/ethereum/forks/frontier/bloom.py b/src/ethereum/forks/frontier/bloom.py index 8a12ec081dd..0e079df6b39 100644 --- a/src/ethereum/forks/frontier/bloom.py +++ b/src/ethereum/forks/frontier/bloom.py @@ -8,7 +8,7 @@ Introduction ------------ -This modules defines functions for calculating bloom filters of logs. For the +This module defines functions for calculating bloom filters of logs. For the general theory of bloom filters see e.g. `Wikipedia `_. Bloom filters are used to allow for efficient searching of logs by address and/or topic, by rapidly diff --git a/src/ethereum/forks/frontier/state.py b/src/ethereum/forks/frontier/state.py index 8fb03a07fe9..3b6255055d7 100644 --- a/src/ethereum/forks/frontier/state.py +++ b/src/ethereum/forks/frontier/state.py @@ -340,7 +340,7 @@ def account_exists(state: State, address: Address) -> bool: def account_has_code_or_nonce(state: State, address: Address) -> bool: """ - Checks if an account has non zero nonce or non empty code. + Checks if an account has non-zero nonce or non-empty code. Parameters ---------- @@ -352,7 +352,7 @@ def account_has_code_or_nonce(state: State, address: Address) -> bool: Returns ------- has_code_or_nonce : `bool` - True if the account has non zero nonce or non empty code, + True if the account has non-zero nonce or non-empty code, False otherwise. """ @@ -424,7 +424,7 @@ def set_account_balance(state: State, address: Address, amount: U256) -> None: Address of the account whose nonce needs to be incremented. amount: - The amount that needs to set in balance. + The amount that needs to be set in the balance. """ @@ -444,7 +444,7 @@ def touch_account(state: State, address: Address) -> None: The current state. address: - The address of the account that need to initialised. + The address of the account that needs to be initialized. """ if not account_exists(state, address): @@ -481,7 +481,7 @@ def set_code(state: State, address: Address, code: Bytes) -> None: The current state. address: - Address of the account whose code needs to be update. + Address of the account whose code needs to be updated. code: The bytecode that needs to be set. diff --git a/src/ethereum/forks/frontier/trie.py b/src/ethereum/forks/frontier/trie.py index b89039fa90e..55cb19a570d 100644 --- a/src/ethereum/forks/frontier/trie.py +++ b/src/ethereum/forks/frontier/trie.py @@ -127,7 +127,7 @@ class BranchNode: def encode_internal_node(node: Optional[InternalNode]) -> Extended: """ Encodes a Merkle Trie node into its RLP form. The RLP will then be - serialized into a `Bytes` and hashed unless it is less that 32 bytes + serialized into a `Bytes` and hashed unless it is less than 32 bytes when serialized. This function also accepts `None`, representing the absence of a node, diff --git a/src/ethereum/forks/frontier/vm/__init__.py b/src/ethereum/forks/frontier/vm/__init__.py index 69edaa837ec..f7db64a8260 100644 --- a/src/ethereum/forks/frontier/vm/__init__.py +++ b/src/ethereum/forks/frontier/vm/__init__.py @@ -60,7 +60,7 @@ class BlockOutput: receipts_trie : `ethereum.fork_types.Root` Trie root of all the receipts in the block. receipt_keys : - Key of all the receipts in the block. + Keys of all the receipts in the block. block_logs : `Bloom` Logs bloom of all the logs included in all the transactions of the block. diff --git a/src/ethereum/forks/frontier/vm/instructions/arithmetic.py b/src/ethereum/forks/frontier/vm/instructions/arithmetic.py index de5d6ab43d5..b7b1a370ad4 100644 --- a/src/ethereum/forks/frontier/vm/instructions/arithmetic.py +++ b/src/ethereum/forks/frontier/vm/instructions/arithmetic.py @@ -84,7 +84,7 @@ def sub(evm: Evm) -> None: def mul(evm: Evm) -> None: """ - Multiply the top two elements of the stack, and pushes the result back + Multiplies the top two elements of the stack, and pushes the result back on the stack. Parameters @@ -353,7 +353,7 @@ def signextend(evm: Evm) -> None: # Can't extend any further result = value else: - # U256(0).to_be_bytes() gives b'' instead b'\x00'. + # U256(0).to_be_bytes() gives b'' instead of b'\x00'. value_bytes = Bytes(value.to_be_bytes32()) # Now among the obtained value bytes, consider only # N `least significant bytes`, where N is `byte_num + 1`. diff --git a/src/ethereum/forks/frontier/vm/instructions/block.py b/src/ethereum/forks/frontier/vm/instructions/block.py index 8b50f1bc07f..0edcbf000d1 100644 --- a/src/ethereum/forks/frontier/vm/instructions/block.py +++ b/src/ethereum/forks/frontier/vm/instructions/block.py @@ -87,7 +87,7 @@ def coinbase(evm: Evm) -> None: def timestamp(evm: Evm) -> None: """ Push the current block's timestamp onto the stack. Here the timestamp - being referred is actually the unix timestamp in seconds. + being referred to is actually the unix timestamp in seconds. Here the current block refers to the block in which the currently executing transaction/call resides. diff --git a/src/ethereum/forks/frontier/vm/instructions/memory.py b/src/ethereum/forks/frontier/vm/instructions/memory.py index fdd95188438..3a242ba2f7a 100644 --- a/src/ethereum/forks/frontier/vm/instructions/memory.py +++ b/src/ethereum/forks/frontier/vm/instructions/memory.py @@ -90,7 +90,7 @@ def mstore8(evm: Evm) -> None: def mload(evm: Evm) -> None: """ - Load word from memory. + Loads a word from memory. Parameters ---------- @@ -120,7 +120,7 @@ def mload(evm: Evm) -> None: def msize(evm: Evm) -> None: """ - Push the size of active memory in bytes onto the stack. + Pushes the size of active memory in bytes onto the stack. Parameters ---------- diff --git a/src/ethereum/forks/frontier/vm/instructions/stack.py b/src/ethereum/forks/frontier/vm/instructions/stack.py index bdf232db6a8..0fc0d3fe4b5 100644 --- a/src/ethereum/forks/frontier/vm/instructions/stack.py +++ b/src/ethereum/forks/frontier/vm/instructions/stack.py @@ -23,7 +23,7 @@ def pop(evm: Evm) -> None: """ - Remove item from stack. + Removes an item from the stack. Parameters ---------- @@ -46,7 +46,7 @@ def pop(evm: Evm) -> None: def push_n(evm: Evm, num_bytes: int) -> None: """ - Pushes a N-byte immediate onto the stack. + Pushes an N-byte immediate onto the stack. Parameters ---------- @@ -76,7 +76,7 @@ def push_n(evm: Evm, num_bytes: int) -> None: def dup_n(evm: Evm, item_number: int) -> None: """ - Duplicate the Nth stack item (from top of the stack) to the top of stack. + Duplicates the Nth stack item (from top of the stack) to the top of stack. Parameters ---------- @@ -104,7 +104,7 @@ def dup_n(evm: Evm, item_number: int) -> None: def swap_n(evm: Evm, item_number: int) -> None: """ - Swap the top and the `item_number` element of the stack, where + Swaps the top and the `item_number` element of the stack, where the top of the stack is position zero. If `item_number` is zero, this function does nothing (which should not be diff --git a/src/ethereum/forks/frontier/vm/precompiled_contracts/ecrecover.py b/src/ethereum/forks/frontier/vm/precompiled_contracts/ecrecover.py index d2eeaf75df1..d8f6602e556 100644 --- a/src/ethereum/forks/frontier/vm/precompiled_contracts/ecrecover.py +++ b/src/ethereum/forks/frontier/vm/precompiled_contracts/ecrecover.py @@ -8,7 +8,7 @@ Introduction ------------ -Implementation of the ECRECOVER precompiled contract. +Implementation of the `ECRECOVER` precompiled contract. """ from ethereum_types.numeric import U256 diff --git a/src/ethereum/forks/frontier/vm/precompiled_contracts/mapping.py b/src/ethereum/forks/frontier/vm/precompiled_contracts/mapping.py index 33412f4c283..1d44a6f2e37 100644 --- a/src/ethereum/forks/frontier/vm/precompiled_contracts/mapping.py +++ b/src/ethereum/forks/frontier/vm/precompiled_contracts/mapping.py @@ -8,7 +8,7 @@ Introduction ------------ -Mapping of precompiled contracts their implementations. +Mapping of precompiled contracts to their implementations. """ from typing import Callable, Dict diff --git a/src/ethereum/forks/frontier/vm/runtime.py b/src/ethereum/forks/frontier/vm/runtime.py index 505b3488de8..0aa5ddd5e20 100644 --- a/src/ethereum/forks/frontier/vm/runtime.py +++ b/src/ethereum/forks/frontier/vm/runtime.py @@ -21,7 +21,7 @@ def get_valid_jump_destinations(code: Bytes) -> Set[Uint]: """ - Analyze the evm code to obtain the set of valid jump destinations. + Analyze the EVM code to obtain the set of valid jump destinations. Valid jump destinations are defined as follows: * The jump destination is less than the length of the code. diff --git a/src/ethereum/forks/gray_glacier/blocks.py b/src/ethereum/forks/gray_glacier/blocks.py index 2c00953f9f1..82303c764c5 100644 --- a/src/ethereum/forks/gray_glacier/blocks.py +++ b/src/ethereum/forks/gray_glacier/blocks.py @@ -121,7 +121,7 @@ class Header: number: Uint """ - Block number, (height) in the chain. + Block number (height) in the chain. """ gas_limit: Uint @@ -207,7 +207,7 @@ class Block: header: Header """ The block header containing metadata and cryptographic commitments. Refer - [headers] for more details on the fields included in the header. + to [headers] for more details on the fields included in the header. [headers]: ref:ethereum.forks.gray_glacier.blocks.Header """ diff --git a/src/ethereum/forks/gray_glacier/bloom.py b/src/ethereum/forks/gray_glacier/bloom.py index 8a12ec081dd..0e079df6b39 100644 --- a/src/ethereum/forks/gray_glacier/bloom.py +++ b/src/ethereum/forks/gray_glacier/bloom.py @@ -8,7 +8,7 @@ Introduction ------------ -This modules defines functions for calculating bloom filters of logs. For the +This module defines functions for calculating bloom filters of logs. For the general theory of bloom filters see e.g. `Wikipedia `_. Bloom filters are used to allow for efficient searching of logs by address and/or topic, by rapidly diff --git a/src/ethereum/forks/gray_glacier/state.py b/src/ethereum/forks/gray_glacier/state.py index 5fbcf920cd2..91a0b28a1eb 100644 --- a/src/ethereum/forks/gray_glacier/state.py +++ b/src/ethereum/forks/gray_glacier/state.py @@ -367,7 +367,7 @@ def account_exists(state: State, address: Address) -> bool: def account_has_code_or_nonce(state: State, address: Address) -> bool: """ - Checks if an account has non zero nonce or non empty code. + Checks if an account has non-zero nonce or non-empty code. Parameters ---------- @@ -379,7 +379,7 @@ def account_has_code_or_nonce(state: State, address: Address) -> bool: Returns ------- has_code_or_nonce : `bool` - True if the account has non zero nonce or non empty code, + True if the account has non-zero nonce or non-empty code, False otherwise. """ @@ -500,7 +500,7 @@ def set_account_balance(state: State, address: Address, amount: U256) -> None: Address of the account whose nonce needs to be incremented. amount: - The amount that needs to set in balance. + The amount that needs to be set in the balance. """ @@ -520,7 +520,7 @@ def touch_account(state: State, address: Address) -> None: The current state. address: - The address of the account that need to initialised. + The address of the account that needs to be initialized. """ if not account_exists(state, address): @@ -557,7 +557,7 @@ def set_code(state: State, address: Address, code: Bytes) -> None: The current state. address: - Address of the account whose code needs to be update. + Address of the account whose code needs to be updated. code: The bytecode that needs to be set. diff --git a/src/ethereum/forks/gray_glacier/trie.py b/src/ethereum/forks/gray_glacier/trie.py index 4b6297e0864..21044c1a077 100644 --- a/src/ethereum/forks/gray_glacier/trie.py +++ b/src/ethereum/forks/gray_glacier/trie.py @@ -128,7 +128,7 @@ class BranchNode: def encode_internal_node(node: Optional[InternalNode]) -> Extended: """ Encodes a Merkle Trie node into its RLP form. The RLP will then be - serialized into a `Bytes` and hashed unless it is less that 32 bytes + serialized into a `Bytes` and hashed unless it is less than 32 bytes when serialized. This function also accepts `None`, representing the absence of a node, diff --git a/src/ethereum/forks/gray_glacier/vm/__init__.py b/src/ethereum/forks/gray_glacier/vm/__init__.py index 40ee422fb61..ebbb4448291 100644 --- a/src/ethereum/forks/gray_glacier/vm/__init__.py +++ b/src/ethereum/forks/gray_glacier/vm/__init__.py @@ -62,7 +62,7 @@ class BlockOutput: receipts_trie : `ethereum.fork_types.Root` Trie root of all the receipts in the block. receipt_keys : - Key of all the receipts in the block. + Keys of all the receipts in the block. block_logs : `Bloom` Logs bloom of all the logs included in all the transactions of the block. diff --git a/src/ethereum/forks/gray_glacier/vm/gas.py b/src/ethereum/forks/gray_glacier/vm/gas.py index b5c96dea850..4f2dde3b9d7 100644 --- a/src/ethereum/forks/gray_glacier/vm/gas.py +++ b/src/ethereum/forks/gray_glacier/vm/gas.py @@ -211,7 +211,7 @@ def calculate_message_call_gas( account inside a message call. call_stipend : The amount of stipend provided to a message call to execute code while - transferring value(ETH). + transferring value (ETH). Returns ------- diff --git a/src/ethereum/forks/gray_glacier/vm/instructions/arithmetic.py b/src/ethereum/forks/gray_glacier/vm/instructions/arithmetic.py index de5d6ab43d5..b7b1a370ad4 100644 --- a/src/ethereum/forks/gray_glacier/vm/instructions/arithmetic.py +++ b/src/ethereum/forks/gray_glacier/vm/instructions/arithmetic.py @@ -84,7 +84,7 @@ def sub(evm: Evm) -> None: def mul(evm: Evm) -> None: """ - Multiply the top two elements of the stack, and pushes the result back + Multiplies the top two elements of the stack, and pushes the result back on the stack. Parameters @@ -353,7 +353,7 @@ def signextend(evm: Evm) -> None: # Can't extend any further result = value else: - # U256(0).to_be_bytes() gives b'' instead b'\x00'. + # U256(0).to_be_bytes() gives b'' instead of b'\x00'. value_bytes = Bytes(value.to_be_bytes32()) # Now among the obtained value bytes, consider only # N `least significant bytes`, where N is `byte_num + 1`. diff --git a/src/ethereum/forks/gray_glacier/vm/instructions/block.py b/src/ethereum/forks/gray_glacier/vm/instructions/block.py index ecbeac10f42..bbf01739ff2 100644 --- a/src/ethereum/forks/gray_glacier/vm/instructions/block.py +++ b/src/ethereum/forks/gray_glacier/vm/instructions/block.py @@ -87,7 +87,7 @@ def coinbase(evm: Evm) -> None: def timestamp(evm: Evm) -> None: """ Push the current block's timestamp onto the stack. Here the timestamp - being referred is actually the unix timestamp in seconds. + being referred to is actually the unix timestamp in seconds. Here the current block refers to the block in which the currently executing transaction/call resides. diff --git a/src/ethereum/forks/gray_glacier/vm/instructions/environment.py b/src/ethereum/forks/gray_glacier/vm/instructions/environment.py index 1abfaeafa9c..2a7b4346619 100644 --- a/src/ethereum/forks/gray_glacier/vm/instructions/environment.py +++ b/src/ethereum/forks/gray_glacier/vm/instructions/environment.py @@ -423,7 +423,7 @@ def returndatasize(evm: Evm) -> None: def returndatacopy(evm: Evm) -> None: """ - Copies data from the return data buffer code to memory. + Copies data from the return data buffer to memory. Parameters ---------- diff --git a/src/ethereum/forks/gray_glacier/vm/instructions/memory.py b/src/ethereum/forks/gray_glacier/vm/instructions/memory.py index fdd95188438..3a242ba2f7a 100644 --- a/src/ethereum/forks/gray_glacier/vm/instructions/memory.py +++ b/src/ethereum/forks/gray_glacier/vm/instructions/memory.py @@ -90,7 +90,7 @@ def mstore8(evm: Evm) -> None: def mload(evm: Evm) -> None: """ - Load word from memory. + Loads a word from memory. Parameters ---------- @@ -120,7 +120,7 @@ def mload(evm: Evm) -> None: def msize(evm: Evm) -> None: """ - Push the size of active memory in bytes onto the stack. + Pushes the size of active memory in bytes onto the stack. Parameters ---------- diff --git a/src/ethereum/forks/gray_glacier/vm/instructions/stack.py b/src/ethereum/forks/gray_glacier/vm/instructions/stack.py index bdf232db6a8..0fc0d3fe4b5 100644 --- a/src/ethereum/forks/gray_glacier/vm/instructions/stack.py +++ b/src/ethereum/forks/gray_glacier/vm/instructions/stack.py @@ -23,7 +23,7 @@ def pop(evm: Evm) -> None: """ - Remove item from stack. + Removes an item from the stack. Parameters ---------- @@ -46,7 +46,7 @@ def pop(evm: Evm) -> None: def push_n(evm: Evm, num_bytes: int) -> None: """ - Pushes a N-byte immediate onto the stack. + Pushes an N-byte immediate onto the stack. Parameters ---------- @@ -76,7 +76,7 @@ def push_n(evm: Evm, num_bytes: int) -> None: def dup_n(evm: Evm, item_number: int) -> None: """ - Duplicate the Nth stack item (from top of the stack) to the top of stack. + Duplicates the Nth stack item (from top of the stack) to the top of stack. Parameters ---------- @@ -104,7 +104,7 @@ def dup_n(evm: Evm, item_number: int) -> None: def swap_n(evm: Evm, item_number: int) -> None: """ - Swap the top and the `item_number` element of the stack, where + Swaps the top and the `item_number` element of the stack, where the top of the stack is position zero. If `item_number` is zero, this function does nothing (which should not be diff --git a/src/ethereum/forks/gray_glacier/vm/instructions/system.py b/src/ethereum/forks/gray_glacier/vm/instructions/system.py index 2ef31f9595e..44ba77a073c 100644 --- a/src/ethereum/forks/gray_glacier/vm/instructions/system.py +++ b/src/ethereum/forks/gray_glacier/vm/instructions/system.py @@ -179,8 +179,8 @@ def create2(evm: Evm) -> None: """ Creates a new account with associated code. - It's similar to CREATE opcode except that the address of new account - depends on the init_code instead of the nonce of sender. + It's similar to the CREATE opcode except that the address of the new + account depends on the init_code instead of the nonce of sender. Parameters ---------- diff --git a/src/ethereum/forks/gray_glacier/vm/precompiled_contracts/ecrecover.py b/src/ethereum/forks/gray_glacier/vm/precompiled_contracts/ecrecover.py index d2eeaf75df1..d8f6602e556 100644 --- a/src/ethereum/forks/gray_glacier/vm/precompiled_contracts/ecrecover.py +++ b/src/ethereum/forks/gray_glacier/vm/precompiled_contracts/ecrecover.py @@ -8,7 +8,7 @@ Introduction ------------ -Implementation of the ECRECOVER precompiled contract. +Implementation of the `ECRECOVER` precompiled contract. """ from ethereum_types.numeric import U256 diff --git a/src/ethereum/forks/gray_glacier/vm/precompiled_contracts/mapping.py b/src/ethereum/forks/gray_glacier/vm/precompiled_contracts/mapping.py index 827c44cfac7..44013f70e89 100644 --- a/src/ethereum/forks/gray_glacier/vm/precompiled_contracts/mapping.py +++ b/src/ethereum/forks/gray_glacier/vm/precompiled_contracts/mapping.py @@ -8,7 +8,7 @@ Introduction ------------ -Mapping of precompiled contracts their implementations. +Mapping of precompiled contracts to their implementations. """ from typing import Callable, Dict diff --git a/src/ethereum/forks/gray_glacier/vm/precompiled_contracts/modexp.py b/src/ethereum/forks/gray_glacier/vm/precompiled_contracts/modexp.py index 462341f69fd..755a396ddac 100644 --- a/src/ethereum/forks/gray_glacier/vm/precompiled_contracts/modexp.py +++ b/src/ethereum/forks/gray_glacier/vm/precompiled_contracts/modexp.py @@ -23,7 +23,7 @@ def modexp(evm: Evm) -> None: """ - Calculates `(base**exp) % modulus` for arbitrary sized `base`, `exp` and. + Calculates `(base**exp) % modulus` for arbitrary sized `base`, `exp` and `modulus`. The return value is the same length as the modulus. """ data = evm.message.data diff --git a/src/ethereum/forks/gray_glacier/vm/runtime.py b/src/ethereum/forks/gray_glacier/vm/runtime.py index 505b3488de8..0aa5ddd5e20 100644 --- a/src/ethereum/forks/gray_glacier/vm/runtime.py +++ b/src/ethereum/forks/gray_glacier/vm/runtime.py @@ -21,7 +21,7 @@ def get_valid_jump_destinations(code: Bytes) -> Set[Uint]: """ - Analyze the evm code to obtain the set of valid jump destinations. + Analyze the EVM code to obtain the set of valid jump destinations. Valid jump destinations are defined as follows: * The jump destination is less than the length of the code. diff --git a/src/ethereum/forks/homestead/blocks.py b/src/ethereum/forks/homestead/blocks.py index fd671bf00f8..2b71f1d74ce 100644 --- a/src/ethereum/forks/homestead/blocks.py +++ b/src/ethereum/forks/homestead/blocks.py @@ -112,7 +112,7 @@ class Header: number: Uint """ - Block number, (height) in the chain. + Block number (height) in the chain. """ gas_limit: Uint @@ -183,7 +183,7 @@ class Block: header: Header """ The block header containing metadata and cryptographic commitments. Refer - [headers] for more details on the fields included in the header. + to [headers] for more details on the fields included in the header. [headers]: ref:ethereum.forks.homestead.blocks.Header """ diff --git a/src/ethereum/forks/homestead/bloom.py b/src/ethereum/forks/homestead/bloom.py index 8a12ec081dd..0e079df6b39 100644 --- a/src/ethereum/forks/homestead/bloom.py +++ b/src/ethereum/forks/homestead/bloom.py @@ -8,7 +8,7 @@ Introduction ------------ -This modules defines functions for calculating bloom filters of logs. For the +This module defines functions for calculating bloom filters of logs. For the general theory of bloom filters see e.g. `Wikipedia `_. Bloom filters are used to allow for efficient searching of logs by address and/or topic, by rapidly diff --git a/src/ethereum/forks/homestead/state.py b/src/ethereum/forks/homestead/state.py index 8fb03a07fe9..3b6255055d7 100644 --- a/src/ethereum/forks/homestead/state.py +++ b/src/ethereum/forks/homestead/state.py @@ -340,7 +340,7 @@ def account_exists(state: State, address: Address) -> bool: def account_has_code_or_nonce(state: State, address: Address) -> bool: """ - Checks if an account has non zero nonce or non empty code. + Checks if an account has non-zero nonce or non-empty code. Parameters ---------- @@ -352,7 +352,7 @@ def account_has_code_or_nonce(state: State, address: Address) -> bool: Returns ------- has_code_or_nonce : `bool` - True if the account has non zero nonce or non empty code, + True if the account has non-zero nonce or non-empty code, False otherwise. """ @@ -424,7 +424,7 @@ def set_account_balance(state: State, address: Address, amount: U256) -> None: Address of the account whose nonce needs to be incremented. amount: - The amount that needs to set in balance. + The amount that needs to be set in the balance. """ @@ -444,7 +444,7 @@ def touch_account(state: State, address: Address) -> None: The current state. address: - The address of the account that need to initialised. + The address of the account that needs to be initialized. """ if not account_exists(state, address): @@ -481,7 +481,7 @@ def set_code(state: State, address: Address, code: Bytes) -> None: The current state. address: - Address of the account whose code needs to be update. + Address of the account whose code needs to be updated. code: The bytecode that needs to be set. diff --git a/src/ethereum/forks/homestead/trie.py b/src/ethereum/forks/homestead/trie.py index 1a597718982..331802a660b 100644 --- a/src/ethereum/forks/homestead/trie.py +++ b/src/ethereum/forks/homestead/trie.py @@ -128,7 +128,7 @@ class BranchNode: def encode_internal_node(node: Optional[InternalNode]) -> Extended: """ Encodes a Merkle Trie node into its RLP form. The RLP will then be - serialized into a `Bytes` and hashed unless it is less that 32 bytes + serialized into a `Bytes` and hashed unless it is less than 32 bytes when serialized. This function also accepts `None`, representing the absence of a node, diff --git a/src/ethereum/forks/homestead/vm/__init__.py b/src/ethereum/forks/homestead/vm/__init__.py index 21585c758c5..e4739cebdef 100644 --- a/src/ethereum/forks/homestead/vm/__init__.py +++ b/src/ethereum/forks/homestead/vm/__init__.py @@ -60,7 +60,7 @@ class BlockOutput: receipts_trie : `ethereum.fork_types.Root` Trie root of all the receipts in the block. receipt_keys : - Key of all the receipts in the block. + Keys of all the receipts in the block. block_logs : `Bloom` Logs bloom of all the logs included in all the transactions of the block. diff --git a/src/ethereum/forks/homestead/vm/instructions/arithmetic.py b/src/ethereum/forks/homestead/vm/instructions/arithmetic.py index de5d6ab43d5..b7b1a370ad4 100644 --- a/src/ethereum/forks/homestead/vm/instructions/arithmetic.py +++ b/src/ethereum/forks/homestead/vm/instructions/arithmetic.py @@ -84,7 +84,7 @@ def sub(evm: Evm) -> None: def mul(evm: Evm) -> None: """ - Multiply the top two elements of the stack, and pushes the result back + Multiplies the top two elements of the stack, and pushes the result back on the stack. Parameters @@ -353,7 +353,7 @@ def signextend(evm: Evm) -> None: # Can't extend any further result = value else: - # U256(0).to_be_bytes() gives b'' instead b'\x00'. + # U256(0).to_be_bytes() gives b'' instead of b'\x00'. value_bytes = Bytes(value.to_be_bytes32()) # Now among the obtained value bytes, consider only # N `least significant bytes`, where N is `byte_num + 1`. diff --git a/src/ethereum/forks/homestead/vm/instructions/block.py b/src/ethereum/forks/homestead/vm/instructions/block.py index 8b50f1bc07f..0edcbf000d1 100644 --- a/src/ethereum/forks/homestead/vm/instructions/block.py +++ b/src/ethereum/forks/homestead/vm/instructions/block.py @@ -87,7 +87,7 @@ def coinbase(evm: Evm) -> None: def timestamp(evm: Evm) -> None: """ Push the current block's timestamp onto the stack. Here the timestamp - being referred is actually the unix timestamp in seconds. + being referred to is actually the unix timestamp in seconds. Here the current block refers to the block in which the currently executing transaction/call resides. diff --git a/src/ethereum/forks/homestead/vm/instructions/memory.py b/src/ethereum/forks/homestead/vm/instructions/memory.py index fdd95188438..3a242ba2f7a 100644 --- a/src/ethereum/forks/homestead/vm/instructions/memory.py +++ b/src/ethereum/forks/homestead/vm/instructions/memory.py @@ -90,7 +90,7 @@ def mstore8(evm: Evm) -> None: def mload(evm: Evm) -> None: """ - Load word from memory. + Loads a word from memory. Parameters ---------- @@ -120,7 +120,7 @@ def mload(evm: Evm) -> None: def msize(evm: Evm) -> None: """ - Push the size of active memory in bytes onto the stack. + Pushes the size of active memory in bytes onto the stack. Parameters ---------- diff --git a/src/ethereum/forks/homestead/vm/instructions/stack.py b/src/ethereum/forks/homestead/vm/instructions/stack.py index bdf232db6a8..0fc0d3fe4b5 100644 --- a/src/ethereum/forks/homestead/vm/instructions/stack.py +++ b/src/ethereum/forks/homestead/vm/instructions/stack.py @@ -23,7 +23,7 @@ def pop(evm: Evm) -> None: """ - Remove item from stack. + Removes an item from the stack. Parameters ---------- @@ -46,7 +46,7 @@ def pop(evm: Evm) -> None: def push_n(evm: Evm, num_bytes: int) -> None: """ - Pushes a N-byte immediate onto the stack. + Pushes an N-byte immediate onto the stack. Parameters ---------- @@ -76,7 +76,7 @@ def push_n(evm: Evm, num_bytes: int) -> None: def dup_n(evm: Evm, item_number: int) -> None: """ - Duplicate the Nth stack item (from top of the stack) to the top of stack. + Duplicates the Nth stack item (from top of the stack) to the top of stack. Parameters ---------- @@ -104,7 +104,7 @@ def dup_n(evm: Evm, item_number: int) -> None: def swap_n(evm: Evm, item_number: int) -> None: """ - Swap the top and the `item_number` element of the stack, where + Swaps the top and the `item_number` element of the stack, where the top of the stack is position zero. If `item_number` is zero, this function does nothing (which should not be diff --git a/src/ethereum/forks/homestead/vm/precompiled_contracts/ecrecover.py b/src/ethereum/forks/homestead/vm/precompiled_contracts/ecrecover.py index d2eeaf75df1..d8f6602e556 100644 --- a/src/ethereum/forks/homestead/vm/precompiled_contracts/ecrecover.py +++ b/src/ethereum/forks/homestead/vm/precompiled_contracts/ecrecover.py @@ -8,7 +8,7 @@ Introduction ------------ -Implementation of the ECRECOVER precompiled contract. +Implementation of the `ECRECOVER` precompiled contract. """ from ethereum_types.numeric import U256 diff --git a/src/ethereum/forks/homestead/vm/precompiled_contracts/mapping.py b/src/ethereum/forks/homestead/vm/precompiled_contracts/mapping.py index 33412f4c283..1d44a6f2e37 100644 --- a/src/ethereum/forks/homestead/vm/precompiled_contracts/mapping.py +++ b/src/ethereum/forks/homestead/vm/precompiled_contracts/mapping.py @@ -8,7 +8,7 @@ Introduction ------------ -Mapping of precompiled contracts their implementations. +Mapping of precompiled contracts to their implementations. """ from typing import Callable, Dict diff --git a/src/ethereum/forks/homestead/vm/runtime.py b/src/ethereum/forks/homestead/vm/runtime.py index 505b3488de8..0aa5ddd5e20 100644 --- a/src/ethereum/forks/homestead/vm/runtime.py +++ b/src/ethereum/forks/homestead/vm/runtime.py @@ -21,7 +21,7 @@ def get_valid_jump_destinations(code: Bytes) -> Set[Uint]: """ - Analyze the evm code to obtain the set of valid jump destinations. + Analyze the EVM code to obtain the set of valid jump destinations. Valid jump destinations are defined as follows: * The jump destination is less than the length of the code. diff --git a/src/ethereum/forks/istanbul/blocks.py b/src/ethereum/forks/istanbul/blocks.py index 06dc59ab24e..e3f124bcd58 100644 --- a/src/ethereum/forks/istanbul/blocks.py +++ b/src/ethereum/forks/istanbul/blocks.py @@ -112,7 +112,7 @@ class Header: number: Uint """ - Block number, (height) in the chain. + Block number (height) in the chain. """ gas_limit: Uint @@ -183,7 +183,7 @@ class Block: header: Header """ The block header containing metadata and cryptographic commitments. Refer - [headers] for more details on the fields included in the header. + to [headers] for more details on the fields included in the header. [headers]: ref:ethereum.forks.istanbul.blocks.Header """ diff --git a/src/ethereum/forks/istanbul/bloom.py b/src/ethereum/forks/istanbul/bloom.py index 8a12ec081dd..0e079df6b39 100644 --- a/src/ethereum/forks/istanbul/bloom.py +++ b/src/ethereum/forks/istanbul/bloom.py @@ -8,7 +8,7 @@ Introduction ------------ -This modules defines functions for calculating bloom filters of logs. For the +This module defines functions for calculating bloom filters of logs. For the general theory of bloom filters see e.g. `Wikipedia `_. Bloom filters are used to allow for efficient searching of logs by address and/or topic, by rapidly diff --git a/src/ethereum/forks/istanbul/state.py b/src/ethereum/forks/istanbul/state.py index 5fbcf920cd2..91a0b28a1eb 100644 --- a/src/ethereum/forks/istanbul/state.py +++ b/src/ethereum/forks/istanbul/state.py @@ -367,7 +367,7 @@ def account_exists(state: State, address: Address) -> bool: def account_has_code_or_nonce(state: State, address: Address) -> bool: """ - Checks if an account has non zero nonce or non empty code. + Checks if an account has non-zero nonce or non-empty code. Parameters ---------- @@ -379,7 +379,7 @@ def account_has_code_or_nonce(state: State, address: Address) -> bool: Returns ------- has_code_or_nonce : `bool` - True if the account has non zero nonce or non empty code, + True if the account has non-zero nonce or non-empty code, False otherwise. """ @@ -500,7 +500,7 @@ def set_account_balance(state: State, address: Address, amount: U256) -> None: Address of the account whose nonce needs to be incremented. amount: - The amount that needs to set in balance. + The amount that needs to be set in the balance. """ @@ -520,7 +520,7 @@ def touch_account(state: State, address: Address) -> None: The current state. address: - The address of the account that need to initialised. + The address of the account that needs to be initialized. """ if not account_exists(state, address): @@ -557,7 +557,7 @@ def set_code(state: State, address: Address, code: Bytes) -> None: The current state. address: - Address of the account whose code needs to be update. + Address of the account whose code needs to be updated. code: The bytecode that needs to be set. diff --git a/src/ethereum/forks/istanbul/trie.py b/src/ethereum/forks/istanbul/trie.py index 74c118fda32..a040432bd70 100644 --- a/src/ethereum/forks/istanbul/trie.py +++ b/src/ethereum/forks/istanbul/trie.py @@ -128,7 +128,7 @@ class BranchNode: def encode_internal_node(node: Optional[InternalNode]) -> Extended: """ Encodes a Merkle Trie node into its RLP form. The RLP will then be - serialized into a `Bytes` and hashed unless it is less that 32 bytes + serialized into a `Bytes` and hashed unless it is less than 32 bytes when serialized. This function also accepts `None`, representing the absence of a node, diff --git a/src/ethereum/forks/istanbul/vm/__init__.py b/src/ethereum/forks/istanbul/vm/__init__.py index 6cdd9c9bc74..068648ac368 100644 --- a/src/ethereum/forks/istanbul/vm/__init__.py +++ b/src/ethereum/forks/istanbul/vm/__init__.py @@ -61,7 +61,7 @@ class BlockOutput: receipts_trie : `ethereum.fork_types.Root` Trie root of all the receipts in the block. receipt_keys : - Key of all the receipts in the block. + Keys of all the receipts in the block. block_logs : `Bloom` Logs bloom of all the logs included in all the transactions of the block. diff --git a/src/ethereum/forks/istanbul/vm/gas.py b/src/ethereum/forks/istanbul/vm/gas.py index 93cacf71abc..af180fa654c 100644 --- a/src/ethereum/forks/istanbul/vm/gas.py +++ b/src/ethereum/forks/istanbul/vm/gas.py @@ -214,7 +214,7 @@ def calculate_message_call_gas( account inside a message call. call_stipend : The amount of stipend provided to a message call to execute code while - transferring value(ETH). + transferring value (ETH). Returns ------- diff --git a/src/ethereum/forks/istanbul/vm/instructions/arithmetic.py b/src/ethereum/forks/istanbul/vm/instructions/arithmetic.py index de5d6ab43d5..b7b1a370ad4 100644 --- a/src/ethereum/forks/istanbul/vm/instructions/arithmetic.py +++ b/src/ethereum/forks/istanbul/vm/instructions/arithmetic.py @@ -84,7 +84,7 @@ def sub(evm: Evm) -> None: def mul(evm: Evm) -> None: """ - Multiply the top two elements of the stack, and pushes the result back + Multiplies the top two elements of the stack, and pushes the result back on the stack. Parameters @@ -353,7 +353,7 @@ def signextend(evm: Evm) -> None: # Can't extend any further result = value else: - # U256(0).to_be_bytes() gives b'' instead b'\x00'. + # U256(0).to_be_bytes() gives b'' instead of b'\x00'. value_bytes = Bytes(value.to_be_bytes32()) # Now among the obtained value bytes, consider only # N `least significant bytes`, where N is `byte_num + 1`. diff --git a/src/ethereum/forks/istanbul/vm/instructions/block.py b/src/ethereum/forks/istanbul/vm/instructions/block.py index ecbeac10f42..bbf01739ff2 100644 --- a/src/ethereum/forks/istanbul/vm/instructions/block.py +++ b/src/ethereum/forks/istanbul/vm/instructions/block.py @@ -87,7 +87,7 @@ def coinbase(evm: Evm) -> None: def timestamp(evm: Evm) -> None: """ Push the current block's timestamp onto the stack. Here the timestamp - being referred is actually the unix timestamp in seconds. + being referred to is actually the unix timestamp in seconds. Here the current block refers to the block in which the currently executing transaction/call resides. diff --git a/src/ethereum/forks/istanbul/vm/instructions/environment.py b/src/ethereum/forks/istanbul/vm/instructions/environment.py index a854355eb4f..f7766715412 100644 --- a/src/ethereum/forks/istanbul/vm/instructions/environment.py +++ b/src/ethereum/forks/istanbul/vm/instructions/environment.py @@ -407,7 +407,7 @@ def returndatasize(evm: Evm) -> None: def returndatacopy(evm: Evm) -> None: """ - Copies data from the return data buffer code to memory. + Copies data from the return data buffer to memory. Parameters ---------- diff --git a/src/ethereum/forks/istanbul/vm/instructions/memory.py b/src/ethereum/forks/istanbul/vm/instructions/memory.py index fdd95188438..3a242ba2f7a 100644 --- a/src/ethereum/forks/istanbul/vm/instructions/memory.py +++ b/src/ethereum/forks/istanbul/vm/instructions/memory.py @@ -90,7 +90,7 @@ def mstore8(evm: Evm) -> None: def mload(evm: Evm) -> None: """ - Load word from memory. + Loads a word from memory. Parameters ---------- @@ -120,7 +120,7 @@ def mload(evm: Evm) -> None: def msize(evm: Evm) -> None: """ - Push the size of active memory in bytes onto the stack. + Pushes the size of active memory in bytes onto the stack. Parameters ---------- diff --git a/src/ethereum/forks/istanbul/vm/instructions/stack.py b/src/ethereum/forks/istanbul/vm/instructions/stack.py index bdf232db6a8..0fc0d3fe4b5 100644 --- a/src/ethereum/forks/istanbul/vm/instructions/stack.py +++ b/src/ethereum/forks/istanbul/vm/instructions/stack.py @@ -23,7 +23,7 @@ def pop(evm: Evm) -> None: """ - Remove item from stack. + Removes an item from the stack. Parameters ---------- @@ -46,7 +46,7 @@ def pop(evm: Evm) -> None: def push_n(evm: Evm, num_bytes: int) -> None: """ - Pushes a N-byte immediate onto the stack. + Pushes an N-byte immediate onto the stack. Parameters ---------- @@ -76,7 +76,7 @@ def push_n(evm: Evm, num_bytes: int) -> None: def dup_n(evm: Evm, item_number: int) -> None: """ - Duplicate the Nth stack item (from top of the stack) to the top of stack. + Duplicates the Nth stack item (from top of the stack) to the top of stack. Parameters ---------- @@ -104,7 +104,7 @@ def dup_n(evm: Evm, item_number: int) -> None: def swap_n(evm: Evm, item_number: int) -> None: """ - Swap the top and the `item_number` element of the stack, where + Swaps the top and the `item_number` element of the stack, where the top of the stack is position zero. If `item_number` is zero, this function does nothing (which should not be diff --git a/src/ethereum/forks/istanbul/vm/instructions/system.py b/src/ethereum/forks/istanbul/vm/instructions/system.py index fadd9634172..af2527d31cc 100644 --- a/src/ethereum/forks/istanbul/vm/instructions/system.py +++ b/src/ethereum/forks/istanbul/vm/instructions/system.py @@ -179,8 +179,8 @@ def create2(evm: Evm) -> None: """ Creates a new account with associated code. - It's similar to CREATE opcode except that the address of new account - depends on the init_code instead of the nonce of sender. + It's similar to the CREATE opcode except that the address of the new + account depends on the init_code instead of the nonce of sender. Parameters ---------- diff --git a/src/ethereum/forks/istanbul/vm/precompiled_contracts/ecrecover.py b/src/ethereum/forks/istanbul/vm/precompiled_contracts/ecrecover.py index d2eeaf75df1..d8f6602e556 100644 --- a/src/ethereum/forks/istanbul/vm/precompiled_contracts/ecrecover.py +++ b/src/ethereum/forks/istanbul/vm/precompiled_contracts/ecrecover.py @@ -8,7 +8,7 @@ Introduction ------------ -Implementation of the ECRECOVER precompiled contract. +Implementation of the `ECRECOVER` precompiled contract. """ from ethereum_types.numeric import U256 diff --git a/src/ethereum/forks/istanbul/vm/precompiled_contracts/mapping.py b/src/ethereum/forks/istanbul/vm/precompiled_contracts/mapping.py index 827c44cfac7..44013f70e89 100644 --- a/src/ethereum/forks/istanbul/vm/precompiled_contracts/mapping.py +++ b/src/ethereum/forks/istanbul/vm/precompiled_contracts/mapping.py @@ -8,7 +8,7 @@ Introduction ------------ -Mapping of precompiled contracts their implementations. +Mapping of precompiled contracts to their implementations. """ from typing import Callable, Dict diff --git a/src/ethereum/forks/istanbul/vm/precompiled_contracts/modexp.py b/src/ethereum/forks/istanbul/vm/precompiled_contracts/modexp.py index fd0501616c1..8ed5c851a72 100644 --- a/src/ethereum/forks/istanbul/vm/precompiled_contracts/modexp.py +++ b/src/ethereum/forks/istanbul/vm/precompiled_contracts/modexp.py @@ -23,7 +23,7 @@ def modexp(evm: Evm) -> None: """ - Calculates `(base**exp) % modulus` for arbitrary sized `base`, `exp` and. + Calculates `(base**exp) % modulus` for arbitrary sized `base`, `exp` and `modulus`. The return value is the same length as the modulus. """ data = evm.message.data diff --git a/src/ethereum/forks/istanbul/vm/runtime.py b/src/ethereum/forks/istanbul/vm/runtime.py index 505b3488de8..0aa5ddd5e20 100644 --- a/src/ethereum/forks/istanbul/vm/runtime.py +++ b/src/ethereum/forks/istanbul/vm/runtime.py @@ -21,7 +21,7 @@ def get_valid_jump_destinations(code: Bytes) -> Set[Uint]: """ - Analyze the evm code to obtain the set of valid jump destinations. + Analyze the EVM code to obtain the set of valid jump destinations. Valid jump destinations are defined as follows: * The jump destination is less than the length of the code. diff --git a/src/ethereum/forks/london/blocks.py b/src/ethereum/forks/london/blocks.py index 3cae46582dc..20971a661c0 100644 --- a/src/ethereum/forks/london/blocks.py +++ b/src/ethereum/forks/london/blocks.py @@ -121,7 +121,7 @@ class Header: number: Uint """ - Block number, (height) in the chain. + Block number (height) in the chain. """ gas_limit: Uint @@ -207,7 +207,7 @@ class Block: header: Header """ The block header containing metadata and cryptographic commitments. Refer - [headers] for more details on the fields included in the header. + to [headers] for more details on the fields included in the header. [headers]: ref:ethereum.forks.london.blocks.Header """ diff --git a/src/ethereum/forks/london/bloom.py b/src/ethereum/forks/london/bloom.py index 8a12ec081dd..0e079df6b39 100644 --- a/src/ethereum/forks/london/bloom.py +++ b/src/ethereum/forks/london/bloom.py @@ -8,7 +8,7 @@ Introduction ------------ -This modules defines functions for calculating bloom filters of logs. For the +This module defines functions for calculating bloom filters of logs. For the general theory of bloom filters see e.g. `Wikipedia `_. Bloom filters are used to allow for efficient searching of logs by address and/or topic, by rapidly diff --git a/src/ethereum/forks/london/state.py b/src/ethereum/forks/london/state.py index 5fbcf920cd2..91a0b28a1eb 100644 --- a/src/ethereum/forks/london/state.py +++ b/src/ethereum/forks/london/state.py @@ -367,7 +367,7 @@ def account_exists(state: State, address: Address) -> bool: def account_has_code_or_nonce(state: State, address: Address) -> bool: """ - Checks if an account has non zero nonce or non empty code. + Checks if an account has non-zero nonce or non-empty code. Parameters ---------- @@ -379,7 +379,7 @@ def account_has_code_or_nonce(state: State, address: Address) -> bool: Returns ------- has_code_or_nonce : `bool` - True if the account has non zero nonce or non empty code, + True if the account has non-zero nonce or non-empty code, False otherwise. """ @@ -500,7 +500,7 @@ def set_account_balance(state: State, address: Address, amount: U256) -> None: Address of the account whose nonce needs to be incremented. amount: - The amount that needs to set in balance. + The amount that needs to be set in the balance. """ @@ -520,7 +520,7 @@ def touch_account(state: State, address: Address) -> None: The current state. address: - The address of the account that need to initialised. + The address of the account that needs to be initialized. """ if not account_exists(state, address): @@ -557,7 +557,7 @@ def set_code(state: State, address: Address, code: Bytes) -> None: The current state. address: - Address of the account whose code needs to be update. + Address of the account whose code needs to be updated. code: The bytecode that needs to be set. diff --git a/src/ethereum/forks/london/trie.py b/src/ethereum/forks/london/trie.py index 4e0452c7408..0deeb2d3c9e 100644 --- a/src/ethereum/forks/london/trie.py +++ b/src/ethereum/forks/london/trie.py @@ -128,7 +128,7 @@ class BranchNode: def encode_internal_node(node: Optional[InternalNode]) -> Extended: """ Encodes a Merkle Trie node into its RLP form. The RLP will then be - serialized into a `Bytes` and hashed unless it is less that 32 bytes + serialized into a `Bytes` and hashed unless it is less than 32 bytes when serialized. This function also accepts `None`, representing the absence of a node, diff --git a/src/ethereum/forks/london/vm/__init__.py b/src/ethereum/forks/london/vm/__init__.py index 40ee422fb61..ebbb4448291 100644 --- a/src/ethereum/forks/london/vm/__init__.py +++ b/src/ethereum/forks/london/vm/__init__.py @@ -62,7 +62,7 @@ class BlockOutput: receipts_trie : `ethereum.fork_types.Root` Trie root of all the receipts in the block. receipt_keys : - Key of all the receipts in the block. + Keys of all the receipts in the block. block_logs : `Bloom` Logs bloom of all the logs included in all the transactions of the block. diff --git a/src/ethereum/forks/london/vm/gas.py b/src/ethereum/forks/london/vm/gas.py index b5c96dea850..4f2dde3b9d7 100644 --- a/src/ethereum/forks/london/vm/gas.py +++ b/src/ethereum/forks/london/vm/gas.py @@ -211,7 +211,7 @@ def calculate_message_call_gas( account inside a message call. call_stipend : The amount of stipend provided to a message call to execute code while - transferring value(ETH). + transferring value (ETH). Returns ------- diff --git a/src/ethereum/forks/london/vm/instructions/arithmetic.py b/src/ethereum/forks/london/vm/instructions/arithmetic.py index de5d6ab43d5..b7b1a370ad4 100644 --- a/src/ethereum/forks/london/vm/instructions/arithmetic.py +++ b/src/ethereum/forks/london/vm/instructions/arithmetic.py @@ -84,7 +84,7 @@ def sub(evm: Evm) -> None: def mul(evm: Evm) -> None: """ - Multiply the top two elements of the stack, and pushes the result back + Multiplies the top two elements of the stack, and pushes the result back on the stack. Parameters @@ -353,7 +353,7 @@ def signextend(evm: Evm) -> None: # Can't extend any further result = value else: - # U256(0).to_be_bytes() gives b'' instead b'\x00'. + # U256(0).to_be_bytes() gives b'' instead of b'\x00'. value_bytes = Bytes(value.to_be_bytes32()) # Now among the obtained value bytes, consider only # N `least significant bytes`, where N is `byte_num + 1`. diff --git a/src/ethereum/forks/london/vm/instructions/block.py b/src/ethereum/forks/london/vm/instructions/block.py index ecbeac10f42..bbf01739ff2 100644 --- a/src/ethereum/forks/london/vm/instructions/block.py +++ b/src/ethereum/forks/london/vm/instructions/block.py @@ -87,7 +87,7 @@ def coinbase(evm: Evm) -> None: def timestamp(evm: Evm) -> None: """ Push the current block's timestamp onto the stack. Here the timestamp - being referred is actually the unix timestamp in seconds. + being referred to is actually the unix timestamp in seconds. Here the current block refers to the block in which the currently executing transaction/call resides. diff --git a/src/ethereum/forks/london/vm/instructions/environment.py b/src/ethereum/forks/london/vm/instructions/environment.py index 1abfaeafa9c..2a7b4346619 100644 --- a/src/ethereum/forks/london/vm/instructions/environment.py +++ b/src/ethereum/forks/london/vm/instructions/environment.py @@ -423,7 +423,7 @@ def returndatasize(evm: Evm) -> None: def returndatacopy(evm: Evm) -> None: """ - Copies data from the return data buffer code to memory. + Copies data from the return data buffer to memory. Parameters ---------- diff --git a/src/ethereum/forks/london/vm/instructions/memory.py b/src/ethereum/forks/london/vm/instructions/memory.py index fdd95188438..3a242ba2f7a 100644 --- a/src/ethereum/forks/london/vm/instructions/memory.py +++ b/src/ethereum/forks/london/vm/instructions/memory.py @@ -90,7 +90,7 @@ def mstore8(evm: Evm) -> None: def mload(evm: Evm) -> None: """ - Load word from memory. + Loads a word from memory. Parameters ---------- @@ -120,7 +120,7 @@ def mload(evm: Evm) -> None: def msize(evm: Evm) -> None: """ - Push the size of active memory in bytes onto the stack. + Pushes the size of active memory in bytes onto the stack. Parameters ---------- diff --git a/src/ethereum/forks/london/vm/instructions/stack.py b/src/ethereum/forks/london/vm/instructions/stack.py index bdf232db6a8..0fc0d3fe4b5 100644 --- a/src/ethereum/forks/london/vm/instructions/stack.py +++ b/src/ethereum/forks/london/vm/instructions/stack.py @@ -23,7 +23,7 @@ def pop(evm: Evm) -> None: """ - Remove item from stack. + Removes an item from the stack. Parameters ---------- @@ -46,7 +46,7 @@ def pop(evm: Evm) -> None: def push_n(evm: Evm, num_bytes: int) -> None: """ - Pushes a N-byte immediate onto the stack. + Pushes an N-byte immediate onto the stack. Parameters ---------- @@ -76,7 +76,7 @@ def push_n(evm: Evm, num_bytes: int) -> None: def dup_n(evm: Evm, item_number: int) -> None: """ - Duplicate the Nth stack item (from top of the stack) to the top of stack. + Duplicates the Nth stack item (from top of the stack) to the top of stack. Parameters ---------- @@ -104,7 +104,7 @@ def dup_n(evm: Evm, item_number: int) -> None: def swap_n(evm: Evm, item_number: int) -> None: """ - Swap the top and the `item_number` element of the stack, where + Swaps the top and the `item_number` element of the stack, where the top of the stack is position zero. If `item_number` is zero, this function does nothing (which should not be diff --git a/src/ethereum/forks/london/vm/instructions/system.py b/src/ethereum/forks/london/vm/instructions/system.py index 2ef31f9595e..44ba77a073c 100644 --- a/src/ethereum/forks/london/vm/instructions/system.py +++ b/src/ethereum/forks/london/vm/instructions/system.py @@ -179,8 +179,8 @@ def create2(evm: Evm) -> None: """ Creates a new account with associated code. - It's similar to CREATE opcode except that the address of new account - depends on the init_code instead of the nonce of sender. + It's similar to the CREATE opcode except that the address of the new + account depends on the init_code instead of the nonce of sender. Parameters ---------- diff --git a/src/ethereum/forks/london/vm/precompiled_contracts/ecrecover.py b/src/ethereum/forks/london/vm/precompiled_contracts/ecrecover.py index d2eeaf75df1..d8f6602e556 100644 --- a/src/ethereum/forks/london/vm/precompiled_contracts/ecrecover.py +++ b/src/ethereum/forks/london/vm/precompiled_contracts/ecrecover.py @@ -8,7 +8,7 @@ Introduction ------------ -Implementation of the ECRECOVER precompiled contract. +Implementation of the `ECRECOVER` precompiled contract. """ from ethereum_types.numeric import U256 diff --git a/src/ethereum/forks/london/vm/precompiled_contracts/mapping.py b/src/ethereum/forks/london/vm/precompiled_contracts/mapping.py index 827c44cfac7..44013f70e89 100644 --- a/src/ethereum/forks/london/vm/precompiled_contracts/mapping.py +++ b/src/ethereum/forks/london/vm/precompiled_contracts/mapping.py @@ -8,7 +8,7 @@ Introduction ------------ -Mapping of precompiled contracts their implementations. +Mapping of precompiled contracts to their implementations. """ from typing import Callable, Dict diff --git a/src/ethereum/forks/london/vm/precompiled_contracts/modexp.py b/src/ethereum/forks/london/vm/precompiled_contracts/modexp.py index 462341f69fd..755a396ddac 100644 --- a/src/ethereum/forks/london/vm/precompiled_contracts/modexp.py +++ b/src/ethereum/forks/london/vm/precompiled_contracts/modexp.py @@ -23,7 +23,7 @@ def modexp(evm: Evm) -> None: """ - Calculates `(base**exp) % modulus` for arbitrary sized `base`, `exp` and. + Calculates `(base**exp) % modulus` for arbitrary sized `base`, `exp` and `modulus`. The return value is the same length as the modulus. """ data = evm.message.data diff --git a/src/ethereum/forks/london/vm/runtime.py b/src/ethereum/forks/london/vm/runtime.py index 505b3488de8..0aa5ddd5e20 100644 --- a/src/ethereum/forks/london/vm/runtime.py +++ b/src/ethereum/forks/london/vm/runtime.py @@ -21,7 +21,7 @@ def get_valid_jump_destinations(code: Bytes) -> Set[Uint]: """ - Analyze the evm code to obtain the set of valid jump destinations. + Analyze the EVM code to obtain the set of valid jump destinations. Valid jump destinations are defined as follows: * The jump destination is less than the length of the code. diff --git a/src/ethereum/forks/muir_glacier/blocks.py b/src/ethereum/forks/muir_glacier/blocks.py index 3f17dc8fd73..05dd03d1c05 100644 --- a/src/ethereum/forks/muir_glacier/blocks.py +++ b/src/ethereum/forks/muir_glacier/blocks.py @@ -112,7 +112,7 @@ class Header: number: Uint """ - Block number, (height) in the chain. + Block number (height) in the chain. """ gas_limit: Uint @@ -183,7 +183,7 @@ class Block: header: Header """ The block header containing metadata and cryptographic commitments. Refer - [headers] for more details on the fields included in the header. + to [headers] for more details on the fields included in the header. [headers]: ref:ethereum.forks.muir_glacier.blocks.Header """ diff --git a/src/ethereum/forks/muir_glacier/bloom.py b/src/ethereum/forks/muir_glacier/bloom.py index 8a12ec081dd..0e079df6b39 100644 --- a/src/ethereum/forks/muir_glacier/bloom.py +++ b/src/ethereum/forks/muir_glacier/bloom.py @@ -8,7 +8,7 @@ Introduction ------------ -This modules defines functions for calculating bloom filters of logs. For the +This module defines functions for calculating bloom filters of logs. For the general theory of bloom filters see e.g. `Wikipedia `_. Bloom filters are used to allow for efficient searching of logs by address and/or topic, by rapidly diff --git a/src/ethereum/forks/muir_glacier/state.py b/src/ethereum/forks/muir_glacier/state.py index 5fbcf920cd2..91a0b28a1eb 100644 --- a/src/ethereum/forks/muir_glacier/state.py +++ b/src/ethereum/forks/muir_glacier/state.py @@ -367,7 +367,7 @@ def account_exists(state: State, address: Address) -> bool: def account_has_code_or_nonce(state: State, address: Address) -> bool: """ - Checks if an account has non zero nonce or non empty code. + Checks if an account has non-zero nonce or non-empty code. Parameters ---------- @@ -379,7 +379,7 @@ def account_has_code_or_nonce(state: State, address: Address) -> bool: Returns ------- has_code_or_nonce : `bool` - True if the account has non zero nonce or non empty code, + True if the account has non-zero nonce or non-empty code, False otherwise. """ @@ -500,7 +500,7 @@ def set_account_balance(state: State, address: Address, amount: U256) -> None: Address of the account whose nonce needs to be incremented. amount: - The amount that needs to set in balance. + The amount that needs to be set in the balance. """ @@ -520,7 +520,7 @@ def touch_account(state: State, address: Address) -> None: The current state. address: - The address of the account that need to initialised. + The address of the account that needs to be initialized. """ if not account_exists(state, address): @@ -557,7 +557,7 @@ def set_code(state: State, address: Address, code: Bytes) -> None: The current state. address: - Address of the account whose code needs to be update. + Address of the account whose code needs to be updated. code: The bytecode that needs to be set. diff --git a/src/ethereum/forks/muir_glacier/trie.py b/src/ethereum/forks/muir_glacier/trie.py index 4b02439003c..70e0ba33c2a 100644 --- a/src/ethereum/forks/muir_glacier/trie.py +++ b/src/ethereum/forks/muir_glacier/trie.py @@ -128,7 +128,7 @@ class BranchNode: def encode_internal_node(node: Optional[InternalNode]) -> Extended: """ Encodes a Merkle Trie node into its RLP form. The RLP will then be - serialized into a `Bytes` and hashed unless it is less that 32 bytes + serialized into a `Bytes` and hashed unless it is less than 32 bytes when serialized. This function also accepts `None`, representing the absence of a node, diff --git a/src/ethereum/forks/muir_glacier/vm/__init__.py b/src/ethereum/forks/muir_glacier/vm/__init__.py index 6cdd9c9bc74..068648ac368 100644 --- a/src/ethereum/forks/muir_glacier/vm/__init__.py +++ b/src/ethereum/forks/muir_glacier/vm/__init__.py @@ -61,7 +61,7 @@ class BlockOutput: receipts_trie : `ethereum.fork_types.Root` Trie root of all the receipts in the block. receipt_keys : - Key of all the receipts in the block. + Keys of all the receipts in the block. block_logs : `Bloom` Logs bloom of all the logs included in all the transactions of the block. diff --git a/src/ethereum/forks/muir_glacier/vm/gas.py b/src/ethereum/forks/muir_glacier/vm/gas.py index 93cacf71abc..af180fa654c 100644 --- a/src/ethereum/forks/muir_glacier/vm/gas.py +++ b/src/ethereum/forks/muir_glacier/vm/gas.py @@ -214,7 +214,7 @@ def calculate_message_call_gas( account inside a message call. call_stipend : The amount of stipend provided to a message call to execute code while - transferring value(ETH). + transferring value (ETH). Returns ------- diff --git a/src/ethereum/forks/muir_glacier/vm/instructions/arithmetic.py b/src/ethereum/forks/muir_glacier/vm/instructions/arithmetic.py index de5d6ab43d5..b7b1a370ad4 100644 --- a/src/ethereum/forks/muir_glacier/vm/instructions/arithmetic.py +++ b/src/ethereum/forks/muir_glacier/vm/instructions/arithmetic.py @@ -84,7 +84,7 @@ def sub(evm: Evm) -> None: def mul(evm: Evm) -> None: """ - Multiply the top two elements of the stack, and pushes the result back + Multiplies the top two elements of the stack, and pushes the result back on the stack. Parameters @@ -353,7 +353,7 @@ def signextend(evm: Evm) -> None: # Can't extend any further result = value else: - # U256(0).to_be_bytes() gives b'' instead b'\x00'. + # U256(0).to_be_bytes() gives b'' instead of b'\x00'. value_bytes = Bytes(value.to_be_bytes32()) # Now among the obtained value bytes, consider only # N `least significant bytes`, where N is `byte_num + 1`. diff --git a/src/ethereum/forks/muir_glacier/vm/instructions/block.py b/src/ethereum/forks/muir_glacier/vm/instructions/block.py index ecbeac10f42..bbf01739ff2 100644 --- a/src/ethereum/forks/muir_glacier/vm/instructions/block.py +++ b/src/ethereum/forks/muir_glacier/vm/instructions/block.py @@ -87,7 +87,7 @@ def coinbase(evm: Evm) -> None: def timestamp(evm: Evm) -> None: """ Push the current block's timestamp onto the stack. Here the timestamp - being referred is actually the unix timestamp in seconds. + being referred to is actually the unix timestamp in seconds. Here the current block refers to the block in which the currently executing transaction/call resides. diff --git a/src/ethereum/forks/muir_glacier/vm/instructions/environment.py b/src/ethereum/forks/muir_glacier/vm/instructions/environment.py index a854355eb4f..f7766715412 100644 --- a/src/ethereum/forks/muir_glacier/vm/instructions/environment.py +++ b/src/ethereum/forks/muir_glacier/vm/instructions/environment.py @@ -407,7 +407,7 @@ def returndatasize(evm: Evm) -> None: def returndatacopy(evm: Evm) -> None: """ - Copies data from the return data buffer code to memory. + Copies data from the return data buffer to memory. Parameters ---------- diff --git a/src/ethereum/forks/muir_glacier/vm/instructions/memory.py b/src/ethereum/forks/muir_glacier/vm/instructions/memory.py index fdd95188438..3a242ba2f7a 100644 --- a/src/ethereum/forks/muir_glacier/vm/instructions/memory.py +++ b/src/ethereum/forks/muir_glacier/vm/instructions/memory.py @@ -90,7 +90,7 @@ def mstore8(evm: Evm) -> None: def mload(evm: Evm) -> None: """ - Load word from memory. + Loads a word from memory. Parameters ---------- @@ -120,7 +120,7 @@ def mload(evm: Evm) -> None: def msize(evm: Evm) -> None: """ - Push the size of active memory in bytes onto the stack. + Pushes the size of active memory in bytes onto the stack. Parameters ---------- diff --git a/src/ethereum/forks/muir_glacier/vm/instructions/stack.py b/src/ethereum/forks/muir_glacier/vm/instructions/stack.py index bdf232db6a8..0fc0d3fe4b5 100644 --- a/src/ethereum/forks/muir_glacier/vm/instructions/stack.py +++ b/src/ethereum/forks/muir_glacier/vm/instructions/stack.py @@ -23,7 +23,7 @@ def pop(evm: Evm) -> None: """ - Remove item from stack. + Removes an item from the stack. Parameters ---------- @@ -46,7 +46,7 @@ def pop(evm: Evm) -> None: def push_n(evm: Evm, num_bytes: int) -> None: """ - Pushes a N-byte immediate onto the stack. + Pushes an N-byte immediate onto the stack. Parameters ---------- @@ -76,7 +76,7 @@ def push_n(evm: Evm, num_bytes: int) -> None: def dup_n(evm: Evm, item_number: int) -> None: """ - Duplicate the Nth stack item (from top of the stack) to the top of stack. + Duplicates the Nth stack item (from top of the stack) to the top of stack. Parameters ---------- @@ -104,7 +104,7 @@ def dup_n(evm: Evm, item_number: int) -> None: def swap_n(evm: Evm, item_number: int) -> None: """ - Swap the top and the `item_number` element of the stack, where + Swaps the top and the `item_number` element of the stack, where the top of the stack is position zero. If `item_number` is zero, this function does nothing (which should not be diff --git a/src/ethereum/forks/muir_glacier/vm/instructions/system.py b/src/ethereum/forks/muir_glacier/vm/instructions/system.py index fadd9634172..af2527d31cc 100644 --- a/src/ethereum/forks/muir_glacier/vm/instructions/system.py +++ b/src/ethereum/forks/muir_glacier/vm/instructions/system.py @@ -179,8 +179,8 @@ def create2(evm: Evm) -> None: """ Creates a new account with associated code. - It's similar to CREATE opcode except that the address of new account - depends on the init_code instead of the nonce of sender. + It's similar to the CREATE opcode except that the address of the new + account depends on the init_code instead of the nonce of sender. Parameters ---------- diff --git a/src/ethereum/forks/muir_glacier/vm/precompiled_contracts/ecrecover.py b/src/ethereum/forks/muir_glacier/vm/precompiled_contracts/ecrecover.py index d2eeaf75df1..d8f6602e556 100644 --- a/src/ethereum/forks/muir_glacier/vm/precompiled_contracts/ecrecover.py +++ b/src/ethereum/forks/muir_glacier/vm/precompiled_contracts/ecrecover.py @@ -8,7 +8,7 @@ Introduction ------------ -Implementation of the ECRECOVER precompiled contract. +Implementation of the `ECRECOVER` precompiled contract. """ from ethereum_types.numeric import U256 diff --git a/src/ethereum/forks/muir_glacier/vm/precompiled_contracts/mapping.py b/src/ethereum/forks/muir_glacier/vm/precompiled_contracts/mapping.py index 827c44cfac7..44013f70e89 100644 --- a/src/ethereum/forks/muir_glacier/vm/precompiled_contracts/mapping.py +++ b/src/ethereum/forks/muir_glacier/vm/precompiled_contracts/mapping.py @@ -8,7 +8,7 @@ Introduction ------------ -Mapping of precompiled contracts their implementations. +Mapping of precompiled contracts to their implementations. """ from typing import Callable, Dict diff --git a/src/ethereum/forks/muir_glacier/vm/precompiled_contracts/modexp.py b/src/ethereum/forks/muir_glacier/vm/precompiled_contracts/modexp.py index fd0501616c1..8ed5c851a72 100644 --- a/src/ethereum/forks/muir_glacier/vm/precompiled_contracts/modexp.py +++ b/src/ethereum/forks/muir_glacier/vm/precompiled_contracts/modexp.py @@ -23,7 +23,7 @@ def modexp(evm: Evm) -> None: """ - Calculates `(base**exp) % modulus` for arbitrary sized `base`, `exp` and. + Calculates `(base**exp) % modulus` for arbitrary sized `base`, `exp` and `modulus`. The return value is the same length as the modulus. """ data = evm.message.data diff --git a/src/ethereum/forks/muir_glacier/vm/runtime.py b/src/ethereum/forks/muir_glacier/vm/runtime.py index 505b3488de8..0aa5ddd5e20 100644 --- a/src/ethereum/forks/muir_glacier/vm/runtime.py +++ b/src/ethereum/forks/muir_glacier/vm/runtime.py @@ -21,7 +21,7 @@ def get_valid_jump_destinations(code: Bytes) -> Set[Uint]: """ - Analyze the evm code to obtain the set of valid jump destinations. + Analyze the EVM code to obtain the set of valid jump destinations. Valid jump destinations are defined as follows: * The jump destination is less than the length of the code. diff --git a/src/ethereum/forks/osaka/blocks.py b/src/ethereum/forks/osaka/blocks.py index fbbeeff15e2..857570d58cf 100644 --- a/src/ethereum/forks/osaka/blocks.py +++ b/src/ethereum/forks/osaka/blocks.py @@ -152,7 +152,7 @@ class Header: number: Uint """ - Block number, (height) in the chain. + Block number (height) in the chain. """ gas_limit: Uint @@ -272,7 +272,7 @@ class Block: header: Header """ The block header containing metadata and cryptographic commitments. Refer - [headers] for more details on the fields included in the header. + to [headers] for more details on the fields included in the header. [headers]: ref:ethereum.forks.osaka.blocks.Header """ diff --git a/src/ethereum/forks/osaka/bloom.py b/src/ethereum/forks/osaka/bloom.py index 8a12ec081dd..0e079df6b39 100644 --- a/src/ethereum/forks/osaka/bloom.py +++ b/src/ethereum/forks/osaka/bloom.py @@ -8,7 +8,7 @@ Introduction ------------ -This modules defines functions for calculating bloom filters of logs. For the +This module defines functions for calculating bloom filters of logs. For the general theory of bloom filters see e.g. `Wikipedia `_. Bloom filters are used to allow for efficient searching of logs by address and/or topic, by rapidly diff --git a/src/ethereum/forks/osaka/requests.py b/src/ethereum/forks/osaka/requests.py index 929e973e587..542c9264d37 100644 --- a/src/ethereum/forks/osaka/requests.py +++ b/src/ethereum/forks/osaka/requests.py @@ -1,5 +1,5 @@ """ -Requests were introduced in EIP-7685 as a a general purpose framework for +Requests were introduced in EIP-7685 as a general purpose framework for storing contract-triggered requests. It extends the execution header and body with a single field each to store the request information. This inherently exposes the requests to the consensus layer, which can diff --git a/src/ethereum/forks/osaka/state.py b/src/ethereum/forks/osaka/state.py index e997411f6da..6571aa05c61 100644 --- a/src/ethereum/forks/osaka/state.py +++ b/src/ethereum/forks/osaka/state.py @@ -400,7 +400,7 @@ def account_exists(state: State, address: Address) -> bool: def account_has_code_or_nonce(state: State, address: Address) -> bool: """ - Checks if an account has non zero nonce or non empty code. + Checks if an account has non-zero nonce or non-empty code. Parameters ---------- @@ -412,7 +412,7 @@ def account_has_code_or_nonce(state: State, address: Address) -> bool: Returns ------- has_code_or_nonce : `bool` - True if the account has non zero nonce or non empty code, + True if the account has non-zero nonce or non-empty code, False otherwise. """ @@ -517,7 +517,7 @@ def set_account_balance(state: State, address: Address, amount: U256) -> None: Address of the account whose nonce needs to be incremented. amount: - The amount that needs to set in balance. + The amount that needs to be set in the balance. """ @@ -557,7 +557,7 @@ def set_code(state: State, address: Address, code: Bytes) -> None: The current state. address: - Address of the account whose code needs to be update. + Address of the account whose code needs to be updated. code: The bytecode that needs to be set. diff --git a/src/ethereum/forks/osaka/trie.py b/src/ethereum/forks/osaka/trie.py index bde4318a648..fea8e0ece48 100644 --- a/src/ethereum/forks/osaka/trie.py +++ b/src/ethereum/forks/osaka/trie.py @@ -138,7 +138,7 @@ class BranchNode: def encode_internal_node(node: Optional[InternalNode]) -> Extended: """ Encodes a Merkle Trie node into its RLP form. The RLP will then be - serialized into a `Bytes` and hashed unless it is less that 32 bytes + serialized into a `Bytes` and hashed unless it is less than 32 bytes when serialized. This function also accepts `None`, representing the absence of a node, diff --git a/src/ethereum/forks/osaka/vm/__init__.py b/src/ethereum/forks/osaka/vm/__init__.py index b2a8c5e2b9f..641695ea0e7 100644 --- a/src/ethereum/forks/osaka/vm/__init__.py +++ b/src/ethereum/forks/osaka/vm/__init__.py @@ -63,7 +63,7 @@ class BlockOutput: receipts_trie : `ethereum.fork_types.Root` Trie root of all the receipts in the block. receipt_keys : - Key of all the receipts in the block. + Keys of all the receipts in the block. block_logs : `Bloom` Logs bloom of all the logs included in all the transactions of the block. diff --git a/src/ethereum/forks/osaka/vm/eoa_delegation.py b/src/ethereum/forks/osaka/vm/eoa_delegation.py index 29909b5fa56..bc96f4c3275 100644 --- a/src/ethereum/forks/osaka/vm/eoa_delegation.py +++ b/src/ethereum/forks/osaka/vm/eoa_delegation.py @@ -157,8 +157,6 @@ def set_delegation(message: Message) -> U256: ---------- message : Transaction specific items. - env : - External items required for EVM execution. Returns ------- diff --git a/src/ethereum/forks/osaka/vm/gas.py b/src/ethereum/forks/osaka/vm/gas.py index 62118f4c6ac..042abe0a531 100644 --- a/src/ethereum/forks/osaka/vm/gas.py +++ b/src/ethereum/forks/osaka/vm/gas.py @@ -232,7 +232,7 @@ def calculate_message_call_gas( account inside a message call. call_stipend : The amount of stipend provided to a message call to execute code while - transferring value(ETH). + transferring value (ETH). Returns ------- @@ -288,7 +288,7 @@ def init_code_cost(init_code_length: Uint) -> Uint: def calculate_excess_blob_gas(parent_header: Header) -> U64: """ - Calculated the excess blob gas for the current block based + Calculates the excess blob gas for the current block based on the gas used in the parent block. Parameters diff --git a/src/ethereum/forks/osaka/vm/instructions/arithmetic.py b/src/ethereum/forks/osaka/vm/instructions/arithmetic.py index de5d6ab43d5..b7b1a370ad4 100644 --- a/src/ethereum/forks/osaka/vm/instructions/arithmetic.py +++ b/src/ethereum/forks/osaka/vm/instructions/arithmetic.py @@ -84,7 +84,7 @@ def sub(evm: Evm) -> None: def mul(evm: Evm) -> None: """ - Multiply the top two elements of the stack, and pushes the result back + Multiplies the top two elements of the stack, and pushes the result back on the stack. Parameters @@ -353,7 +353,7 @@ def signextend(evm: Evm) -> None: # Can't extend any further result = value else: - # U256(0).to_be_bytes() gives b'' instead b'\x00'. + # U256(0).to_be_bytes() gives b'' instead of b'\x00'. value_bytes = Bytes(value.to_be_bytes32()) # Now among the obtained value bytes, consider only # N `least significant bytes`, where N is `byte_num + 1`. diff --git a/src/ethereum/forks/osaka/vm/instructions/block.py b/src/ethereum/forks/osaka/vm/instructions/block.py index e33f26aea42..43be9e58e23 100644 --- a/src/ethereum/forks/osaka/vm/instructions/block.py +++ b/src/ethereum/forks/osaka/vm/instructions/block.py @@ -101,7 +101,7 @@ def coinbase(evm: Evm) -> None: def timestamp(evm: Evm) -> None: """ Push the current block's timestamp onto the stack. Here the timestamp - being referred is actually the unix timestamp in seconds. + being referred to is actually the unix timestamp in seconds. Here the current block refers to the block in which the currently executing transaction/call resides. diff --git a/src/ethereum/forks/osaka/vm/instructions/environment.py b/src/ethereum/forks/osaka/vm/instructions/environment.py index 83690434658..28c595ee514 100644 --- a/src/ethereum/forks/osaka/vm/instructions/environment.py +++ b/src/ethereum/forks/osaka/vm/instructions/environment.py @@ -426,7 +426,7 @@ def returndatasize(evm: Evm) -> None: def returndatacopy(evm: Evm) -> None: """ - Copies data from the return data buffer code to memory. + Copies data from the return data buffer to memory. Parameters ---------- diff --git a/src/ethereum/forks/osaka/vm/instructions/memory.py b/src/ethereum/forks/osaka/vm/instructions/memory.py index 631d33a7fd6..6e111051ee3 100644 --- a/src/ethereum/forks/osaka/vm/instructions/memory.py +++ b/src/ethereum/forks/osaka/vm/instructions/memory.py @@ -93,7 +93,7 @@ def mstore8(evm: Evm) -> None: def mload(evm: Evm) -> None: """ - Load word from memory. + Loads a word from memory. Parameters ---------- @@ -123,7 +123,7 @@ def mload(evm: Evm) -> None: def msize(evm: Evm) -> None: """ - Push the size of active memory in bytes onto the stack. + Pushes the size of active memory in bytes onto the stack. Parameters ---------- @@ -146,7 +146,7 @@ def msize(evm: Evm) -> None: def mcopy(evm: Evm) -> None: """ - Copy the bytes in memory from one location to another. + Copies the bytes in memory from one location to another. Parameters ---------- diff --git a/src/ethereum/forks/osaka/vm/instructions/stack.py b/src/ethereum/forks/osaka/vm/instructions/stack.py index e381b52c370..0007a28acd4 100644 --- a/src/ethereum/forks/osaka/vm/instructions/stack.py +++ b/src/ethereum/forks/osaka/vm/instructions/stack.py @@ -23,7 +23,7 @@ def pop(evm: Evm) -> None: """ - Remove item from stack. + Removes an item from the stack. Parameters ---------- @@ -46,7 +46,7 @@ def pop(evm: Evm) -> None: def push_n(evm: Evm, num_bytes: int) -> None: """ - Pushes a N-byte immediate onto the stack. Push zero if num_bytes is zero. + Pushes an N-byte immediate onto the stack. Push zero if num_bytes is zero. Parameters ---------- @@ -79,7 +79,7 @@ def push_n(evm: Evm, num_bytes: int) -> None: def dup_n(evm: Evm, item_number: int) -> None: """ - Duplicate the Nth stack item (from top of the stack) to the top of stack. + Duplicates the Nth stack item (from top of the stack) to the top of stack. Parameters ---------- @@ -107,7 +107,7 @@ def dup_n(evm: Evm, item_number: int) -> None: def swap_n(evm: Evm, item_number: int) -> None: """ - Swap the top and the `item_number` element of the stack, where + Swaps the top and the `item_number` element of the stack, where the top of the stack is position zero. If `item_number` is zero, this function does nothing (which should not be diff --git a/src/ethereum/forks/osaka/vm/instructions/system.py b/src/ethereum/forks/osaka/vm/instructions/system.py index fea7a0c1b9d..44c36ae000f 100644 --- a/src/ethereum/forks/osaka/vm/instructions/system.py +++ b/src/ethereum/forks/osaka/vm/instructions/system.py @@ -193,8 +193,8 @@ def create2(evm: Evm) -> None: """ Creates a new account with associated code. - It's similar to CREATE opcode except that the address of new account - depends on the init_code instead of the nonce of sender. + It's similar to the CREATE opcode except that the address of the new + account depends on the init_code instead of the nonce of sender. Parameters ---------- diff --git a/src/ethereum/forks/osaka/vm/precompiled_contracts/bls12_381/bls12_381_pairing.py b/src/ethereum/forks/osaka/vm/precompiled_contracts/bls12_381/bls12_381_pairing.py index 6cb29a32fd9..c7a62cb49c0 100644 --- a/src/ethereum/forks/osaka/vm/precompiled_contracts/bls12_381/bls12_381_pairing.py +++ b/src/ethereum/forks/osaka/vm/precompiled_contracts/bls12_381/bls12_381_pairing.py @@ -33,7 +33,7 @@ def bls12_pairing(evm: Evm) -> None: Raises ------ InvalidParameter - If the input length is invalid or if sub-group check fails. + If the input length is invalid or if the subgroup check fails. """ data = evm.message.data @@ -54,12 +54,12 @@ def bls12_pairing(evm: Evm) -> None: g1_slice = data[g1_start : g1_start + Uint(128)] g1_point = bytes_to_g1(bytes(g1_slice)) if not is_inf(bls12_multiply(g1_point, curve_order)): - raise InvalidParameter("Sub-group check failed for G1 point.") + raise InvalidParameter("Subgroup check failed for G1 point.") g2_slice = data[g2_start : g2_start + Uint(256)] g2_point = bytes_to_g2(bytes(g2_slice)) if not is_inf(bls12_multiply(g2_point, curve_order)): - raise InvalidParameter("Sub-group check failed for G2 point.") + raise InvalidParameter("Subgroup check failed for G2 point.") result *= pairing(g2_point, g1_point) diff --git a/src/ethereum/forks/osaka/vm/precompiled_contracts/ecrecover.py b/src/ethereum/forks/osaka/vm/precompiled_contracts/ecrecover.py index d2eeaf75df1..d8f6602e556 100644 --- a/src/ethereum/forks/osaka/vm/precompiled_contracts/ecrecover.py +++ b/src/ethereum/forks/osaka/vm/precompiled_contracts/ecrecover.py @@ -8,7 +8,7 @@ Introduction ------------ -Implementation of the ECRECOVER precompiled contract. +Implementation of the `ECRECOVER` precompiled contract. """ from ethereum_types.numeric import U256 diff --git a/src/ethereum/forks/osaka/vm/precompiled_contracts/mapping.py b/src/ethereum/forks/osaka/vm/precompiled_contracts/mapping.py index a80e2b02354..7486203c3e6 100644 --- a/src/ethereum/forks/osaka/vm/precompiled_contracts/mapping.py +++ b/src/ethereum/forks/osaka/vm/precompiled_contracts/mapping.py @@ -8,7 +8,7 @@ Introduction ------------ -Mapping of precompiled contracts their implementations. +Mapping of precompiled contracts to their implementations. """ from typing import Callable, Dict diff --git a/src/ethereum/forks/osaka/vm/precompiled_contracts/modexp.py b/src/ethereum/forks/osaka/vm/precompiled_contracts/modexp.py index 5e7e895b91a..bf828ee8f6e 100644 --- a/src/ethereum/forks/osaka/vm/precompiled_contracts/modexp.py +++ b/src/ethereum/forks/osaka/vm/precompiled_contracts/modexp.py @@ -22,7 +22,7 @@ def modexp(evm: Evm) -> None: """ - Calculates `(base**exp) % modulus` for arbitrary sized `base`, `exp` and. + Calculates `(base**exp) % modulus` for arbitrary sized `base`, `exp` and `modulus`. The return value is the same length as the modulus. """ data = evm.message.data diff --git a/src/ethereum/forks/osaka/vm/precompiled_contracts/p256verify.py b/src/ethereum/forks/osaka/vm/precompiled_contracts/p256verify.py index 6f6e7ff4e9d..106dd548a61 100644 --- a/src/ethereum/forks/osaka/vm/precompiled_contracts/p256verify.py +++ b/src/ethereum/forks/osaka/vm/precompiled_contracts/p256verify.py @@ -5,9 +5,10 @@ :backlinks: none :local: -Introduction. +Introduction ------------ -Implementation of the P256VERIFY precompiled contract. + +Implementation of the `P256VERIFY` precompiled contract. """ from ethereum_types.numeric import U256 diff --git a/src/ethereum/forks/osaka/vm/precompiled_contracts/point_evaluation.py b/src/ethereum/forks/osaka/vm/precompiled_contracts/point_evaluation.py index 760af477364..ce4eed71294 100644 --- a/src/ethereum/forks/osaka/vm/precompiled_contracts/point_evaluation.py +++ b/src/ethereum/forks/osaka/vm/precompiled_contracts/point_evaluation.py @@ -8,7 +8,7 @@ Introduction ------------ -Implementation of the POINT EVALUATION precompiled contract. +Implementation of the `POINT EVALUATION` precompiled contract. """ from ethereum_types.bytes import Bytes, Bytes32, Bytes48 diff --git a/src/ethereum/forks/osaka/vm/runtime.py b/src/ethereum/forks/osaka/vm/runtime.py index 505b3488de8..0aa5ddd5e20 100644 --- a/src/ethereum/forks/osaka/vm/runtime.py +++ b/src/ethereum/forks/osaka/vm/runtime.py @@ -21,7 +21,7 @@ def get_valid_jump_destinations(code: Bytes) -> Set[Uint]: """ - Analyze the evm code to obtain the set of valid jump destinations. + Analyze the EVM code to obtain the set of valid jump destinations. Valid jump destinations are defined as follows: * The jump destination is less than the length of the code. diff --git a/src/ethereum/forks/paris/blocks.py b/src/ethereum/forks/paris/blocks.py index 4ad446c9460..af1f4e47779 100644 --- a/src/ethereum/forks/paris/blocks.py +++ b/src/ethereum/forks/paris/blocks.py @@ -117,7 +117,7 @@ class Header: number: Uint """ - Block number, (height) in the chain. + Block number (height) in the chain. """ gas_limit: Uint @@ -194,7 +194,7 @@ class Block: header: Header """ The block header containing metadata and cryptographic commitments. Refer - [headers] for more details on the fields included in the header. + to [headers] for more details on the fields included in the header. [headers]: ref:ethereum.forks.paris.blocks.Header """ diff --git a/src/ethereum/forks/paris/bloom.py b/src/ethereum/forks/paris/bloom.py index 8a12ec081dd..0e079df6b39 100644 --- a/src/ethereum/forks/paris/bloom.py +++ b/src/ethereum/forks/paris/bloom.py @@ -8,7 +8,7 @@ Introduction ------------ -This modules defines functions for calculating bloom filters of logs. For the +This module defines functions for calculating bloom filters of logs. For the general theory of bloom filters see e.g. `Wikipedia `_. Bloom filters are used to allow for efficient searching of logs by address and/or topic, by rapidly diff --git a/src/ethereum/forks/paris/state.py b/src/ethereum/forks/paris/state.py index ec753edd33f..8db1566f568 100644 --- a/src/ethereum/forks/paris/state.py +++ b/src/ethereum/forks/paris/state.py @@ -367,7 +367,7 @@ def account_exists(state: State, address: Address) -> bool: def account_has_code_or_nonce(state: State, address: Address) -> bool: """ - Checks if an account has non zero nonce or non empty code. + Checks if an account has non-zero nonce or non-empty code. Parameters ---------- @@ -379,7 +379,7 @@ def account_has_code_or_nonce(state: State, address: Address) -> bool: Returns ------- has_code_or_nonce : `bool` - True if the account has non zero nonce or non empty code, + True if the account has non-zero nonce or non-empty code, False otherwise. """ @@ -484,7 +484,7 @@ def set_account_balance(state: State, address: Address, amount: U256) -> None: Address of the account whose nonce needs to be incremented. amount: - The amount that needs to set in balance. + The amount that needs to be set in the balance. """ @@ -524,7 +524,7 @@ def set_code(state: State, address: Address, code: Bytes) -> None: The current state. address: - Address of the account whose code needs to be update. + Address of the account whose code needs to be updated. code: The bytecode that needs to be set. diff --git a/src/ethereum/forks/paris/trie.py b/src/ethereum/forks/paris/trie.py index 0217f832049..38db711ff49 100644 --- a/src/ethereum/forks/paris/trie.py +++ b/src/ethereum/forks/paris/trie.py @@ -128,7 +128,7 @@ class BranchNode: def encode_internal_node(node: Optional[InternalNode]) -> Extended: """ Encodes a Merkle Trie node into its RLP form. The RLP will then be - serialized into a `Bytes` and hashed unless it is less that 32 bytes + serialized into a `Bytes` and hashed unless it is less than 32 bytes when serialized. This function also accepts `None`, representing the absence of a node, diff --git a/src/ethereum/forks/paris/vm/__init__.py b/src/ethereum/forks/paris/vm/__init__.py index 1bac4ee2130..22f11d48225 100644 --- a/src/ethereum/forks/paris/vm/__init__.py +++ b/src/ethereum/forks/paris/vm/__init__.py @@ -61,7 +61,7 @@ class BlockOutput: receipts_trie : `ethereum.fork_types.Root` Trie root of all the receipts in the block. receipt_keys : - Key of all the receipts in the block. + Keys of all the receipts in the block. block_logs : `Bloom` Logs bloom of all the logs included in all the transactions of the block. diff --git a/src/ethereum/forks/paris/vm/gas.py b/src/ethereum/forks/paris/vm/gas.py index b5c96dea850..4f2dde3b9d7 100644 --- a/src/ethereum/forks/paris/vm/gas.py +++ b/src/ethereum/forks/paris/vm/gas.py @@ -211,7 +211,7 @@ def calculate_message_call_gas( account inside a message call. call_stipend : The amount of stipend provided to a message call to execute code while - transferring value(ETH). + transferring value (ETH). Returns ------- diff --git a/src/ethereum/forks/paris/vm/instructions/arithmetic.py b/src/ethereum/forks/paris/vm/instructions/arithmetic.py index de5d6ab43d5..b7b1a370ad4 100644 --- a/src/ethereum/forks/paris/vm/instructions/arithmetic.py +++ b/src/ethereum/forks/paris/vm/instructions/arithmetic.py @@ -84,7 +84,7 @@ def sub(evm: Evm) -> None: def mul(evm: Evm) -> None: """ - Multiply the top two elements of the stack, and pushes the result back + Multiplies the top two elements of the stack, and pushes the result back on the stack. Parameters @@ -353,7 +353,7 @@ def signextend(evm: Evm) -> None: # Can't extend any further result = value else: - # U256(0).to_be_bytes() gives b'' instead b'\x00'. + # U256(0).to_be_bytes() gives b'' instead of b'\x00'. value_bytes = Bytes(value.to_be_bytes32()) # Now among the obtained value bytes, consider only # N `least significant bytes`, where N is `byte_num + 1`. diff --git a/src/ethereum/forks/paris/vm/instructions/block.py b/src/ethereum/forks/paris/vm/instructions/block.py index 098a23386ae..3aa1fb2f6b6 100644 --- a/src/ethereum/forks/paris/vm/instructions/block.py +++ b/src/ethereum/forks/paris/vm/instructions/block.py @@ -101,7 +101,7 @@ def coinbase(evm: Evm) -> None: def timestamp(evm: Evm) -> None: """ Push the current block's timestamp onto the stack. Here the timestamp - being referred is actually the unix timestamp in seconds. + being referred to is actually the unix timestamp in seconds. Here the current block refers to the block in which the currently executing transaction/call resides. diff --git a/src/ethereum/forks/paris/vm/instructions/environment.py b/src/ethereum/forks/paris/vm/instructions/environment.py index 1abfaeafa9c..2a7b4346619 100644 --- a/src/ethereum/forks/paris/vm/instructions/environment.py +++ b/src/ethereum/forks/paris/vm/instructions/environment.py @@ -423,7 +423,7 @@ def returndatasize(evm: Evm) -> None: def returndatacopy(evm: Evm) -> None: """ - Copies data from the return data buffer code to memory. + Copies data from the return data buffer to memory. Parameters ---------- diff --git a/src/ethereum/forks/paris/vm/instructions/memory.py b/src/ethereum/forks/paris/vm/instructions/memory.py index fdd95188438..3a242ba2f7a 100644 --- a/src/ethereum/forks/paris/vm/instructions/memory.py +++ b/src/ethereum/forks/paris/vm/instructions/memory.py @@ -90,7 +90,7 @@ def mstore8(evm: Evm) -> None: def mload(evm: Evm) -> None: """ - Load word from memory. + Loads a word from memory. Parameters ---------- @@ -120,7 +120,7 @@ def mload(evm: Evm) -> None: def msize(evm: Evm) -> None: """ - Push the size of active memory in bytes onto the stack. + Pushes the size of active memory in bytes onto the stack. Parameters ---------- diff --git a/src/ethereum/forks/paris/vm/instructions/stack.py b/src/ethereum/forks/paris/vm/instructions/stack.py index bdf232db6a8..0fc0d3fe4b5 100644 --- a/src/ethereum/forks/paris/vm/instructions/stack.py +++ b/src/ethereum/forks/paris/vm/instructions/stack.py @@ -23,7 +23,7 @@ def pop(evm: Evm) -> None: """ - Remove item from stack. + Removes an item from the stack. Parameters ---------- @@ -46,7 +46,7 @@ def pop(evm: Evm) -> None: def push_n(evm: Evm, num_bytes: int) -> None: """ - Pushes a N-byte immediate onto the stack. + Pushes an N-byte immediate onto the stack. Parameters ---------- @@ -76,7 +76,7 @@ def push_n(evm: Evm, num_bytes: int) -> None: def dup_n(evm: Evm, item_number: int) -> None: """ - Duplicate the Nth stack item (from top of the stack) to the top of stack. + Duplicates the Nth stack item (from top of the stack) to the top of stack. Parameters ---------- @@ -104,7 +104,7 @@ def dup_n(evm: Evm, item_number: int) -> None: def swap_n(evm: Evm, item_number: int) -> None: """ - Swap the top and the `item_number` element of the stack, where + Swaps the top and the `item_number` element of the stack, where the top of the stack is position zero. If `item_number` is zero, this function does nothing (which should not be diff --git a/src/ethereum/forks/paris/vm/instructions/system.py b/src/ethereum/forks/paris/vm/instructions/system.py index a1d4ba48e1a..f2af30a7ee3 100644 --- a/src/ethereum/forks/paris/vm/instructions/system.py +++ b/src/ethereum/forks/paris/vm/instructions/system.py @@ -178,8 +178,8 @@ def create2(evm: Evm) -> None: """ Creates a new account with associated code. - It's similar to CREATE opcode except that the address of new account - depends on the init_code instead of the nonce of sender. + It's similar to the CREATE opcode except that the address of the new + account depends on the init_code instead of the nonce of sender. Parameters ---------- diff --git a/src/ethereum/forks/paris/vm/precompiled_contracts/ecrecover.py b/src/ethereum/forks/paris/vm/precompiled_contracts/ecrecover.py index d2eeaf75df1..d8f6602e556 100644 --- a/src/ethereum/forks/paris/vm/precompiled_contracts/ecrecover.py +++ b/src/ethereum/forks/paris/vm/precompiled_contracts/ecrecover.py @@ -8,7 +8,7 @@ Introduction ------------ -Implementation of the ECRECOVER precompiled contract. +Implementation of the `ECRECOVER` precompiled contract. """ from ethereum_types.numeric import U256 diff --git a/src/ethereum/forks/paris/vm/precompiled_contracts/mapping.py b/src/ethereum/forks/paris/vm/precompiled_contracts/mapping.py index 827c44cfac7..44013f70e89 100644 --- a/src/ethereum/forks/paris/vm/precompiled_contracts/mapping.py +++ b/src/ethereum/forks/paris/vm/precompiled_contracts/mapping.py @@ -8,7 +8,7 @@ Introduction ------------ -Mapping of precompiled contracts their implementations. +Mapping of precompiled contracts to their implementations. """ from typing import Callable, Dict diff --git a/src/ethereum/forks/paris/vm/precompiled_contracts/modexp.py b/src/ethereum/forks/paris/vm/precompiled_contracts/modexp.py index 462341f69fd..755a396ddac 100644 --- a/src/ethereum/forks/paris/vm/precompiled_contracts/modexp.py +++ b/src/ethereum/forks/paris/vm/precompiled_contracts/modexp.py @@ -23,7 +23,7 @@ def modexp(evm: Evm) -> None: """ - Calculates `(base**exp) % modulus` for arbitrary sized `base`, `exp` and. + Calculates `(base**exp) % modulus` for arbitrary sized `base`, `exp` and `modulus`. The return value is the same length as the modulus. """ data = evm.message.data diff --git a/src/ethereum/forks/paris/vm/runtime.py b/src/ethereum/forks/paris/vm/runtime.py index 505b3488de8..0aa5ddd5e20 100644 --- a/src/ethereum/forks/paris/vm/runtime.py +++ b/src/ethereum/forks/paris/vm/runtime.py @@ -21,7 +21,7 @@ def get_valid_jump_destinations(code: Bytes) -> Set[Uint]: """ - Analyze the evm code to obtain the set of valid jump destinations. + Analyze the EVM code to obtain the set of valid jump destinations. Valid jump destinations are defined as follows: * The jump destination is less than the length of the code. diff --git a/src/ethereum/forks/prague/blocks.py b/src/ethereum/forks/prague/blocks.py index 54cec5306b0..33d7bedfefc 100644 --- a/src/ethereum/forks/prague/blocks.py +++ b/src/ethereum/forks/prague/blocks.py @@ -152,7 +152,7 @@ class Header: number: Uint """ - Block number, (height) in the chain. + Block number (height) in the chain. """ gas_limit: Uint @@ -272,7 +272,7 @@ class Block: header: Header """ The block header containing metadata and cryptographic commitments. Refer - [headers] for more details on the fields included in the header. + to [headers] for more details on the fields included in the header. [headers]: ref:ethereum.forks.prague.blocks.Header """ diff --git a/src/ethereum/forks/prague/bloom.py b/src/ethereum/forks/prague/bloom.py index 8a12ec081dd..0e079df6b39 100644 --- a/src/ethereum/forks/prague/bloom.py +++ b/src/ethereum/forks/prague/bloom.py @@ -8,7 +8,7 @@ Introduction ------------ -This modules defines functions for calculating bloom filters of logs. For the +This module defines functions for calculating bloom filters of logs. For the general theory of bloom filters see e.g. `Wikipedia `_. Bloom filters are used to allow for efficient searching of logs by address and/or topic, by rapidly diff --git a/src/ethereum/forks/prague/state.py b/src/ethereum/forks/prague/state.py index e997411f6da..6571aa05c61 100644 --- a/src/ethereum/forks/prague/state.py +++ b/src/ethereum/forks/prague/state.py @@ -400,7 +400,7 @@ def account_exists(state: State, address: Address) -> bool: def account_has_code_or_nonce(state: State, address: Address) -> bool: """ - Checks if an account has non zero nonce or non empty code. + Checks if an account has non-zero nonce or non-empty code. Parameters ---------- @@ -412,7 +412,7 @@ def account_has_code_or_nonce(state: State, address: Address) -> bool: Returns ------- has_code_or_nonce : `bool` - True if the account has non zero nonce or non empty code, + True if the account has non-zero nonce or non-empty code, False otherwise. """ @@ -517,7 +517,7 @@ def set_account_balance(state: State, address: Address, amount: U256) -> None: Address of the account whose nonce needs to be incremented. amount: - The amount that needs to set in balance. + The amount that needs to be set in the balance. """ @@ -557,7 +557,7 @@ def set_code(state: State, address: Address, code: Bytes) -> None: The current state. address: - Address of the account whose code needs to be update. + Address of the account whose code needs to be updated. code: The bytecode that needs to be set. diff --git a/src/ethereum/forks/prague/trie.py b/src/ethereum/forks/prague/trie.py index e3265a72730..ac266a60f91 100644 --- a/src/ethereum/forks/prague/trie.py +++ b/src/ethereum/forks/prague/trie.py @@ -138,7 +138,7 @@ class BranchNode: def encode_internal_node(node: Optional[InternalNode]) -> Extended: """ Encodes a Merkle Trie node into its RLP form. The RLP will then be - serialized into a `Bytes` and hashed unless it is less that 32 bytes + serialized into a `Bytes` and hashed unless it is less than 32 bytes when serialized. This function also accepts `None`, representing the absence of a node, diff --git a/src/ethereum/forks/prague/vm/__init__.py b/src/ethereum/forks/prague/vm/__init__.py index b2a8c5e2b9f..641695ea0e7 100644 --- a/src/ethereum/forks/prague/vm/__init__.py +++ b/src/ethereum/forks/prague/vm/__init__.py @@ -63,7 +63,7 @@ class BlockOutput: receipts_trie : `ethereum.fork_types.Root` Trie root of all the receipts in the block. receipt_keys : - Key of all the receipts in the block. + Keys of all the receipts in the block. block_logs : `Bloom` Logs bloom of all the logs included in all the transactions of the block. diff --git a/src/ethereum/forks/prague/vm/eoa_delegation.py b/src/ethereum/forks/prague/vm/eoa_delegation.py index 29909b5fa56..bc96f4c3275 100644 --- a/src/ethereum/forks/prague/vm/eoa_delegation.py +++ b/src/ethereum/forks/prague/vm/eoa_delegation.py @@ -157,8 +157,6 @@ def set_delegation(message: Message) -> U256: ---------- message : Transaction specific items. - env : - External items required for EVM execution. Returns ------- diff --git a/src/ethereum/forks/prague/vm/gas.py b/src/ethereum/forks/prague/vm/gas.py index 8bb3c042cb7..e7133340562 100644 --- a/src/ethereum/forks/prague/vm/gas.py +++ b/src/ethereum/forks/prague/vm/gas.py @@ -228,7 +228,7 @@ def calculate_message_call_gas( account inside a message call. call_stipend : The amount of stipend provided to a message call to execute code while - transferring value(ETH). + transferring value (ETH). Returns ------- @@ -284,7 +284,7 @@ def init_code_cost(init_code_length: Uint) -> Uint: def calculate_excess_blob_gas(parent_header: Header) -> U64: """ - Calculated the excess blob gas for the current block based + Calculates the excess blob gas for the current block based on the gas used in the parent block. Parameters diff --git a/src/ethereum/forks/prague/vm/instructions/arithmetic.py b/src/ethereum/forks/prague/vm/instructions/arithmetic.py index de5d6ab43d5..b7b1a370ad4 100644 --- a/src/ethereum/forks/prague/vm/instructions/arithmetic.py +++ b/src/ethereum/forks/prague/vm/instructions/arithmetic.py @@ -84,7 +84,7 @@ def sub(evm: Evm) -> None: def mul(evm: Evm) -> None: """ - Multiply the top two elements of the stack, and pushes the result back + Multiplies the top two elements of the stack, and pushes the result back on the stack. Parameters @@ -353,7 +353,7 @@ def signextend(evm: Evm) -> None: # Can't extend any further result = value else: - # U256(0).to_be_bytes() gives b'' instead b'\x00'. + # U256(0).to_be_bytes() gives b'' instead of b'\x00'. value_bytes = Bytes(value.to_be_bytes32()) # Now among the obtained value bytes, consider only # N `least significant bytes`, where N is `byte_num + 1`. diff --git a/src/ethereum/forks/prague/vm/instructions/block.py b/src/ethereum/forks/prague/vm/instructions/block.py index ddaa221bfcd..b3bfb500a09 100644 --- a/src/ethereum/forks/prague/vm/instructions/block.py +++ b/src/ethereum/forks/prague/vm/instructions/block.py @@ -101,7 +101,7 @@ def coinbase(evm: Evm) -> None: def timestamp(evm: Evm) -> None: """ Push the current block's timestamp onto the stack. Here the timestamp - being referred is actually the unix timestamp in seconds. + being referred to is actually the unix timestamp in seconds. Here the current block refers to the block in which the currently executing transaction/call resides. diff --git a/src/ethereum/forks/prague/vm/instructions/environment.py b/src/ethereum/forks/prague/vm/instructions/environment.py index 83690434658..28c595ee514 100644 --- a/src/ethereum/forks/prague/vm/instructions/environment.py +++ b/src/ethereum/forks/prague/vm/instructions/environment.py @@ -426,7 +426,7 @@ def returndatasize(evm: Evm) -> None: def returndatacopy(evm: Evm) -> None: """ - Copies data from the return data buffer code to memory. + Copies data from the return data buffer to memory. Parameters ---------- diff --git a/src/ethereum/forks/prague/vm/instructions/memory.py b/src/ethereum/forks/prague/vm/instructions/memory.py index 631d33a7fd6..6e111051ee3 100644 --- a/src/ethereum/forks/prague/vm/instructions/memory.py +++ b/src/ethereum/forks/prague/vm/instructions/memory.py @@ -93,7 +93,7 @@ def mstore8(evm: Evm) -> None: def mload(evm: Evm) -> None: """ - Load word from memory. + Loads a word from memory. Parameters ---------- @@ -123,7 +123,7 @@ def mload(evm: Evm) -> None: def msize(evm: Evm) -> None: """ - Push the size of active memory in bytes onto the stack. + Pushes the size of active memory in bytes onto the stack. Parameters ---------- @@ -146,7 +146,7 @@ def msize(evm: Evm) -> None: def mcopy(evm: Evm) -> None: """ - Copy the bytes in memory from one location to another. + Copies the bytes in memory from one location to another. Parameters ---------- diff --git a/src/ethereum/forks/prague/vm/instructions/stack.py b/src/ethereum/forks/prague/vm/instructions/stack.py index e381b52c370..0007a28acd4 100644 --- a/src/ethereum/forks/prague/vm/instructions/stack.py +++ b/src/ethereum/forks/prague/vm/instructions/stack.py @@ -23,7 +23,7 @@ def pop(evm: Evm) -> None: """ - Remove item from stack. + Removes an item from the stack. Parameters ---------- @@ -46,7 +46,7 @@ def pop(evm: Evm) -> None: def push_n(evm: Evm, num_bytes: int) -> None: """ - Pushes a N-byte immediate onto the stack. Push zero if num_bytes is zero. + Pushes an N-byte immediate onto the stack. Push zero if num_bytes is zero. Parameters ---------- @@ -79,7 +79,7 @@ def push_n(evm: Evm, num_bytes: int) -> None: def dup_n(evm: Evm, item_number: int) -> None: """ - Duplicate the Nth stack item (from top of the stack) to the top of stack. + Duplicates the Nth stack item (from top of the stack) to the top of stack. Parameters ---------- @@ -107,7 +107,7 @@ def dup_n(evm: Evm, item_number: int) -> None: def swap_n(evm: Evm, item_number: int) -> None: """ - Swap the top and the `item_number` element of the stack, where + Swaps the top and the `item_number` element of the stack, where the top of the stack is position zero. If `item_number` is zero, this function does nothing (which should not be diff --git a/src/ethereum/forks/prague/vm/instructions/system.py b/src/ethereum/forks/prague/vm/instructions/system.py index fea7a0c1b9d..44c36ae000f 100644 --- a/src/ethereum/forks/prague/vm/instructions/system.py +++ b/src/ethereum/forks/prague/vm/instructions/system.py @@ -193,8 +193,8 @@ def create2(evm: Evm) -> None: """ Creates a new account with associated code. - It's similar to CREATE opcode except that the address of new account - depends on the init_code instead of the nonce of sender. + It's similar to the CREATE opcode except that the address of the new + account depends on the init_code instead of the nonce of sender. Parameters ---------- diff --git a/src/ethereum/forks/prague/vm/precompiled_contracts/bls12_381/bls12_381_pairing.py b/src/ethereum/forks/prague/vm/precompiled_contracts/bls12_381/bls12_381_pairing.py index 6cb29a32fd9..c7a62cb49c0 100644 --- a/src/ethereum/forks/prague/vm/precompiled_contracts/bls12_381/bls12_381_pairing.py +++ b/src/ethereum/forks/prague/vm/precompiled_contracts/bls12_381/bls12_381_pairing.py @@ -33,7 +33,7 @@ def bls12_pairing(evm: Evm) -> None: Raises ------ InvalidParameter - If the input length is invalid or if sub-group check fails. + If the input length is invalid or if the subgroup check fails. """ data = evm.message.data @@ -54,12 +54,12 @@ def bls12_pairing(evm: Evm) -> None: g1_slice = data[g1_start : g1_start + Uint(128)] g1_point = bytes_to_g1(bytes(g1_slice)) if not is_inf(bls12_multiply(g1_point, curve_order)): - raise InvalidParameter("Sub-group check failed for G1 point.") + raise InvalidParameter("Subgroup check failed for G1 point.") g2_slice = data[g2_start : g2_start + Uint(256)] g2_point = bytes_to_g2(bytes(g2_slice)) if not is_inf(bls12_multiply(g2_point, curve_order)): - raise InvalidParameter("Sub-group check failed for G2 point.") + raise InvalidParameter("Subgroup check failed for G2 point.") result *= pairing(g2_point, g1_point) diff --git a/src/ethereum/forks/prague/vm/precompiled_contracts/ecrecover.py b/src/ethereum/forks/prague/vm/precompiled_contracts/ecrecover.py index d2eeaf75df1..d8f6602e556 100644 --- a/src/ethereum/forks/prague/vm/precompiled_contracts/ecrecover.py +++ b/src/ethereum/forks/prague/vm/precompiled_contracts/ecrecover.py @@ -8,7 +8,7 @@ Introduction ------------ -Implementation of the ECRECOVER precompiled contract. +Implementation of the `ECRECOVER` precompiled contract. """ from ethereum_types.numeric import U256 diff --git a/src/ethereum/forks/prague/vm/precompiled_contracts/mapping.py b/src/ethereum/forks/prague/vm/precompiled_contracts/mapping.py index 91ae92faa56..818665d0a41 100644 --- a/src/ethereum/forks/prague/vm/precompiled_contracts/mapping.py +++ b/src/ethereum/forks/prague/vm/precompiled_contracts/mapping.py @@ -8,7 +8,7 @@ Introduction ------------ -Mapping of precompiled contracts their implementations. +Mapping of precompiled contracts to their implementations. """ from typing import Callable, Dict diff --git a/src/ethereum/forks/prague/vm/precompiled_contracts/modexp.py b/src/ethereum/forks/prague/vm/precompiled_contracts/modexp.py index 462341f69fd..755a396ddac 100644 --- a/src/ethereum/forks/prague/vm/precompiled_contracts/modexp.py +++ b/src/ethereum/forks/prague/vm/precompiled_contracts/modexp.py @@ -23,7 +23,7 @@ def modexp(evm: Evm) -> None: """ - Calculates `(base**exp) % modulus` for arbitrary sized `base`, `exp` and. + Calculates `(base**exp) % modulus` for arbitrary sized `base`, `exp` and `modulus`. The return value is the same length as the modulus. """ data = evm.message.data diff --git a/src/ethereum/forks/prague/vm/precompiled_contracts/point_evaluation.py b/src/ethereum/forks/prague/vm/precompiled_contracts/point_evaluation.py index 760af477364..ce4eed71294 100644 --- a/src/ethereum/forks/prague/vm/precompiled_contracts/point_evaluation.py +++ b/src/ethereum/forks/prague/vm/precompiled_contracts/point_evaluation.py @@ -8,7 +8,7 @@ Introduction ------------ -Implementation of the POINT EVALUATION precompiled contract. +Implementation of the `POINT EVALUATION` precompiled contract. """ from ethereum_types.bytes import Bytes, Bytes32, Bytes48 diff --git a/src/ethereum/forks/prague/vm/runtime.py b/src/ethereum/forks/prague/vm/runtime.py index 505b3488de8..0aa5ddd5e20 100644 --- a/src/ethereum/forks/prague/vm/runtime.py +++ b/src/ethereum/forks/prague/vm/runtime.py @@ -21,7 +21,7 @@ def get_valid_jump_destinations(code: Bytes) -> Set[Uint]: """ - Analyze the evm code to obtain the set of valid jump destinations. + Analyze the EVM code to obtain the set of valid jump destinations. Valid jump destinations are defined as follows: * The jump destination is less than the length of the code. diff --git a/src/ethereum/forks/shanghai/blocks.py b/src/ethereum/forks/shanghai/blocks.py index 74ecc48336c..aed53e2a4b3 100644 --- a/src/ethereum/forks/shanghai/blocks.py +++ b/src/ethereum/forks/shanghai/blocks.py @@ -150,7 +150,7 @@ class Header: number: Uint """ - Block number, (height) in the chain. + Block number (height) in the chain. """ gas_limit: Uint @@ -237,7 +237,7 @@ class Block: header: Header """ The block header containing metadata and cryptographic commitments. Refer - [headers] for more details on the fields included in the header. + to [headers] for more details on the fields included in the header. [headers]: ref:ethereum.forks.shanghai.blocks.Header """ diff --git a/src/ethereum/forks/shanghai/bloom.py b/src/ethereum/forks/shanghai/bloom.py index 8a12ec081dd..0e079df6b39 100644 --- a/src/ethereum/forks/shanghai/bloom.py +++ b/src/ethereum/forks/shanghai/bloom.py @@ -8,7 +8,7 @@ Introduction ------------ -This modules defines functions for calculating bloom filters of logs. For the +This module defines functions for calculating bloom filters of logs. For the general theory of bloom filters see e.g. `Wikipedia `_. Bloom filters are used to allow for efficient searching of logs by address and/or topic, by rapidly diff --git a/src/ethereum/forks/shanghai/state.py b/src/ethereum/forks/shanghai/state.py index ec753edd33f..8db1566f568 100644 --- a/src/ethereum/forks/shanghai/state.py +++ b/src/ethereum/forks/shanghai/state.py @@ -367,7 +367,7 @@ def account_exists(state: State, address: Address) -> bool: def account_has_code_or_nonce(state: State, address: Address) -> bool: """ - Checks if an account has non zero nonce or non empty code. + Checks if an account has non-zero nonce or non-empty code. Parameters ---------- @@ -379,7 +379,7 @@ def account_has_code_or_nonce(state: State, address: Address) -> bool: Returns ------- has_code_or_nonce : `bool` - True if the account has non zero nonce or non empty code, + True if the account has non-zero nonce or non-empty code, False otherwise. """ @@ -484,7 +484,7 @@ def set_account_balance(state: State, address: Address, amount: U256) -> None: Address of the account whose nonce needs to be incremented. amount: - The amount that needs to set in balance. + The amount that needs to be set in the balance. """ @@ -524,7 +524,7 @@ def set_code(state: State, address: Address, code: Bytes) -> None: The current state. address: - Address of the account whose code needs to be update. + Address of the account whose code needs to be updated. code: The bytecode that needs to be set. diff --git a/src/ethereum/forks/shanghai/trie.py b/src/ethereum/forks/shanghai/trie.py index ef363d889bb..9d4c25986ce 100644 --- a/src/ethereum/forks/shanghai/trie.py +++ b/src/ethereum/forks/shanghai/trie.py @@ -138,7 +138,7 @@ class BranchNode: def encode_internal_node(node: Optional[InternalNode]) -> Extended: """ Encodes a Merkle Trie node into its RLP form. The RLP will then be - serialized into a `Bytes` and hashed unless it is less that 32 bytes + serialized into a `Bytes` and hashed unless it is less than 32 bytes when serialized. This function also accepts `None`, representing the absence of a node, diff --git a/src/ethereum/forks/shanghai/vm/__init__.py b/src/ethereum/forks/shanghai/vm/__init__.py index ddff78c5372..e754cd3aa1b 100644 --- a/src/ethereum/forks/shanghai/vm/__init__.py +++ b/src/ethereum/forks/shanghai/vm/__init__.py @@ -61,7 +61,7 @@ class BlockOutput: receipts_trie : `ethereum.fork_types.Root` Trie root of all the receipts in the block. receipt_keys : - Key of all the receipts in the block. + Keys of all the receipts in the block. block_logs : `Bloom` Logs bloom of all the logs included in all the transactions of the block. diff --git a/src/ethereum/forks/shanghai/vm/gas.py b/src/ethereum/forks/shanghai/vm/gas.py index c3681112de0..e345cad4fd8 100644 --- a/src/ethereum/forks/shanghai/vm/gas.py +++ b/src/ethereum/forks/shanghai/vm/gas.py @@ -212,7 +212,7 @@ def calculate_message_call_gas( account inside a message call. call_stipend : The amount of stipend provided to a message call to execute code while - transferring value(ETH). + transferring value (ETH). Returns ------- diff --git a/src/ethereum/forks/shanghai/vm/instructions/arithmetic.py b/src/ethereum/forks/shanghai/vm/instructions/arithmetic.py index de5d6ab43d5..b7b1a370ad4 100644 --- a/src/ethereum/forks/shanghai/vm/instructions/arithmetic.py +++ b/src/ethereum/forks/shanghai/vm/instructions/arithmetic.py @@ -84,7 +84,7 @@ def sub(evm: Evm) -> None: def mul(evm: Evm) -> None: """ - Multiply the top two elements of the stack, and pushes the result back + Multiplies the top two elements of the stack, and pushes the result back on the stack. Parameters @@ -353,7 +353,7 @@ def signextend(evm: Evm) -> None: # Can't extend any further result = value else: - # U256(0).to_be_bytes() gives b'' instead b'\x00'. + # U256(0).to_be_bytes() gives b'' instead of b'\x00'. value_bytes = Bytes(value.to_be_bytes32()) # Now among the obtained value bytes, consider only # N `least significant bytes`, where N is `byte_num + 1`. diff --git a/src/ethereum/forks/shanghai/vm/instructions/block.py b/src/ethereum/forks/shanghai/vm/instructions/block.py index d9d8357b339..de2569869bd 100644 --- a/src/ethereum/forks/shanghai/vm/instructions/block.py +++ b/src/ethereum/forks/shanghai/vm/instructions/block.py @@ -101,7 +101,7 @@ def coinbase(evm: Evm) -> None: def timestamp(evm: Evm) -> None: """ Push the current block's timestamp onto the stack. Here the timestamp - being referred is actually the unix timestamp in seconds. + being referred to is actually the unix timestamp in seconds. Here the current block refers to the block in which the currently executing transaction/call resides. diff --git a/src/ethereum/forks/shanghai/vm/instructions/environment.py b/src/ethereum/forks/shanghai/vm/instructions/environment.py index 1abfaeafa9c..2a7b4346619 100644 --- a/src/ethereum/forks/shanghai/vm/instructions/environment.py +++ b/src/ethereum/forks/shanghai/vm/instructions/environment.py @@ -423,7 +423,7 @@ def returndatasize(evm: Evm) -> None: def returndatacopy(evm: Evm) -> None: """ - Copies data from the return data buffer code to memory. + Copies data from the return data buffer to memory. Parameters ---------- diff --git a/src/ethereum/forks/shanghai/vm/instructions/memory.py b/src/ethereum/forks/shanghai/vm/instructions/memory.py index fdd95188438..3a242ba2f7a 100644 --- a/src/ethereum/forks/shanghai/vm/instructions/memory.py +++ b/src/ethereum/forks/shanghai/vm/instructions/memory.py @@ -90,7 +90,7 @@ def mstore8(evm: Evm) -> None: def mload(evm: Evm) -> None: """ - Load word from memory. + Loads a word from memory. Parameters ---------- @@ -120,7 +120,7 @@ def mload(evm: Evm) -> None: def msize(evm: Evm) -> None: """ - Push the size of active memory in bytes onto the stack. + Pushes the size of active memory in bytes onto the stack. Parameters ---------- diff --git a/src/ethereum/forks/shanghai/vm/instructions/stack.py b/src/ethereum/forks/shanghai/vm/instructions/stack.py index e381b52c370..0007a28acd4 100644 --- a/src/ethereum/forks/shanghai/vm/instructions/stack.py +++ b/src/ethereum/forks/shanghai/vm/instructions/stack.py @@ -23,7 +23,7 @@ def pop(evm: Evm) -> None: """ - Remove item from stack. + Removes an item from the stack. Parameters ---------- @@ -46,7 +46,7 @@ def pop(evm: Evm) -> None: def push_n(evm: Evm, num_bytes: int) -> None: """ - Pushes a N-byte immediate onto the stack. Push zero if num_bytes is zero. + Pushes an N-byte immediate onto the stack. Push zero if num_bytes is zero. Parameters ---------- @@ -79,7 +79,7 @@ def push_n(evm: Evm, num_bytes: int) -> None: def dup_n(evm: Evm, item_number: int) -> None: """ - Duplicate the Nth stack item (from top of the stack) to the top of stack. + Duplicates the Nth stack item (from top of the stack) to the top of stack. Parameters ---------- @@ -107,7 +107,7 @@ def dup_n(evm: Evm, item_number: int) -> None: def swap_n(evm: Evm, item_number: int) -> None: """ - Swap the top and the `item_number` element of the stack, where + Swaps the top and the `item_number` element of the stack, where the top of the stack is position zero. If `item_number` is zero, this function does nothing (which should not be diff --git a/src/ethereum/forks/shanghai/vm/instructions/system.py b/src/ethereum/forks/shanghai/vm/instructions/system.py index 2b6382ad2b6..0a1e3244b23 100644 --- a/src/ethereum/forks/shanghai/vm/instructions/system.py +++ b/src/ethereum/forks/shanghai/vm/instructions/system.py @@ -190,8 +190,8 @@ def create2(evm: Evm) -> None: """ Creates a new account with associated code. - It's similar to CREATE opcode except that the address of new account - depends on the init_code instead of the nonce of sender. + It's similar to the CREATE opcode except that the address of the new + account depends on the init_code instead of the nonce of sender. Parameters ---------- diff --git a/src/ethereum/forks/shanghai/vm/precompiled_contracts/ecrecover.py b/src/ethereum/forks/shanghai/vm/precompiled_contracts/ecrecover.py index d2eeaf75df1..d8f6602e556 100644 --- a/src/ethereum/forks/shanghai/vm/precompiled_contracts/ecrecover.py +++ b/src/ethereum/forks/shanghai/vm/precompiled_contracts/ecrecover.py @@ -8,7 +8,7 @@ Introduction ------------ -Implementation of the ECRECOVER precompiled contract. +Implementation of the `ECRECOVER` precompiled contract. """ from ethereum_types.numeric import U256 diff --git a/src/ethereum/forks/shanghai/vm/precompiled_contracts/mapping.py b/src/ethereum/forks/shanghai/vm/precompiled_contracts/mapping.py index 827c44cfac7..44013f70e89 100644 --- a/src/ethereum/forks/shanghai/vm/precompiled_contracts/mapping.py +++ b/src/ethereum/forks/shanghai/vm/precompiled_contracts/mapping.py @@ -8,7 +8,7 @@ Introduction ------------ -Mapping of precompiled contracts their implementations. +Mapping of precompiled contracts to their implementations. """ from typing import Callable, Dict diff --git a/src/ethereum/forks/shanghai/vm/precompiled_contracts/modexp.py b/src/ethereum/forks/shanghai/vm/precompiled_contracts/modexp.py index 462341f69fd..755a396ddac 100644 --- a/src/ethereum/forks/shanghai/vm/precompiled_contracts/modexp.py +++ b/src/ethereum/forks/shanghai/vm/precompiled_contracts/modexp.py @@ -23,7 +23,7 @@ def modexp(evm: Evm) -> None: """ - Calculates `(base**exp) % modulus` for arbitrary sized `base`, `exp` and. + Calculates `(base**exp) % modulus` for arbitrary sized `base`, `exp` and `modulus`. The return value is the same length as the modulus. """ data = evm.message.data diff --git a/src/ethereum/forks/shanghai/vm/runtime.py b/src/ethereum/forks/shanghai/vm/runtime.py index 505b3488de8..0aa5ddd5e20 100644 --- a/src/ethereum/forks/shanghai/vm/runtime.py +++ b/src/ethereum/forks/shanghai/vm/runtime.py @@ -21,7 +21,7 @@ def get_valid_jump_destinations(code: Bytes) -> Set[Uint]: """ - Analyze the evm code to obtain the set of valid jump destinations. + Analyze the EVM code to obtain the set of valid jump destinations. Valid jump destinations are defined as follows: * The jump destination is less than the length of the code. diff --git a/src/ethereum/forks/spurious_dragon/blocks.py b/src/ethereum/forks/spurious_dragon/blocks.py index b0b15081d8e..507546a8f9b 100644 --- a/src/ethereum/forks/spurious_dragon/blocks.py +++ b/src/ethereum/forks/spurious_dragon/blocks.py @@ -112,7 +112,7 @@ class Header: number: Uint """ - Block number, (height) in the chain. + Block number (height) in the chain. """ gas_limit: Uint @@ -183,7 +183,7 @@ class Block: header: Header """ The block header containing metadata and cryptographic commitments. Refer - [headers] for more details on the fields included in the header. + to [headers] for more details on the fields included in the header. [headers]: ref:ethereum.forks.spurious_dragon.blocks.Header """ diff --git a/src/ethereum/forks/spurious_dragon/bloom.py b/src/ethereum/forks/spurious_dragon/bloom.py index 8a12ec081dd..0e079df6b39 100644 --- a/src/ethereum/forks/spurious_dragon/bloom.py +++ b/src/ethereum/forks/spurious_dragon/bloom.py @@ -8,7 +8,7 @@ Introduction ------------ -This modules defines functions for calculating bloom filters of logs. For the +This module defines functions for calculating bloom filters of logs. For the general theory of bloom filters see e.g. `Wikipedia `_. Bloom filters are used to allow for efficient searching of logs by address and/or topic, by rapidly diff --git a/src/ethereum/forks/spurious_dragon/state.py b/src/ethereum/forks/spurious_dragon/state.py index 2e21b4f8140..a0dd7d77ab8 100644 --- a/src/ethereum/forks/spurious_dragon/state.py +++ b/src/ethereum/forks/spurious_dragon/state.py @@ -340,7 +340,7 @@ def account_exists(state: State, address: Address) -> bool: def account_has_code_or_nonce(state: State, address: Address) -> bool: """ - Checks if an account has non zero nonce or non empty code. + Checks if an account has non-zero nonce or non-empty code. Parameters ---------- @@ -352,7 +352,7 @@ def account_has_code_or_nonce(state: State, address: Address) -> bool: Returns ------- has_code_or_nonce : `bool` - True if the account has non zero nonce or non empty code, + True if the account has non-zero nonce or non-empty code, False otherwise. """ @@ -473,7 +473,7 @@ def set_account_balance(state: State, address: Address, amount: U256) -> None: Address of the account whose nonce needs to be incremented. amount: - The amount that needs to set in balance. + The amount that needs to be set in the balance. """ @@ -493,7 +493,7 @@ def touch_account(state: State, address: Address) -> None: The current state. address: - The address of the account that need to initialised. + The address of the account that needs to be initialized. """ if not account_exists(state, address): @@ -530,7 +530,7 @@ def set_code(state: State, address: Address, code: Bytes) -> None: The current state. address: - Address of the account whose code needs to be update. + Address of the account whose code needs to be updated. code: The bytecode that needs to be set. diff --git a/src/ethereum/forks/spurious_dragon/trie.py b/src/ethereum/forks/spurious_dragon/trie.py index d603f5ee411..fce2ff05bfd 100644 --- a/src/ethereum/forks/spurious_dragon/trie.py +++ b/src/ethereum/forks/spurious_dragon/trie.py @@ -128,7 +128,7 @@ class BranchNode: def encode_internal_node(node: Optional[InternalNode]) -> Extended: """ Encodes a Merkle Trie node into its RLP form. The RLP will then be - serialized into a `Bytes` and hashed unless it is less that 32 bytes + serialized into a `Bytes` and hashed unless it is less than 32 bytes when serialized. This function also accepts `None`, representing the absence of a node, diff --git a/src/ethereum/forks/spurious_dragon/vm/__init__.py b/src/ethereum/forks/spurious_dragon/vm/__init__.py index 1e3c0b3767d..2ab52236b67 100644 --- a/src/ethereum/forks/spurious_dragon/vm/__init__.py +++ b/src/ethereum/forks/spurious_dragon/vm/__init__.py @@ -61,7 +61,7 @@ class BlockOutput: receipts_trie : `ethereum.fork_types.Root` Trie root of all the receipts in the block. receipt_keys : - Key of all the receipts in the block. + Keys of all the receipts in the block. block_logs : `Bloom` Logs bloom of all the logs included in all the transactions of the block. diff --git a/src/ethereum/forks/spurious_dragon/vm/gas.py b/src/ethereum/forks/spurious_dragon/vm/gas.py index af0da82f6e1..9bc7122f91b 100644 --- a/src/ethereum/forks/spurious_dragon/vm/gas.py +++ b/src/ethereum/forks/spurious_dragon/vm/gas.py @@ -210,7 +210,7 @@ def calculate_message_call_gas( account inside a message call. call_stipend : The amount of stipend provided to a message call to execute code while - transferring value(ETH). + transferring value (ETH). Returns ------- diff --git a/src/ethereum/forks/spurious_dragon/vm/instructions/arithmetic.py b/src/ethereum/forks/spurious_dragon/vm/instructions/arithmetic.py index de5d6ab43d5..b7b1a370ad4 100644 --- a/src/ethereum/forks/spurious_dragon/vm/instructions/arithmetic.py +++ b/src/ethereum/forks/spurious_dragon/vm/instructions/arithmetic.py @@ -84,7 +84,7 @@ def sub(evm: Evm) -> None: def mul(evm: Evm) -> None: """ - Multiply the top two elements of the stack, and pushes the result back + Multiplies the top two elements of the stack, and pushes the result back on the stack. Parameters @@ -353,7 +353,7 @@ def signextend(evm: Evm) -> None: # Can't extend any further result = value else: - # U256(0).to_be_bytes() gives b'' instead b'\x00'. + # U256(0).to_be_bytes() gives b'' instead of b'\x00'. value_bytes = Bytes(value.to_be_bytes32()) # Now among the obtained value bytes, consider only # N `least significant bytes`, where N is `byte_num + 1`. diff --git a/src/ethereum/forks/spurious_dragon/vm/instructions/block.py b/src/ethereum/forks/spurious_dragon/vm/instructions/block.py index 8b50f1bc07f..0edcbf000d1 100644 --- a/src/ethereum/forks/spurious_dragon/vm/instructions/block.py +++ b/src/ethereum/forks/spurious_dragon/vm/instructions/block.py @@ -87,7 +87,7 @@ def coinbase(evm: Evm) -> None: def timestamp(evm: Evm) -> None: """ Push the current block's timestamp onto the stack. Here the timestamp - being referred is actually the unix timestamp in seconds. + being referred to is actually the unix timestamp in seconds. Here the current block refers to the block in which the currently executing transaction/call resides. diff --git a/src/ethereum/forks/spurious_dragon/vm/instructions/memory.py b/src/ethereum/forks/spurious_dragon/vm/instructions/memory.py index fdd95188438..3a242ba2f7a 100644 --- a/src/ethereum/forks/spurious_dragon/vm/instructions/memory.py +++ b/src/ethereum/forks/spurious_dragon/vm/instructions/memory.py @@ -90,7 +90,7 @@ def mstore8(evm: Evm) -> None: def mload(evm: Evm) -> None: """ - Load word from memory. + Loads a word from memory. Parameters ---------- @@ -120,7 +120,7 @@ def mload(evm: Evm) -> None: def msize(evm: Evm) -> None: """ - Push the size of active memory in bytes onto the stack. + Pushes the size of active memory in bytes onto the stack. Parameters ---------- diff --git a/src/ethereum/forks/spurious_dragon/vm/instructions/stack.py b/src/ethereum/forks/spurious_dragon/vm/instructions/stack.py index bdf232db6a8..0fc0d3fe4b5 100644 --- a/src/ethereum/forks/spurious_dragon/vm/instructions/stack.py +++ b/src/ethereum/forks/spurious_dragon/vm/instructions/stack.py @@ -23,7 +23,7 @@ def pop(evm: Evm) -> None: """ - Remove item from stack. + Removes an item from the stack. Parameters ---------- @@ -46,7 +46,7 @@ def pop(evm: Evm) -> None: def push_n(evm: Evm, num_bytes: int) -> None: """ - Pushes a N-byte immediate onto the stack. + Pushes an N-byte immediate onto the stack. Parameters ---------- @@ -76,7 +76,7 @@ def push_n(evm: Evm, num_bytes: int) -> None: def dup_n(evm: Evm, item_number: int) -> None: """ - Duplicate the Nth stack item (from top of the stack) to the top of stack. + Duplicates the Nth stack item (from top of the stack) to the top of stack. Parameters ---------- @@ -104,7 +104,7 @@ def dup_n(evm: Evm, item_number: int) -> None: def swap_n(evm: Evm, item_number: int) -> None: """ - Swap the top and the `item_number` element of the stack, where + Swaps the top and the `item_number` element of the stack, where the top of the stack is position zero. If `item_number` is zero, this function does nothing (which should not be diff --git a/src/ethereum/forks/spurious_dragon/vm/precompiled_contracts/ecrecover.py b/src/ethereum/forks/spurious_dragon/vm/precompiled_contracts/ecrecover.py index d2eeaf75df1..d8f6602e556 100644 --- a/src/ethereum/forks/spurious_dragon/vm/precompiled_contracts/ecrecover.py +++ b/src/ethereum/forks/spurious_dragon/vm/precompiled_contracts/ecrecover.py @@ -8,7 +8,7 @@ Introduction ------------ -Implementation of the ECRECOVER precompiled contract. +Implementation of the `ECRECOVER` precompiled contract. """ from ethereum_types.numeric import U256 diff --git a/src/ethereum/forks/spurious_dragon/vm/precompiled_contracts/mapping.py b/src/ethereum/forks/spurious_dragon/vm/precompiled_contracts/mapping.py index 33412f4c283..1d44a6f2e37 100644 --- a/src/ethereum/forks/spurious_dragon/vm/precompiled_contracts/mapping.py +++ b/src/ethereum/forks/spurious_dragon/vm/precompiled_contracts/mapping.py @@ -8,7 +8,7 @@ Introduction ------------ -Mapping of precompiled contracts their implementations. +Mapping of precompiled contracts to their implementations. """ from typing import Callable, Dict diff --git a/src/ethereum/forks/spurious_dragon/vm/runtime.py b/src/ethereum/forks/spurious_dragon/vm/runtime.py index 505b3488de8..0aa5ddd5e20 100644 --- a/src/ethereum/forks/spurious_dragon/vm/runtime.py +++ b/src/ethereum/forks/spurious_dragon/vm/runtime.py @@ -21,7 +21,7 @@ def get_valid_jump_destinations(code: Bytes) -> Set[Uint]: """ - Analyze the evm code to obtain the set of valid jump destinations. + Analyze the EVM code to obtain the set of valid jump destinations. Valid jump destinations are defined as follows: * The jump destination is less than the length of the code. diff --git a/src/ethereum/forks/tangerine_whistle/blocks.py b/src/ethereum/forks/tangerine_whistle/blocks.py index 310d2bfe3d1..664418b9f72 100644 --- a/src/ethereum/forks/tangerine_whistle/blocks.py +++ b/src/ethereum/forks/tangerine_whistle/blocks.py @@ -112,7 +112,7 @@ class Header: number: Uint """ - Block number, (height) in the chain. + Block number (height) in the chain. """ gas_limit: Uint @@ -183,7 +183,7 @@ class Block: header: Header """ The block header containing metadata and cryptographic commitments. Refer - [headers] for more details on the fields included in the header. + to [headers] for more details on the fields included in the header. [headers]: ref:ethereum.forks.tangerine_whistle.blocks.Header """ diff --git a/src/ethereum/forks/tangerine_whistle/bloom.py b/src/ethereum/forks/tangerine_whistle/bloom.py index 8a12ec081dd..0e079df6b39 100644 --- a/src/ethereum/forks/tangerine_whistle/bloom.py +++ b/src/ethereum/forks/tangerine_whistle/bloom.py @@ -8,7 +8,7 @@ Introduction ------------ -This modules defines functions for calculating bloom filters of logs. For the +This module defines functions for calculating bloom filters of logs. For the general theory of bloom filters see e.g. `Wikipedia `_. Bloom filters are used to allow for efficient searching of logs by address and/or topic, by rapidly diff --git a/src/ethereum/forks/tangerine_whistle/state.py b/src/ethereum/forks/tangerine_whistle/state.py index 8fb03a07fe9..3b6255055d7 100644 --- a/src/ethereum/forks/tangerine_whistle/state.py +++ b/src/ethereum/forks/tangerine_whistle/state.py @@ -340,7 +340,7 @@ def account_exists(state: State, address: Address) -> bool: def account_has_code_or_nonce(state: State, address: Address) -> bool: """ - Checks if an account has non zero nonce or non empty code. + Checks if an account has non-zero nonce or non-empty code. Parameters ---------- @@ -352,7 +352,7 @@ def account_has_code_or_nonce(state: State, address: Address) -> bool: Returns ------- has_code_or_nonce : `bool` - True if the account has non zero nonce or non empty code, + True if the account has non-zero nonce or non-empty code, False otherwise. """ @@ -424,7 +424,7 @@ def set_account_balance(state: State, address: Address, amount: U256) -> None: Address of the account whose nonce needs to be incremented. amount: - The amount that needs to set in balance. + The amount that needs to be set in the balance. """ @@ -444,7 +444,7 @@ def touch_account(state: State, address: Address) -> None: The current state. address: - The address of the account that need to initialised. + The address of the account that needs to be initialized. """ if not account_exists(state, address): @@ -481,7 +481,7 @@ def set_code(state: State, address: Address, code: Bytes) -> None: The current state. address: - Address of the account whose code needs to be update. + Address of the account whose code needs to be updated. code: The bytecode that needs to be set. diff --git a/src/ethereum/forks/tangerine_whistle/trie.py b/src/ethereum/forks/tangerine_whistle/trie.py index 77d2c169835..a7580519410 100644 --- a/src/ethereum/forks/tangerine_whistle/trie.py +++ b/src/ethereum/forks/tangerine_whistle/trie.py @@ -128,7 +128,7 @@ class BranchNode: def encode_internal_node(node: Optional[InternalNode]) -> Extended: """ Encodes a Merkle Trie node into its RLP form. The RLP will then be - serialized into a `Bytes` and hashed unless it is less that 32 bytes + serialized into a `Bytes` and hashed unless it is less than 32 bytes when serialized. This function also accepts `None`, representing the absence of a node, diff --git a/src/ethereum/forks/tangerine_whistle/vm/__init__.py b/src/ethereum/forks/tangerine_whistle/vm/__init__.py index 21585c758c5..e4739cebdef 100644 --- a/src/ethereum/forks/tangerine_whistle/vm/__init__.py +++ b/src/ethereum/forks/tangerine_whistle/vm/__init__.py @@ -60,7 +60,7 @@ class BlockOutput: receipts_trie : `ethereum.fork_types.Root` Trie root of all the receipts in the block. receipt_keys : - Key of all the receipts in the block. + Keys of all the receipts in the block. block_logs : `Bloom` Logs bloom of all the logs included in all the transactions of the block. diff --git a/src/ethereum/forks/tangerine_whistle/vm/gas.py b/src/ethereum/forks/tangerine_whistle/vm/gas.py index b930942995b..0187f55d95b 100644 --- a/src/ethereum/forks/tangerine_whistle/vm/gas.py +++ b/src/ethereum/forks/tangerine_whistle/vm/gas.py @@ -210,7 +210,7 @@ def calculate_message_call_gas( account inside a message call. call_stipend : The amount of stipend provided to a message call to execute code while - transferring value(ETH). + transferring value (ETH). Returns ------- diff --git a/src/ethereum/forks/tangerine_whistle/vm/instructions/arithmetic.py b/src/ethereum/forks/tangerine_whistle/vm/instructions/arithmetic.py index de5d6ab43d5..b7b1a370ad4 100644 --- a/src/ethereum/forks/tangerine_whistle/vm/instructions/arithmetic.py +++ b/src/ethereum/forks/tangerine_whistle/vm/instructions/arithmetic.py @@ -84,7 +84,7 @@ def sub(evm: Evm) -> None: def mul(evm: Evm) -> None: """ - Multiply the top two elements of the stack, and pushes the result back + Multiplies the top two elements of the stack, and pushes the result back on the stack. Parameters @@ -353,7 +353,7 @@ def signextend(evm: Evm) -> None: # Can't extend any further result = value else: - # U256(0).to_be_bytes() gives b'' instead b'\x00'. + # U256(0).to_be_bytes() gives b'' instead of b'\x00'. value_bytes = Bytes(value.to_be_bytes32()) # Now among the obtained value bytes, consider only # N `least significant bytes`, where N is `byte_num + 1`. diff --git a/src/ethereum/forks/tangerine_whistle/vm/instructions/block.py b/src/ethereum/forks/tangerine_whistle/vm/instructions/block.py index 8b50f1bc07f..0edcbf000d1 100644 --- a/src/ethereum/forks/tangerine_whistle/vm/instructions/block.py +++ b/src/ethereum/forks/tangerine_whistle/vm/instructions/block.py @@ -87,7 +87,7 @@ def coinbase(evm: Evm) -> None: def timestamp(evm: Evm) -> None: """ Push the current block's timestamp onto the stack. Here the timestamp - being referred is actually the unix timestamp in seconds. + being referred to is actually the unix timestamp in seconds. Here the current block refers to the block in which the currently executing transaction/call resides. diff --git a/src/ethereum/forks/tangerine_whistle/vm/instructions/memory.py b/src/ethereum/forks/tangerine_whistle/vm/instructions/memory.py index fdd95188438..3a242ba2f7a 100644 --- a/src/ethereum/forks/tangerine_whistle/vm/instructions/memory.py +++ b/src/ethereum/forks/tangerine_whistle/vm/instructions/memory.py @@ -90,7 +90,7 @@ def mstore8(evm: Evm) -> None: def mload(evm: Evm) -> None: """ - Load word from memory. + Loads a word from memory. Parameters ---------- @@ -120,7 +120,7 @@ def mload(evm: Evm) -> None: def msize(evm: Evm) -> None: """ - Push the size of active memory in bytes onto the stack. + Pushes the size of active memory in bytes onto the stack. Parameters ---------- diff --git a/src/ethereum/forks/tangerine_whistle/vm/instructions/stack.py b/src/ethereum/forks/tangerine_whistle/vm/instructions/stack.py index bdf232db6a8..0fc0d3fe4b5 100644 --- a/src/ethereum/forks/tangerine_whistle/vm/instructions/stack.py +++ b/src/ethereum/forks/tangerine_whistle/vm/instructions/stack.py @@ -23,7 +23,7 @@ def pop(evm: Evm) -> None: """ - Remove item from stack. + Removes an item from the stack. Parameters ---------- @@ -46,7 +46,7 @@ def pop(evm: Evm) -> None: def push_n(evm: Evm, num_bytes: int) -> None: """ - Pushes a N-byte immediate onto the stack. + Pushes an N-byte immediate onto the stack. Parameters ---------- @@ -76,7 +76,7 @@ def push_n(evm: Evm, num_bytes: int) -> None: def dup_n(evm: Evm, item_number: int) -> None: """ - Duplicate the Nth stack item (from top of the stack) to the top of stack. + Duplicates the Nth stack item (from top of the stack) to the top of stack. Parameters ---------- @@ -104,7 +104,7 @@ def dup_n(evm: Evm, item_number: int) -> None: def swap_n(evm: Evm, item_number: int) -> None: """ - Swap the top and the `item_number` element of the stack, where + Swaps the top and the `item_number` element of the stack, where the top of the stack is position zero. If `item_number` is zero, this function does nothing (which should not be diff --git a/src/ethereum/forks/tangerine_whistle/vm/precompiled_contracts/ecrecover.py b/src/ethereum/forks/tangerine_whistle/vm/precompiled_contracts/ecrecover.py index d2eeaf75df1..d8f6602e556 100644 --- a/src/ethereum/forks/tangerine_whistle/vm/precompiled_contracts/ecrecover.py +++ b/src/ethereum/forks/tangerine_whistle/vm/precompiled_contracts/ecrecover.py @@ -8,7 +8,7 @@ Introduction ------------ -Implementation of the ECRECOVER precompiled contract. +Implementation of the `ECRECOVER` precompiled contract. """ from ethereum_types.numeric import U256 diff --git a/src/ethereum/forks/tangerine_whistle/vm/precompiled_contracts/mapping.py b/src/ethereum/forks/tangerine_whistle/vm/precompiled_contracts/mapping.py index 33412f4c283..1d44a6f2e37 100644 --- a/src/ethereum/forks/tangerine_whistle/vm/precompiled_contracts/mapping.py +++ b/src/ethereum/forks/tangerine_whistle/vm/precompiled_contracts/mapping.py @@ -8,7 +8,7 @@ Introduction ------------ -Mapping of precompiled contracts their implementations. +Mapping of precompiled contracts to their implementations. """ from typing import Callable, Dict diff --git a/src/ethereum/forks/tangerine_whistle/vm/runtime.py b/src/ethereum/forks/tangerine_whistle/vm/runtime.py index 505b3488de8..0aa5ddd5e20 100644 --- a/src/ethereum/forks/tangerine_whistle/vm/runtime.py +++ b/src/ethereum/forks/tangerine_whistle/vm/runtime.py @@ -21,7 +21,7 @@ def get_valid_jump_destinations(code: Bytes) -> Set[Uint]: """ - Analyze the evm code to obtain the set of valid jump destinations. + Analyze the EVM code to obtain the set of valid jump destinations. Valid jump destinations are defined as follows: * The jump destination is less than the length of the code. diff --git a/src/ethereum_spec_tools/docc.py b/src/ethereum_spec_tools/docc.py index f99ef60777e..cc1623174aa 100644 --- a/src/ethereum_spec_tools/docc.py +++ b/src/ethereum_spec_tools/docc.py @@ -371,7 +371,7 @@ class FixIndexTransform(Transform): identifiers specific to the diff. Without fixing these identifiers, every Python class would be defined - multiples times (the actual definition and then again in each diff), + multiple times (the actual definition and then again in each diff), cluttering up tables of contents. """ diff --git a/src/ethereum_spec_tools/evm_tools/daemon.py b/src/ethereum_spec_tools/evm_tools/daemon.py index 67ba3ede969..39268f04df2 100644 --- a/src/ethereum_spec_tools/evm_tools/daemon.py +++ b/src/ethereum_spec_tools/evm_tools/daemon.py @@ -25,7 +25,7 @@ def daemon_arguments(subparsers: argparse._SubParsersAction) -> None: parser.add_argument("--uds", help="Unix domain socket path") parser.add_argument( "--timeout", - help="Timeout to shutdown daemon if there are not requests" + help="Timeout to shutdown daemon if there are no requests" " (0 for no timeout)", type=int, ) diff --git a/src/ethereum_spec_tools/evm_tools/t8n/t8n_types.py b/src/ethereum_spec_tools/evm_tools/t8n/t8n_types.py index c60c266965d..74b3ea2df6d 100644 --- a/src/ethereum_spec_tools/evm_tools/t8n/t8n_types.py +++ b/src/ethereum_spec_tools/evm_tools/t8n/t8n_types.py @@ -37,7 +37,7 @@ def __init__(self, t8n: "T8N", stdin: Optional[Dict] = None): with open(t8n.options.input_alloc, "r") as f: data = json.load(f) - # The json_to_state functions expects the values to hex + # The json_to_state function expects the values to be hex # strings, so we convert them here. for address, account in data.items(): for key, value in account.items(): diff --git a/src/ethereum_spec_tools/lint/__init__.py b/src/ethereum_spec_tools/lint/__init__.py index edd8565f745..f3cc4ae45da 100644 --- a/src/ethereum_spec_tools/lint/__init__.py +++ b/src/ethereum_spec_tools/lint/__init__.py @@ -18,7 +18,7 @@ def compare_ast(old: ast.AST, new: ast.AST) -> bool: """ - Check if two nodes are the equal. + Checks if two nodes are equal. """ if type(old) is not type(new): return False diff --git a/src/ethereum_spec_tools/new_fork/builder.py b/src/ethereum_spec_tools/new_fork/builder.py index cb625d214e8..05f875a923d 100644 --- a/src/ethereum_spec_tools/new_fork/builder.py +++ b/src/ethereum_spec_tools/new_fork/builder.py @@ -413,7 +413,7 @@ def _create_working_directory(self) -> TemporaryDirectory: """ Create a temporary working directory so we don't end up in the state where this process ~~barfs~~ abnormally terminates and we leave a - half-modified fork directory laying around. + half-modified fork directory lying around. """ output = self.new_fork_path.parent output.mkdir(parents=True, exist_ok=True)