Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
6af9717
fix: crash when waiting for a tx confirmation
banteg May 10, 2024
32b5e34
Merge pull request #1774 from eth-brownie/fix/tx-confirmation
iamdefinitelyahuman May 22, 2024
5b3cad3
fix: search parent paths for import file
consol3cowboy May 22, 2024
e24b9ad
Merge pull request #1776 from consol3cowboy/master
iamdefinitelyahuman May 22, 2024
ad4beea
chore: lint
iamdefinitelyahuman May 22, 2024
ef47c36
release: update changelog, bump version to v1.20.5
iamdefinitelyahuman May 22, 2024
a7daa70
Merge pull request #1777 from eth-brownie/v1.20.5
iamdefinitelyahuman May 22, 2024
c76077d
chore: fix typos
xiaoxianBoy May 25, 2024
38d74a5
feat(type): overloads for `strategy` kwargs
BobTheBuidler May 25, 2024
d9926ec
fix: missing import
BobTheBuidler May 28, 2024
84810c5
fix: ds-note decoding
banteg May 30, 2024
a721699
Merge pull request #1781 from eth-brownie/fix/ds-note
iamdefinitelyahuman May 30, 2024
1ec832d
chore: refactor out big ugly Literals with genexp
BobTheBuidler May 30, 2024
d9fb841
fix: revert genexp and move constants to bottom
BobTheBuidler May 30, 2024
a8345ef
fix: move constants back to top
BobTheBuidler May 30, 2024
31c597a
chore: black .
BobTheBuidler Jun 2, 2024
1821a80
fix: tox -e lint
BobTheBuidler Jun 4, 2024
f722038
Merge pull request #1780 from BobTheBuidler/patch-1
iamdefinitelyahuman Jun 8, 2024
9635c1e
Merge pull request #1779 from xiaoxianBoy/fix-typos
iamdefinitelyahuman Jun 8, 2024
0823a8b
fix: await tx confirmation by watching nonce
iamdefinitelyahuman Jun 22, 2024
45314ef
Merge pull request #1782 from eth-brownie/fix/wait-tx-conf
iamdefinitelyahuman Jun 22, 2024
9d387b4
release: update changelog, bump version to v1.20.6
iamdefinitelyahuman Jun 22, 2024
65d2fce
Merge pull request #1783 from eth-brownie/v1.20.6
iamdefinitelyahuman Jun 22, 2024
41b1169
fix: remove tdqm progress bars
iamdefinitelyahuman Jul 3, 2024
cc53694
Merge pull request #1785 from eth-brownie/fix/tdqm
iamdefinitelyahuman Jul 3, 2024
353440a
fix: do not replace full contract artifacts with abi-only
iamdefinitelyahuman Jul 3, 2024
690da0c
fix: use cached deployedBytecode where possible
iamdefinitelyahuman Jul 3, 2024
428ad1e
Merge pull request #1786 from eth-brownie/fix/cache
iamdefinitelyahuman Jul 12, 2024
0e3dddf
fix: compatability issue with vvm 0.2.0
BobTheBuidler Aug 17, 2024
9e2d8b4
fix: None not iterable
BobTheBuidler Aug 17, 2024
c6eed94
fix: TypeError
BobTheBuidler Aug 17, 2024
7f58e2f
fix: debug source_map_str not being string
BobTheBuidler Aug 17, 2024
d28b3b0
chore: add exc detail
BobTheBuidler Aug 17, 2024
3ad567b
chore: add exc detail
BobTheBuidler Aug 17, 2024
7042377
fix: typo
BobTheBuidler Aug 17, 2024
804a2f3
fix: typo
BobTheBuidler Aug 17, 2024
8b09824
fix: KeyError
BobTheBuidler Aug 17, 2024
35c2741
chore: black
BobTheBuidler Aug 17, 2024
674dc8f
chore: flake8
BobTheBuidler Aug 17, 2024
e05e53f
chore: black
BobTheBuidler Aug 17, 2024
b8cd61e
feat(gh): limit workflow concurrency
BobTheBuidler Aug 17, 2024
dc665d1
chore: better comment
BobTheBuidler Aug 18, 2024
326cce6
typo
stas Oct 23, 2024
910fbee
chore: add py.typed marker
BobTheBuidler Nov 9, 2024
6a90de9
feat(mypy): add py.typed marker
BobTheBuidler Nov 10, 2024
f4341fb
Update CHANGELOG.md
BobTheBuidler Dec 4, 2024
553be4b
Merge pull request #1794 from BobTheBuidler/patch-3
iamdefinitelyahuman Jan 6, 2025
196e94f
Merge pull request #1789 from BobTheBuidler/limit-workflow-concurrency
iamdefinitelyahuman Jan 6, 2025
e8d78c4
Merge pull request #1793 from velodrome-finance/vyper-v0.4
iamdefinitelyahuman Jan 6, 2025
83a4057
fix: vvm Version TypeError
iamdefinitelyahuman Jan 7, 2025
aa3f8aa
release: update changelog, bump version to v1.20.7
iamdefinitelyahuman Jan 6, 2025
22ab739
Merge pull request #1801 from eth-brownie/v1.20.7
iamdefinitelyahuman Jan 7, 2025
af94724
fix: Broken links (#1803)
cypherpepe Mar 1, 2025
a630a7e
chore: fix typos (#1804)
teenager-ETH Mar 1, 2025
e9611f1
fix: typos in documentation files (#1810)
kilavvy Mar 19, 2025
a657dcc
feat: pip-compile gh action
BobTheBuidler Mar 20, 2025
b2c4949
feat: implement cchecksum for ~2x faster checksumming (#1796)
BobTheBuidler Mar 20, 2025
f938824
chore(deps): bump vyper from 0.3.10 to 0.4.0 (#1806)
dependabot[bot] Mar 20, 2025
6e85693
chore(deps): bump virtualenv from 20.25.1 to 20.26.6 (#1805)
dependabot[bot] Mar 20, 2025
a6ccea7
chore(deps): bump eth-abi from 5.0.0 to 5.0.1 (#1755)
dependabot[bot] Mar 20, 2025
5850bcd
chore(deps): bump tqdm from 4.66.2 to 4.66.3 (#1766)
dependabot[bot] Mar 20, 2025
1d0a328
chore(deps): bump jinja2 from 3.1.3 to 3.1.6 (#1813)
dependabot[bot] Mar 20, 2025
db006ee
chore(deps): bump aiohttp from 3.9.3 to 3.10.11 (#1795)
dependabot[bot] Mar 20, 2025
b4af9c5
chore(deps): bump cryptography from 42.0.5 to 44.0.1 (#1808)
dependabot[bot] Mar 20, 2025
230ef55
[fix] GethPOAMiddleware on Polygon networks with anvil fork (#1791)
kx9x Mar 21, 2025
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
5 changes: 5 additions & 0 deletions .github/workflows/core-ganache-3.10.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: Core Ganache (py3.10)
on: ["push", "pull_request"]

# This limits the workflow to 1 active run at any given time for a specific branch
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
ETHERSCAN_TOKEN: 9MKURTHE8FNA9NRUUJBHMUEVY6IQ5K1EGY
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/core-ganache-3.11.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: Core Ganache (py3.11)
on: ["push", "pull_request"]

# This limits the workflow to 1 active run at any given time for a specific branch
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
ETHERSCAN_TOKEN: 9MKURTHE8FNA9NRUUJBHMUEVY6IQ5K1EGY
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/core-ganache-3.12.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: Core Ganache (py3.12)
on: ["push", "pull_request"]

# This limits the workflow to 1 active run at any given time for a specific branch
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
ETHERSCAN_TOKEN: 9MKURTHE8FNA9NRUUJBHMUEVY6IQ5K1EGY
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/evm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ on: ["push", "pull_request"]

name: evm tests

# This limits the workflow to 1 active run at any given time for a specific branch
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
ETHERSCAN_TOKEN: 9MKURTHE8FNA9NRUUJBHMUEVY6IQ5K1EGY
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/functionality.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ on: ["push", "pull_request"]

name: functionality

# This limits the workflow to 1 active run at any given time for a specific branch
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
ETHERSCAN_TOKEN: 9MKURTHE8FNA9NRUUJBHMUEVY6IQ5K1EGY
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ on: ["push", "pull_request"]

name: linting

# This limits the workflow to 1 active run at any given time for a specific branch
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
ETHERSCAN_TOKEN: 9MKURTHE8FNA9NRUUJBHMUEVY6IQ5K1EGY
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
49 changes: 49 additions & 0 deletions .github/workflows/pip-compile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Pip Compile

on:
pull_request:
branches:
- master
paths:
- 'requirements.in'
- 'requirements-windows.in'
- 'requirements-dev.in'

jobs:
format:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }} # Check out the PR branch

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install Pip Tools
run: pip install pip-tools

- name: Run Pip Compile
run: pip-compile

- name: Check for changes
id: changes
run: |
if [[ -n $(git status --porcelain) ]]; then
echo "changes_detected=true" >> $GITHUB_ENV
else
echo "changes_detected=false" >> $GITHUB_ENV
fi

- name: Commit changes
if: env.changes_detected == 'true'
run: |
git config --local user.name "github-actions[bot]"
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "chore: \`pip-compile\`"
git push
28 changes: 27 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,32 @@ 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)
### Changed
- replace `eth_utils.to_checksum_address` with `cchecksum.to_checksum_address` for ~2x faster checksumming ([#1796](https://github.com/eth-brownie/brownie/pull/1796))

## [1.20.7](https://github.com/eth-brownie/brownie/tree/v1.20.7) - 2025-01-07
### Added
- Support for vyper `0.4.0` ([#1793](https://github.com/eth-brownie/brownie/pull/1793))
- `py.typed` marker ([#1794](https://github.com/eth-brownie/brownie/pull/1794))

### Fixed
- Improvements to caching ([#1786](https://github.com/eth-brownie/brownie/pull/1786))

### Removed
- `tqdm` progress bars during compiler installation ([#1785](https://github.com/eth-brownie/brownie/pull/1785))

## [1.20.6](https://github.com/eth-brownie/brownie/tree/v1.20.6) - 2024-06-22
### Added
- `include` kwarg for address strategy, type-dependent strategy overloads ([#1780](https://github.com/eth-brownie/brownie/pull/1780))

### Fixed
- ds-note decoding ([#1781](https://github.com/eth-brownie/brownie/pull/1781))
- "Dropped without known replacement" tx race condition ([#1782](https://github.com/eth-brownie/brownie/pull/1782))

## [1.20.5](https://github.com/eth-brownie/brownie/tree/v1.20.5) - 2024-05-22
### Fixed
- Handle missing `blockNumber` while awaiting confirmation ([#1774](https://github.com/eth-brownie/brownie/pull/1774))
- Search parent paths for file import during source verification ([#1776](https://github.com/eth-brownie/brownie/pull/1776))

## [1.20.4](https://github.com/eth-brownie/brownie/tree/v1.20.4) - 2024-05-08
### Fixed
Expand Down Expand Up @@ -102,7 +128,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [1.19.0](https://github.com/eth-brownie/brownie/tree/v1.19.0) - 2022-05-29
### Added
- Initial support for [Anvil](https://github.com/foundry-rs/foundry/tree/master/anvil), a blazing-fast local testnet node implementation in Rust ([#1541](https://github.com/eth-brownie/brownie/pull/1541))
- Initial support for [Anvil](https://github.com/foundry-rs/foundry/tree/master/crates/anvil), a blazing-fast local testnet node implementation in Rust ([#1541](https://github.com/eth-brownie/brownie/pull/1541))
- Support configurable initial wallet balance, chain id, and gas limit.

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ To upgrade to the latest version:
pipx upgrade eth-brownie
```

To use lastest master or another branch as version:
To use latest master or another branch as version:
```bash
pipx install git+https://github.com/eth-brownie/brownie.git@master
```
Expand Down
2 changes: 1 addition & 1 deletion brownie/_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from brownie._expansion import expand_posix_vars
from brownie._singleton import _Singleton

__version__ = "1.20.4"
__version__ = "1.20.7"

BROWNIE_FOLDER = Path(__file__).parent
DATA_FOLDER = Path.home().joinpath(".brownie")
Expand Down
3 changes: 2 additions & 1 deletion brownie/convert/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
except ImportError:
DecimalOverrideException = BaseException # regular catch blocks shouldn't catch

import cchecksum
import eth_utils
from hexbytes import HexBytes

Expand Down Expand Up @@ -205,7 +206,7 @@ def __new__(cls, value: Union[bytes, str]) -> str:
converted_value = HexBytes(value).hex()
converted_value = eth_utils.add_0x_prefix(str(converted_value)) # type: ignore
try:
converted_value = eth_utils.to_checksum_address(converted_value)
converted_value = cchecksum.to_checksum_address(converted_value)
except ValueError:
raise ValueError(f"'{value}' is not a valid ETH address") from None
return super().__new__(cls, converted_value) # type: ignore
Expand Down
20 changes: 14 additions & 6 deletions brownie/network/contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,9 @@ def __init__(
self, address: str, owner: Optional[AccountsType] = None, tx: TransactionReceiptType = None
) -> None:
address = _resolve_address(address)
self.bytecode = web3.eth.get_code(address).hex()[2:]
self.bytecode = (
self._build.get("deployedBytecode", None) or web3.eth.get_code(address).hex()[2:]
)
if not self.bytecode:
raise ContractNotFound(f"No contract deployed at {address}")
self._owner = owner
Expand Down Expand Up @@ -948,7 +950,13 @@ def from_abi(
will be performed using this account.
"""
address = _resolve_address(address)
build = {"abi": abi, "address": address, "contractName": name, "type": "contract"}
build = {
"abi": abi,
"address": address,
"contractName": name,
"type": "contract",
"deployedBytecode": web3.eth.get_code(address).hex()[2:],
}

self = cls.__new__(cls)
_ContractBase.__init__(self, None, build, {}) # type: ignore
Expand Down Expand Up @@ -1258,7 +1266,7 @@ def subscribe(
) -> None:
"""
Subscribe to event with a name matching 'event_name', calling the 'callback'
function on new occurence giving as parameter the event log receipt.
function on new occurrence giving as parameter the event log receipt.

Args:
event_name (str): Name of the event to subscribe to.
Expand All @@ -1285,10 +1293,10 @@ def get_sequence(

Returns:
if 'event_type' is specified:
[list]: List of events of type 'event_type' that occured between
[list]: List of events of type 'event_type' that occurred between
'from_block' and 'to_block'.
else:
event_logbook [dict]: Dictionnary of events of the contract that occured
event_logbook [dict]: Dictionary of events of the contract that occurred
between 'from_block' and 'to_block'.
"""
if to_block is None or to_block > web3.eth.block_number:
Expand All @@ -1315,7 +1323,7 @@ def listen(self, event_name: str, timeout: float = 0) -> Coroutine:
'event_name' occurs. If timeout is superior to zero and no event matching
'event_name' has occured, the Coroutine ends when the timeout is reached.

The Coroutine return value is an AttributeDict filled with the following fileds :
The Coroutine return value is an AttributeDict filled with the following fields :
- 'event_data' (AttributeDict): The event log receipt that was caught.
- 'timed_out' (bool): False if the event did not timeout, else True

Expand Down
2 changes: 1 addition & 1 deletion brownie/network/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ def _decode_ds_note(log, contract): # type: ignore
if selector.hex() not in contract.selectors or sum(tail):
return
name = contract.selectors[selector.hex()]
data = bytes.fromhex(log.data[2:])
data = bytes.fromhex(log.data[2:]) if isinstance(log.data, str) else log.data
# data uses ABI encoding of [uint256, bytes] or [bytes] in different versions
# instead of trying them all, assume the payload starts from selector
try:
Expand Down
7 changes: 5 additions & 2 deletions brownie/network/middlewares/geth_poa.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@
class GethPOAMiddleware(BrownieMiddlewareABC):
@classmethod
def get_layer(cls, w3: Web3, network_type: str) -> Optional[int]:
block_ident = "latest" if network_type == "live" else 0
# NOTE: 0 because Ganache sometimes injects a block of their own. It doesn't have the extra data that we are checking for.
# "latest" because On Polygon networks, anvil in forked development mode doesn't throw ExtraDataLengthError on the first block.
block_idents = ("latest",) if network_type == "live" else (0, "latest")
try:
w3.eth.get_block(block_ident)
for block_ident in block_idents:
w3.eth.get_block(block_ident)
return None
except ExtraDataLengthError:
return -1
Expand Down
6 changes: 6 additions & 0 deletions brownie/network/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,12 @@ def _add_deployment(contract: Any, alias: Optional[str] = None) -> None:
f"(address UNIQUE, alias UNIQUE, paths, {', '.join(DEPLOYMENT_KEYS)})"
)

if "compiler" not in contract._build:
# do not replace full contract artifacts with ABI-only ones
row = cur.fetchone(f"SELECT compiler FROM {name} WHERE address=?", (address,))
if row and row[0]:
return

all_sources = {}
for key, path in contract._build.get("allSourcePaths", {}).items():
source = contract._sources.get(path)
Expand Down
23 changes: 15 additions & 8 deletions brownie/network/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,12 @@ def __init__(
# await confirmation of tx in a separate thread which is blocking if
# required_confs > 0 or tx has already confirmed (`blockNumber` != None)
confirm_thread = threading.Thread(
target=self._await_confirmation, args=(tx["blockNumber"], required_confs), daemon=True
target=self._await_confirmation,
args=(tx.get("blockNumber"), required_confs),
daemon=True,
)
confirm_thread.start()
if is_blocking and (required_confs > 0 or tx["blockNumber"]):
if is_blocking and (required_confs > 0 or tx.get("blockNumber")):
confirm_thread.join()

def __repr__(self) -> str:
Expand Down Expand Up @@ -403,17 +405,22 @@ def wait(self, required_confs: int) -> None:
print(f"This transaction already has {self.confirmations} confirmations.")
return

if self.nonce is not None:
# if we know the transaction nonce, it's more efficient to watch the tx count
# this (i hope) also fixes a longstanding bug that sometimes gave an incorrect
# "tx dropped without known replacement" error due to a race condition
while web3.eth.get_transaction_count(str(self.sender)) <= self.nonce:
time.sleep(1)

while True:
try:
tx: Dict = web3.eth.get_transaction(self.txid)
break
except TransactionNotFound:
if self.nonce is not None:
sender_nonce = web3.eth.get_transaction_count(str(self.sender))
if sender_nonce > self.nonce:
self.status = Status(-2)
self._confirmed.set()
return
self.status = Status(-2)
self._confirmed.set()
return
time.sleep(1)

self._await_confirmation(tx["blockNumber"], required_confs)
Expand Down Expand Up @@ -508,7 +515,7 @@ def _await_confirmation(self, block_number: int = None, required_confs: int = 1)
# check if tx is still in mempool, this will raise otherwise
tx = web3.eth.get_transaction(self.txid)
self.block_number = None
return self._await_confirmation(tx["blockNumber"], required_confs)
return self._await_confirmation(tx.get("blockNumber"), required_confs)
if required_confs - self.confirmations != remaining_confs:
remaining_confs = required_confs - self.confirmations
if not self._silent:
Expand Down
2 changes: 1 addition & 1 deletion brownie/project/compiler/solidity.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def set_solc_version(version: Union[str, Version]) -> str:
def install_solc(*versions: Union[Version, str]) -> None:
"""Installs solc versions."""
for version in versions:
solcx.install_solc(version, show_progress=True)
solcx.install_solc(version, show_progress=False)


def get_abi(contract_source: str, allow_paths: Optional[str] = None) -> Dict:
Expand Down
7 changes: 7 additions & 0 deletions brownie/project/compiler/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@

def expand_source_map(source_map_str: str) -> List:
# Expands the compressed sourceMap supplied by solc into a list of lists

if isinstance(source_map_str, dict):
# NOTE: vyper >= 0.4 gives us a dict that contains the source map
source_map_str = source_map_str["pc_pos_map_compressed"]
if not isinstance(source_map_str, str):
raise TypeError(source_map_str)

source_map: List = [_expand_row(i) if i else None for i in source_map_str.split(";")]
for i, value in enumerate(source_map[1:], 1):
if value is None:
Expand Down
Loading
Loading