Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: delete hack #123

Merged
merged 3 commits into from
Feb 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 1 addition & 44 deletions ape_hardhat/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,50 +417,7 @@ def send_transaction(self, txn: TransactionAPI) -> ReceiptAPI:
receipt.raise_for_status()

else:
try:
txn_hash = self.web3.eth.send_raw_transaction(txn.serialize_transaction())
except ValueError as err:
vm_err = self.get_virtual_machine_error(err, txn=txn)

if "nonce too low" in str(vm_err):
# Add additional nonce information
new_err_msg = f"Nonce '{txn.nonce}' is too low"
raise VirtualMachineError(
new_err_msg, base_err=vm_err.base_err, code=vm_err.code
)

vm_err.txn = txn
raise vm_err from err

receipt = self.get_receipt(
txn_hash.hex(),
required_confirmations=(
txn.required_confirmations
if txn.required_confirmations is not None
else self.network.required_confirmations
),
)

if receipt.failed:
txn_dict = receipt.transaction.dict()
if isinstance(txn_dict.get("type"), int):
txn_dict["type"] = HexBytes(txn_dict["type"]).hex()

txn_params = cast(TxParams, txn_dict)

# Replay txn to get revert reason
try:
self.web3.eth.call(txn_params)
except Exception as err:
vm_err = self.get_virtual_machine_error(err, txn=txn)
vm_err.txn = txn
raise vm_err from err

logger.info(
f"Confirmed {receipt.txn_hash} (total fees paid = {receipt.total_fees_paid})"
)
self.chain_manager.history.append(receipt)
return receipt
receipt = super().send_transaction(txn)

return receipt

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
url="https://github.com/ApeWorX/ape-hardhat",
include_package_data=True,
install_requires=[
"eth-ape>=0.6.0,<0.7",
"eth-ape>=0.6.1,<0.7",
"evm-trace", # Use same version as eth-ape
"hexbytes", # Use same version as eth-ape
"web3", # Use same version as eth-ape
Expand Down