Skip to content

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 3 commits into from
Jul 30, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pages/entropy/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
},

"index": "Introduction",
"whats-new-entropyv2": "What's New in Entropy v2",

"-- Tutorials": {
"title": "Tutorials",
Expand Down
83 changes: 83 additions & 0 deletions pages/entropy/whats-new-entropyv2.mdx
Copy link
Contributor

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?

Copy link
Member Author

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?

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

- abstracted away the information from `EntropyStructs.Request` to the `Revealed` event for easier consumption.
- added a `callbackFailed` boolean to indicate if the callback failed.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: prefer the present tense -- "abstracts away" and "adds a"

Copy link
Contributor

Choose a reason for hiding this comment

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

also instead of "abstracted away..." I'd say something like:
"Denormalizes fields from EntropyStructs.Request to a flat representation for easier consumption."


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)
Loading