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

Add duration calculation for subscription based rituals #306

Merged
merged 3 commits into from
Aug 21, 2024

Conversation

theref
Copy link
Contributor

@theref theref commented Aug 15, 2024

If anyone wants to test it here is the command:

ape run initiate_ritual --network polygon:amoy:infura -d lynx -c GlobalAllowList -f BqETHSubscription -a 0x3B42d26E19FF860bC4dEbB920DD8caA53F93c600 --num-nodes 3

@theref theref requested a review from KPrasch August 15, 2024 15:46
@derekpierre
Copy link
Member

derekpierre commented Aug 15, 2024

I can run it locally but get the following error:

  File "/Users/derek/Documents/Github/repos/forks/derek/nucypher-contracts/deployment/utils.py", line 198, in sample_nodes
    result = sorted(data["result"]["ursulas"], key=lambda x: x.lower())
                    ~~~~^^^^^^^^^^
KeyError: 'result'

Porter is returning a 400 because the duration calculated is negative:

{'error': 'duration must be a non-negative integer.', 'version': '3.7.0'}

The duration value used as a parameter is:

'duration': -2804636

Therefore, no results are returned.

As a side note, the sample_nodes(...) utility function could probably handle any errors from porter sampling better i.e. check the response status code before assuming that the call was successful.

@theref
Copy link
Contributor Author

theref commented Aug 16, 2024

@derekpierre thank you! Ape seems happier today (i think there's something odd with ape-etherscan api urls for polygon testnets, I'm looking into it...) and I got the same error - it's happening because the subscription has already ended. I've added a check for this in 2619079

raise ValueError("Subscription has already ended.")
click.echo(
"Subscription has already started. Subtracting the elapsed time from the duration."
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these 2 lines properly linted?

@cygnusv cygnusv merged commit 0067b74 into nucypher:main Aug 21, 2024
2 checks passed
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.

4 participants