diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index e1143e4fe..64e63e252 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -58,7 +58,7 @@ jobs: uses: actions/setup-node@v1 - name: Install Ganache - run: npm install -g ganache-cli@6.8.2 + run: npm install -g ganache-cli@6.10.1 - name: Setup Python 3.8 uses: actions/setup-python@v1 @@ -98,7 +98,7 @@ jobs: uses: actions/setup-node@v1 - name: Install Ganache - run: npm install -g ganache-cli@6.8.2 + run: npm install -g ganache-cli@6.10.1 - name: Setup Python 3.8 uses: actions/setup-python@v1 @@ -138,7 +138,7 @@ jobs: uses: actions/setup-node@v1 - name: Install Ganache - run: npm install -g ganache-cli@6.8.2 + run: npm install -g ganache-cli@6.10.1 - name: Setup Python 3.8 uses: actions/setup-python@v1 @@ -172,7 +172,7 @@ jobs: uses: actions/setup-node@v1 - name: Install Ganache - run: npm install -g ganache-cli@6.8.2 + run: npm install -g ganache-cli@6.10.1 - name: Setup Python 3.7 uses: actions/setup-python@v1 @@ -206,7 +206,7 @@ jobs: uses: actions/setup-node@v1 - name: Install Ganache - run: npm install -g ganache-cli@6.8.2 + run: npm install -g ganache-cli@6.10.1 - name: Setup Python 3.6 uses: actions/setup-python@v1 diff --git a/README.md b/README.md index 60503e08d..a5827a580 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Brownie is a Python-based development and testing framework for smart contracts ## Dependencies * [python3](https://www.python.org/downloads/release/python-368/) version 3.6 or greater, python3-dev -* [ganache-cli](https://github.com/trufflesuite/ganache-cli) - tested with version [6.8.2](https://github.com/trufflesuite/ganache-cli/releases/tag/v6.8.2) +* [ganache-cli](https://github.com/trufflesuite/ganache-cli) - tested with version [6.10.1](https://github.com/trufflesuite/ganache-cli/releases/tag/v6.10.1) ## Installation diff --git a/brownie/network/transaction.py b/brownie/network/transaction.py index 6c9697d42..cb4a94ce8 100644 --- a/brownie/network/transaction.py +++ b/brownie/network/transaction.py @@ -545,10 +545,15 @@ def _expand_trace(self) -> None: t["depth"] = t["depth"] - 1 else: self._trace_origin = "ganache" - self._call_cost = trace[0]["gasCost"] - for i in range(len(trace) - 1): - trace[i]["gasCost"] = trace[i + 1]["gasCost"] - trace[-1]["gasCost"] = 0 + if trace[0]["gasCost"] >= 21000: + # in ganache <6.10.0, gas costs are shifted by one step - we can + # identify this when the first step has a gas cost >= 21000 + self._call_cost = trace[0]["gasCost"] + for i in range(len(trace) - 1): + trace[i]["gasCost"] = trace[i + 1]["gasCost"] + trace[-1]["gasCost"] = 0 + else: + self._call_cost = self.gas_used - trace[0]["gas"] + trace[-1]["gas"] # last_map gives a quick reference of previous values at each depth last_map = {0: _get_last_map(self.receiver, self.input[:10])} # type: ignore diff --git a/docs/install.rst b/docs/install.rst index 89fec85a5..903ad0572 100644 --- a/docs/install.rst +++ b/docs/install.rst @@ -62,7 +62,7 @@ Dependencies Brownie has the following dependencies: * `python3 `_ version 3.6 or greater, python3-dev -* `ganache-cli `_ - tested with version `6.8.2 `_ +* `ganache-cli `_ - tested with version `6.10.1 `_ .. _install-tk: