Skip to content

Commit

Permalink
fix: move sol to right spot, avoid breaking
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey committed Dec 23, 2024
1 parent 6c93f6b commit e6a60cb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
8 changes: 0 additions & 8 deletions src/ape_ethereum/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -722,14 +722,6 @@ def get_receipt(

def _create_receipt(self, **kwargs) -> ReceiptAPI:
data = {"provider": self, **kwargs}

if "block_number" not in data:
# Likely not a confirmed receipt.
data["block_number"] = 1
if "status" not in data:
# May change if not yet confirmed.
data["status"] = TransactionStatusEnum.NO_ERROR

return self.network.ecosystem.decode_receipt(data)

def get_transactions_by_block(self, block_id: "BlockID") -> Iterator[TransactionAPI]:
Expand Down
15 changes: 10 additions & 5 deletions src/ape_test/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
from ape.utils.testing import DEFAULT_TEST_HD_PATH
from ape_ethereum.provider import Web3Provider
from ape_ethereum.trace import TraceApproach, TransactionTrace
from ape_ethereum.transactions import TransactionStatusEnum
from ape_test.config import EthTesterProviderConfig

if TYPE_CHECKING:
Expand Down Expand Up @@ -342,11 +343,15 @@ def send_transaction(self, txn: "TransactionAPI") -> "ReceiptAPI":

required_confirmations = txn.required_confirmations or 0
if vm_err or not self.auto_mine:
receipt = self._create_receipt(
required_confirmations=required_confirmations,
error=vm_err,
txn_hash=txn_hash,
)
receipt_data = {
"block_number": -1, # Not yet confirmed,
"error": vm_err,
"provider": self,
"required_confirmations": required_confirmations,
"status": TransactionStatusEnum.NO_ERROR,
"txn_hash": txn_hash,
}
receipt = self.network.ecosystem.decode_receipt(receipt_data)
else:
txn_dict = txn_dict or txn.model_dump(mode="json")

Expand Down

0 comments on commit e6a60cb

Please sign in to comment.