Skip to content

Commit

Permalink
port ethereum#1098 and ethereum#1011 to forks/prague (ethereum#1102)
Browse files Browse the repository at this point in the history
* port ethereum#1098 to prague

* port ethereum#1011 to prague
  • Loading branch information
gurukamath authored and nerolation committed Feb 9, 2025
1 parent 3a4ba6f commit 44a7fb1
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 13 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/gh-pages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Upload Pages Artifact
id: artifact
uses: actions/upload-pages-artifact@v2
uses: actions/upload-pages-artifact@v3
with:
path: .tox/docs

Expand All @@ -46,6 +46,7 @@ jobs:
permissions:
pages: write
id-token: write
actions: read

environment:
name: github-pages
Expand All @@ -54,4 +55,4 @@ jobs:
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
uses: actions/deploy-pages@v4
10 changes: 7 additions & 3 deletions src/ethereum/prague/fork.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@
from ethereum_types.numeric import U64, U256, Uint

from ethereum.crypto.hash import Hash32, keccak256
from ethereum.exceptions import InvalidBlock, InvalidSenderError
from ethereum.exceptions import (
EthereumException,
InvalidBlock,
InvalidSenderError,
)

from . import vm
from .blocks import Block, Header, Log, Receipt, Withdrawal, encode_receipt
Expand Down Expand Up @@ -453,7 +457,7 @@ def check_transaction(

def make_receipt(
tx: Transaction,
error: Optional[Exception],
error: Optional[EthereumException],
cumulative_gas_used: Uint,
logs: Tuple[Log, ...],
) -> Union[Bytes, Receipt]:
Expand Down Expand Up @@ -925,7 +929,7 @@ def process_general_purpose_requests(

def process_transaction(
env: vm.Environment, tx: Transaction
) -> Tuple[Uint, Tuple[Log, ...], Optional[Exception]]:
) -> Tuple[Uint, Tuple[Log, ...], Optional[EthereumException]]:
"""
Execute a transaction against the provided environment.
Expand Down
6 changes: 3 additions & 3 deletions src/ethereum/prague/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
`EMPTY_ACCOUNT`.
"""
from dataclasses import dataclass, field
from typing import Callable, Dict, Iterable, List, Optional, Set, Tuple
from typing import Callable, Dict, List, Optional, Set, Tuple

from ethereum_types.bytes import Bytes, Bytes32
from ethereum_types.frozen import modify
Expand Down Expand Up @@ -719,15 +719,15 @@ def set_transient_storage(


def destroy_touched_empty_accounts(
state: State, touched_accounts: Iterable[Address]
state: State, touched_accounts: Set[Address]
) -> None:
"""
Destroy all touched accounts that are empty.
Parameters
----------
state: `State`
The current state.
touched_accounts: `Iterable[Address]`
touched_accounts: `Set[Address]`
All the accounts that have been touched in the current transaction.
"""
for address in touched_accounts:
Expand Down
3 changes: 2 additions & 1 deletion src/ethereum/prague/vm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from ethereum_types.numeric import U64, U256, Uint

from ethereum.crypto.hash import Hash32
from ethereum.exceptions import EthereumException

from ..blocks import Log
from ..fork_types import Address, Authorization, VersionedHash
Expand Down Expand Up @@ -95,7 +96,7 @@ class Evm:
accounts_to_delete: Set[Address]
touched_accounts: Set[Address]
return_data: Bytes
error: Optional[Exception]
error: Optional[EthereumException]
accessed_addresses: Set[Address]
accessed_storage_keys: Set[Tuple[Address, Bytes32]]

Expand Down
9 changes: 5 additions & 4 deletions src/ethereum/prague/vm/interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
A straightforward interpreter that executes EVM code.
"""
from dataclasses import dataclass
from typing import Iterable, Optional, Set, Tuple, Union
from typing import Optional, Set, Tuple

from ethereum_types.bytes import Bytes, Bytes0
from ethereum_types.numeric import U256, Uint, ulen

from ethereum.exceptions import EthereumException
from ethereum.trace import (
EvmStop,
OpEnd,
Expand Down Expand Up @@ -83,10 +84,10 @@ class MessageCallOutput:

gas_left: Uint
refund_counter: U256
logs: Union[Tuple[()], Tuple[Log, ...]]
logs: Tuple[Log, ...]
accounts_to_delete: Set[Address]
touched_accounts: Iterable[Address]
error: Optional[Exception]
touched_accounts: Set[Address]
error: Optional[EthereumException]
return_data: Bytes


Expand Down

0 comments on commit 44a7fb1

Please sign in to comment.