-
Notifications
You must be signed in to change notification settings - Fork 2
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
Added boolean flag to control IPFS upload #470
Added boolean flag to control IPFS upload #470
Conversation
Warning Rate limit exceeded@gabrielfior has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 4 minutes and 30 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. WalkthroughThe pull request introduces a new environment variable Changes
Possibly related PRs
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
LGTM, will you add it to all the agents in the Terraform deployment as well? 🙏
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.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (3)
.env.example (2)
7-7
: Enhance clarity for the new ENABLE_IPFS_UPLOAD variableThe addition of
ENABLE_IPFS_UPLOAD
aligns well with the PR objective. To improve clarity and ease of use:
- Add a comment explaining the purpose of this variable.
- Provide example values (true/false) in the template.
Consider updating the line as follows:
-ENABLE_IPFS_UPLOAD= +# Controls whether IPFS upload is enabled (true/false) +ENABLE_IPFS_UPLOAD=falseThis change will provide better guidance for users setting up their environment.
Line range hint
1-7
: LGTM with a minor suggestionThe addition of the
ENABLE_IPFS_UPLOAD
variable is appropriate and aligns well with the PR objective. The change is minimal, focused, and doesn't introduce any apparent security issues.As a minor suggestion, consider ordering the environment variables alphabetically for easier readability and maintenance. This isn't crucial but can be helpful as the file grows.
If you decide to implement alphabetical ordering, here's how the file could look:
BET_FROM_PRIVATE_KEY= ENABLE_IPFS_UPLOAD=false GRAPH_API_KEY= MANIFOLD_API_KEY= OPENAI_API_KEY= PINATA_API_KEY= PINATA_API_SECRET=
prediction_market_agent_tooling/deploy/agent.py (1)
525-532
: LGTM with suggestion: IPFS upload control addedThe changes successfully implement the boolean flag to control IPFS upload, as per the PR objective. The initialization of
ipfs_hash_decoded
withHASH_ZERO
ensures a valid default value.However, consider the following optimization:
If
store_prediction
is called frequently, creating a newIPFSHandler
instance for each call might impact performance. Consider initializing theIPFSHandler
once (e.g., in the constructor or as a lazy-loaded property) and reusing it across method calls.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (4)
- .env.example (1 hunks)
- prediction_market_agent_tooling/config.py (2 hunks)
- prediction_market_agent_tooling/deploy/agent.py (2 hunks)
- tests_integration_with_local_chain/markets/omen/test_omen.py (3 hunks)
🔇 Additional comments (7)
prediction_market_agent_tooling/config.py (2)
48-48
: LGTM: New IPFS upload flag added correctly.The
ENABLE_IPFS_UPLOAD
property has been added correctly as an optional boolean flag. This aligns well with the existing pattern of configuration properties in theAPIKeys
class.
Line range hint
1-214
: Summary: IPFS upload flag added successfully with a minor suggestion for improvement.The changes successfully add a boolean flag to control IPFS upload, meeting the PR objective. The implementation follows existing patterns in the
APIKeys
class, maintaining consistency. A minor improvement has been suggested for handling the case when the IPFS upload flag is not set in the environment.Overall, the changes are well-integrated and achieve the intended functionality. Once the suggested improvement is addressed, this PR will be ready for merging.
tests_integration_with_local_chain/markets/omen/test_omen.py (3)
9-9
: Import changes look good.The addition of
HASH_ZERO
fromweb3.constants
is appropriate for the new test function. The formatting change for theweb3_utils
import improves readability.Also applies to: 63-66
483-503
: New test function looks good and covers an important edge case.The
test_add_prediction_with_empty_ipfs_hash
function is a valuable addition to the test suite. It verifies that predictions with empty IPFS hashes (represented byHASH_ZERO
) can be correctly added and retrieved using theOmenAgentResultMappingContract
. This test covers an important edge case that wasn't previously tested.
Line range hint
1-505
: Overall, these changes enhance test coverage and align with the PR objective.The addition of the
test_add_prediction_with_empty_ipfs_hash
function improves the test suite by covering an important edge case related to empty IPFS hashes. This change aligns well with the PR objective of adding a boolean flag to control IPFS upload. The import modifications are appropriate and improve code readability. These changes contribute to the overall robustness and quality of the codebase.prediction_market_agent_tooling/deploy/agent.py (2)
14-14
: LGTM: New import added for HASH_ZEROThe addition of
HASH_ZERO
fromweb3.constants
is appropriate and will be used in the updatedstore_prediction
method.
539-539
: LGTM: Updated ContractPrediction instantiationThe change to use
ipfs_hash_decoded
in the ContractPrediction instantiation is correct and consistent with the earlier modifications in the method. This ensures that the proper decoded IPFS hash is used in the contract prediction.
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.
YOLO
No description provided.