-
Notifications
You must be signed in to change notification settings - Fork 36
chore(entropy) What's new #778
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# What's New in Entropy V2 | ||
|
||
Entropy V2 is a major update to the Pyth Randomness Protocol. | ||
|
||
It introduces a series of developer experience improvements, shaped directly by the feedback of teams using it in production: | ||
configurable & customizable gas limits for callbacks, adding callback statuses, and an upcoming public Entropy Explorer. | ||
|
||
## What's New | ||
|
||
- [Configurable Gas Limits for Callbacks](#configurable-gas-limits-for-callbacks) | ||
- [Enhanced Callback Statuses](#enhanced-callback-statuses) | ||
- [Upcoming Public Entropy Explorer](#upcoming-public-entropy-explorer) | ||
|
||
### Configurable Gas Limits for Callbacks | ||
|
||
Entropy V2 introduces configurable gas limits for callbacks. | ||
This allows teams to set the gas limit for their callbacks, which can be useful for: | ||
|
||
- Computing expensive operations in the callback like minting an NFT collection. | ||
- Save money on gas fees by setting a lower gas limit. | ||
|
||
```solidity copy | ||
// Calculate the fee for the custom gas limit | ||
uint256 fee = entropy.getFeeV2(customGasLimit); | ||
|
||
// Request random number with custom gas limit | ||
uint64 sequenceNumber = entropy.requestV2{ value: fee }(customGasLimit); | ||
``` | ||
|
||
### Enhanced Callback Statuses | ||
|
||
Entropy V2 introduces callback statuses, which allow teams to track the status of their callbacks. | ||
These callback statuses are emitted in the `Revealed` event. | ||
|
||
Previous version of Entropy use to emit the following `RevealedWithCallback` event: | ||
|
||
```solidity copy | ||
event RevealedWithCallback( | ||
EntropyStructs.Request request, | ||
bytes32 userRandomNumber, | ||
bytes32 providerRevelation, | ||
bytes32 randomNumber | ||
); | ||
``` | ||
|
||
Based on the feedback from teams, we have added the following statuses to the `Revealed` event: | ||
|
||
```solidity copy | ||
event Revealed( | ||
address indexed provider, | ||
address indexed caller, | ||
uint64 indexed sequenceNumber, | ||
bytes32 randomNumber, | ||
bytes32 userContribution, | ||
bytes32 providerContribution, | ||
bool callbackFailed, | ||
bytes callbackReturnValue, | ||
uint32 callbackGasUsed, | ||
bytes extraArgs | ||
); | ||
``` | ||
|
||
This updated `Revealed` event | ||
|
||
- denormalizes fields from `EntropyStructs.Request` to a flat representation in the `Revealed` event for easier consumption. | ||
- adds a `callbackFailed` boolean to indicate if the callback failed. | ||
|
||
This will help teams to easily track the status of their callbacks and re-request them if they fail on-chain. | ||
|
||
### Upcoming Public Entropy Explorer | ||
|
||
Entropy V2 introduces an upcoming public Entropy Explorer, which will allow teams to easily track the status of their callbacks and re-request them if they fail on-chain. | ||
|
||
This will help teams to easily track the status of their callbacks and re-request them if they fail on-chain. | ||
|
||
## Additional Resources | ||
|
||
These following resources will help you get started with Entropy V2: | ||
|
||
- [Entropy V2 Guide](./generate-random-numbers/evm.mdx) | ||
- [Entropy V2 Contracts](https://github.com/pyth-network/pyth-crosschain/tree/main/target_chains/ethereum/contracts/contracts/entropy) | ||
- [Entropy V2 SDK](https://github.com/pyth-network/pyth-crosschain/tree/main/target_chains/ethereum/entropy_sdk/solidity) | ||
- [Entropy V2 Examples](https://github.com/pyth-network/pyth-examples/tree/main/entropy) |
Oops, something went wrong.
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.
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.
Do we wanna mention the reliability upgrades in this doc?
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.
I was not sure about that. What do you think?