-
Notifications
You must be signed in to change notification settings - Fork 266
feat(solana): implement SVM Entropy contract with V2 API #2886
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
Open
devin-ai-integration
wants to merge
4
commits into
main
Choose a base branch
from
devin/1753278917-svm-entropy-contract
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Create new pyth-entropy Solana program using Anchor framework - Implement V2 variants of Entropy contract methods from Ethereum version - Add account structures for EntropyConfig, ProviderInfo, and EntropyRequest - Include provider registration, randomness requests, and reveal functionality - Support callback mechanisms and fee management - Follow existing workspace patterns and dependencies Refs: target_chains/ethereum/contracts/contracts/entropy/Entropy.sol Co-Authored-By: Jayant <jayant@dourolabs.xyz>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
- Remove unused clock variable that was causing CI build failure - Keep clock variable in request_v2 function where it's actually used - Fixes clippy warning and allows CI build to pass Co-Authored-By: Jayant <jayant@dourolabs.xyz>
- CI environment uses older Cargo version that doesn't support lock file version 4 - Revert from version 4 back to version 3 to fix build failure - Keeps pyth-entropy package entry but in compatible format Co-Authored-By: Jayant <jayant@dourolabs.xyz>
- CI environment uses older Cargo version that doesn't support lock file version 4 - Revert from version 4 back to version 3 to fix build failure - Keeps pyth-entropy package entry but in compatible format Co-Authored-By: Jayant <jayant@dourolabs.xyz>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
None yet
0 participants
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements a Solana Virtual Machine (SVM) version of the Entropy contract, mirroring the V2 API from the existing Ethereum Entropy contract. The implementation creates a new Anchor program
pyth-entropy
that provides secure randomness generation through a 2-party protocol between providers and requesters.Key Components Added:
pyth-entropy
using Anchor frameworkEntropyConfig
,ProviderInfo
,EntropyRequest
register()
,requestV2()
,revealWithCallback()
, provider management functionsRationale
The Pyth Network requires a Solana-native entropy solution to provide secure randomness generation on the Solana blockchain. This implementation adapts the proven Ethereum Entropy contract design to Solana's account-based execution model while maintaining the same V2 API surface.
The 2-party randomness protocol ensures that neither providers nor requesters can manipulate the final random values, making it suitable for applications requiring verifiable randomness.
How has this been tested?
cargo build --package pyth-entropy
Cryptographic Operations - The hash chain verification, commitment construction, and random value combination logic in
reveal_helper()
,construct_provider_commitment()
, andcombine_random_values()
functions need careful review for correctness.Account Security Model - PDA derivation patterns and account constraints, especially around provider registration and request validation. Note that treasury initialization was simplified during compilation fixes.
Fee Collection Mechanism - The treasury account handling was modified to resolve compilation issues. The fee calculation and collection logic in
get_fee_v2()
and withdrawal functions needs verification.API Completeness - Verify that all V2 methods from the Ethereum contract are correctly implemented and behave equivalently in Solana's execution environment.
Missing Test Coverage - This implementation has no tests covering the cryptographic operations, fee handling, or account security constraints.
Link to Devin run: https://app.devin.ai/sessions/a7002e6456b34f0eb392ed36bf464823
Requested by: Jayant (jayant@dourolabs.xyz)
Files Changed:
target_chains/solana/programs/pyth-entropy/
- Complete new program implementationtarget_chains/solana/Cargo.toml
- Added to workspace members