-
Notifications
You must be signed in to change notification settings - Fork 45
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
Fix decryptor nonce computation #1062
Conversation
aquarius/events/decryptor.py
Outdated
timeout=4, | ||
).json() | ||
|
||
if nonce_response: |
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 think you can remove this if statement (just the statement, not its contents!) to trigger the exception handling itself. Otherwise, assuming you don't have a response, it will not fall back because it doesn't throw an exception. Instead, it will exit the if and go to line 40, where the nonce will be undefined.
aquarius/events/decryptor.py
Outdated
@@ -17,18 +19,34 @@ | |||
|
|||
def decrypt_ddo(w3, provider_url, contract_address, chain_id, txid, hash, es_instance): | |||
aquarius_account = get_aquarius_wallet() | |||
nonce = str(int(datetime.now(timezone.utc).timestamp())) | |||
# get nonce | |||
try: |
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.
Also, I would have this nonce retrieval process as a separate function with the only parameters needed being the address and the provider_url. Please also add unit tests for this part.
Created Tested on a fresh VM, the signature was generated correctly. |
Code Climate has analyzed commit 969815a and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 100.0% (50% is the threshold). This pull request will bring the total coverage in the repository to 84.4% (0.2% change). View more on Code Climate. |
Description
Fix decryptor nonce computation
Is this PR related with an open issue?
Related to Issue #1064
Types of changes
Checklist: