Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: use getattr for EthereumProvider network configs instead of dict…
…ionary key lookup (#128) I am inheriting from NetworkConfig for Hardhat, but the behavior of key lookup vs. attribute lookup is different for the base class vs. inherited class. Base NetworkConfig class: (Pdb) self.config NetworkConfig(ethereum={'development': {'uri': 'http://localhost:8555'}}) (Pdb) self.config['ethereum'] {'development': {'uri': 'http://localhost:8555'}} (Pdb) getattr(self.config, 'ethereum') {'development': {'uri': 'http://localhost:8555'}} Vs. my inherited class where the key lookup fails: (Pdb) self.config HardhatNetworkConfig(ethereum={'development': {'uri': 'http://localhost:8555'}}, fork_url=None, fork_block_number=None, port=8555) (Pdb) self.config['ethereum'] *** KeyError: "''ethereum'" (Pdb) self.config.ethereum {'development': {'uri': 'http://localhost:8555'}} Since attribute lookup works on both classes, let's just use that. Also fixed a typo in the KeyError raised by the ConfigItem class.
- Loading branch information