Skip to content

Commit

Permalink
Merge pull request eth-brownie#1652 from wirew0lf/master
Browse files Browse the repository at this point in the history
Ganache 7.7.x support and fixes for anvil
  • Loading branch information
iamdefinitelyahuman authored Jan 29, 2023
2 parents c842d53 + 12cff5e commit 255de2d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ This changelog format is based on [Keep a Changelog](https://keepachangelog.com/
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased](https://github.com/eth-brownie/brownie)
### Added
- Ganache 7.7.x support.

### Fixed
- Anvil support, you can now access trace, events and return_value for anvil transactions.
- Removes `eth-abi` depreciation warnings
- Bump web3.py dep to support async provider in threaded applications

Expand Down
12 changes: 9 additions & 3 deletions brownie/network/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,9 @@ def _get_trace(self) -> None:
raise RPCRequestError("Node client does not support `debug_traceTransaction`")
try:
trace = web3.provider.make_request( # type: ignore
"debug_traceTransaction", (self.txid, {"disableStorage": CONFIG.mode != "console"})
# Set enableMemory to all RPC as anvil return the memory key
"debug_traceTransaction", (self.txid, {
"disableStorage": CONFIG.mode != "console", "enableMemory": True})
)
except (requests.exceptions.Timeout, requests.exceptions.ConnectionError) as e:
msg = f"Encountered a {type(e).__name__} while requesting "
Expand Down Expand Up @@ -674,8 +676,12 @@ def _get_trace(self) -> None:
if fix_gas:
# handle traces where numeric values are returned as hex (Nethermind)
step["gas"] = int(step["gas"], 16)
step["gasCost"] = int.from_bytes(HexBytes(step["gasCost"]), "big", signed=True)
step["pc"] = int(step["pc"], 16)
# Check if gasCost is hex before converting.
if isinstance(step["gasCost"], str):
step["gasCost"] = int.from_bytes(
HexBytes(step["gasCost"]), "big", signed=True)
if isinstance(step["pc"], str): # Check if pc is hex before converting.
step["pc"] = int(step["pc"], 16)

if self.status:
self._confirmed_trace(trace)
Expand Down
2 changes: 1 addition & 1 deletion brownie/project/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def _generate_revert_map(self, pcMap: Dict, source_map: Dict, language: str) ->
for k, v in pcMap.items()
if v["op"] in ("REVERT", "INVALID") or "jump_revert" in v
):
if "path" not in data:
if "path" not in data or data["path"] == None:
continue
path_str = source_map[data["path"]]

Expand Down

0 comments on commit 255de2d

Please sign in to comment.