Skip to content

Commit

Permalink
fix: issue with default txn type and hyphen (#1275)
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey authored Feb 1, 2023
1 parent 41f0018 commit 97264ed
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/ape_ethereum/ecosystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ def config(self) -> EthereumConfig:

@property
def default_transaction_type(self) -> TransactionType:
return self.config[self.default_network].default_transaction_type
network = self.default_network.replace("-", "_")
return self.config[network].default_transaction_type

@classmethod
def decode_address(cls, raw_address: RawAddress) -> AddressType:
Expand Down
6 changes: 5 additions & 1 deletion tests/functional/test_ecosystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from eth_typing import HexAddress, HexStr
from hexbytes import HexBytes

from ape.api.networks import LOCAL_NETWORK_NAME
from ape.types import AddressType
from ape.utils import DEFAULT_LOCAL_TRANSACTION_ACCEPTANCE_TIMEOUT
from ape_ethereum.ecosystem import Block
Expand Down Expand Up @@ -186,7 +187,10 @@ def test_decode_receipt(eth_tester_provider, ethereum):


def test_configure_default_txn_type(temp_config, ethereum):
config_dict = {"ethereum": {"local": {"default_transaction_type": 0}}}
config_dict = {"ethereum": {"mainnet_fork": {"default_transaction_type": 0}}}
assert ethereum.default_transaction_type == TransactionType.DYNAMIC

with temp_config(config_dict):
ethereum._default_network = "mainnet-fork"
assert ethereum.default_transaction_type == TransactionType.STATIC
ethereum._default_network = LOCAL_NETWORK_NAME

0 comments on commit 97264ed

Please sign in to comment.