-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
get_contract_deployment_info that returns both service and raiden deployment info by default #775
get_contract_deployment_info that returns both service and raiden deployment info by default #775
Conversation
which is similar to get_contracts_deployed() but * does not take `services:bool` argument * takes `module:str` argument that can be 'raiden' 'services' or 'all' The default is 'all' because in most uses, all deployment data are wanted. This fixes raiden-network#774
fada4d6
to
8a9de40
Compare
I have to change README too. |
I realized somehow |
Codecov Report
@@ Coverage Diff @@
## master #775 +/- ##
==========================================
+ Coverage 81.84% 82.02% +0.18%
==========================================
Files 20 20
Lines 1190 1202 +12
Branches 115 119 +4
==========================================
+ Hits 974 986 +12
Misses 186 186
Partials 30 30
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #775 +/- ##
==========================================
+ Coverage 81.84% 82.17% +0.32%
==========================================
Files 20 20
Lines 1190 1223 +33
Branches 115 123 +8
==========================================
+ Hits 974 1005 +31
- Misses 186 187 +1
- Partials 30 31 +1
Continue to review full report at Codecov.
|
and make tests more deterministic.
raiden_contracts/contract_manager.py
Outdated
def get_contracts_deployment_info( | ||
chain_id: int, | ||
version: Optional[str] = None, | ||
module: str = 'all', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had commented about it before but it somehow got lots. Can you change this module to an Enum? It will be much better typed, easier to check and a better interface?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There you go. I defined and used an Enum.
get_contracts_deployment_info() used to take a module name as a string, but sinsce there are only a few valid values, Enum is more suitable.
38452bf
to
389bbdf
Compare
@LefterisJP merge? |
@@ -125,6 +126,12 @@ def contracts_deployed_path( | |||
return data_path.joinpath(f'deployment_{"services_" if services else ""}{chain_name}.json') | |||
|
|||
|
|||
class DeploymentModule(Enum): | |||
RAIDEN = 'raiden' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can also have those as: RAIDEN = 1, SERVICES = 2, ALL = 3. No need to be strings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably I should go for https://docs.python.org/3/library/enum.html#enum.auto
get_contracts_deployed()
had two problemsThis PR fixes both by introducing a new interface function
get_contracts_deployment_info()
that takesmodule: str
instead ofservices: bool
. Moreover,module
defaults toall
, meaning "give me deployment info for all modules".Also
get_contracts_deployed()
is deprecated.