microraiden icon indicating copy to clipboard operation
microraiden copied to clipboard

Config file improvements

Open pcppcp opened this issue 7 years ago • 2 comments

Problem

contract & token addresses are hardcoded in the config.py file, making it difficult to switch between networks.

Proposal

Something like a config singleton that will return proper defaults for each of the network we run the tests on. i.e.

config('ropsten').get_channel_manager_address()
config('kovan').get_token_address()

pcppcp avatar Sep 07 '17 12:09 pcppcp

Would something like this be sufficient?

NETWORK_ID = 1

CHANNEL_MANAGER_ADDRESS = {
    1: '0xaa',
    42: '0xbb'
}[NETWORK_ID]

I think that would be both more clear and easier to use (doesn't require any code changes outside of the config file).

Disadvantage is that it's not easy to override the network id with a command line flag. If that's required one could do

CHANNEL_MANAGER_ADDRESSES = {
    1: '0xaa',
    42: '0xbb'
}

and use it like config.CHANNEL_MANAGER_ADDRESSES[network_id].

jannikluhn avatar Sep 07 '17 13:09 jannikluhn

I don't want to have id hardcoded either, exactly because it makes it harder to use it from a command line.

I'd like to i.e. start a proxy either like this py -m raiden.proxy --network ropsten (which would pick defaults for me) or py -m raiden.proxy --channel-manager-address 0x... --token-address 0x..

I still don't like the fact that both constants and app-dependent code are mixed... Maybe we need something completely different, like a config file/proxy. Let's think about this for a while.

pcppcp avatar Sep 07 '17 13:09 pcppcp