Skip to content
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

Merged
merged 10 commits into from
Sep 25, 2023
Merged

Fix decryptor nonce computation #1062

merged 10 commits into from
Sep 25, 2023

Conversation

mariacarmina
Copy link
Member

@mariacarmina mariacarmina commented Sep 12, 2023

Description

Fix decryptor nonce computation

Is this PR related with an open issue?

Related to Issue #1064

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • Follows the code style of this project.
  • Tests Cover Changes

@mariacarmina mariacarmina self-assigned this Sep 12, 2023
timeout=4,
).json()

if nonce_response:
Copy link
Contributor

@calina-c calina-c Sep 14, 2023

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.

@@ -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:
Copy link
Contributor

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.

@mariacarmina
Copy link
Member Author

mariacarmina commented Sep 15, 2023

Created oceanprotocol/aquarius:debug image for testing.

Tested on a fresh VM, the signature was generated correctly.

@codeclimate
Copy link

codeclimate bot commented Sep 17, 2023

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.

@mariacarmina mariacarmina merged commit c1072ee into main Sep 25, 2023
@mariacarmina mariacarmina deleted the fix-decryptor-nonce branch September 25, 2023 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants