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

Reduce random stake amount #134

Merged
merged 8 commits into from
Sep 5, 2023
Merged

Conversation

trizin
Copy link
Contributor

@trizin trizin commented Sep 4, 2023

Fixes #133

Changes proposed in this PR:

  • Reduce random stake amount

@trizin trizin linked an issue Sep 4, 2023 that may be closed by this pull request
@trizin trizin marked this pull request as ready for review September 4, 2023 13:00
@trizin trizin requested a review from trentmc September 4, 2023 13:13
@trentmc
Copy link
Member

trentmc commented Sep 4, 2023

Before I review this, the change from int -> float implies that we need to agree on something first:

does this represent stake in units of Eth, or in units of wei?

We need to make sure it's well documented all the way along.

@trizin
Copy link
Contributor Author

trizin commented Sep 4, 2023

It's in Eth, gets converted to wei within the submit prediction function:

https://github.com/oceanprotocol/pdr-backend/blob/main/pdr_backend/models/predictoor_contract.py#L271

@trizin
Copy link
Contributor Author

trizin commented Sep 4, 2023

I've updated the docstring, could you re-review? @trentmc

@@ -248,7 +248,7 @@ def soonest_timestamp_to_predict(self, timestamp):
def submit_prediction(
self,
predicted_value: bool,
stake_amount: int,
stake_amount: float,
prediction_ts: int,
wait_for_receipt=True,
):
Copy link
Member

Choose a reason for hiding this comment

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

In docstring for submit_prediction(), line for "stake_amount", please say that it's in units of Eth not wei.

@@ -141,7 +141,8 @@ def get_prediction(
You need to customize it to implement your own strategy.
Copy link
Member

Choose a reason for hiding this comment

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

I confirm that the docstring here is good (it says "in units of wei", good).

Can you also make sure that all other docstrings passing in stake (as eth or wei) clearly specify which it is (eth or wei). Thanks!

I'm also wondering: can we unit test this somehow?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

9998e76
Added an assert for the stake amount here

@trizin trizin merged commit a6705b9 into main Sep 5, 2023
5 checks passed
@trizin trizin deleted the issue133-reduce-random-stake-amount branch September 5, 2023 08:57
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.

Reduce random stake amount
2 participants