Skip to content

Commit 38b781f

Browse files
authored
Entropy callback warning (#529)
* add pointer to debug guide * fix tag * fix highlight
1 parent 67dba48 commit 38b781f

File tree

1 file changed

+11
-2
lines changed
  • pages/entropy/generate-random-numbers

1 file changed

+11
-2
lines changed

pages/entropy/generate-random-numbers/evm.mdx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ This method returns a sequence number and emits a [`RequestedWithCallback`](http
119119

120120
### 3. Implement callback for Entropy
121121

122-
```solidity {28-38} copy
122+
```solidity {28-42} copy
123123
pragma solidity ^0.8.0;
124124
125125
import { IEntropyConsumer } from "@pythnetwork/entropy-sdk-solidity/IEntropyConsumer.sol";
@@ -151,6 +151,10 @@ contract YourContract is IEntropyConsumer {
151151
// @param provider The address of the provider that generated the random number. If your app uses multiple providers, you can use this argument to distinguish which one is calling the app back.
152152
// @param randomNumber The generated random number.
153153
// This method is called by the entropy contract when a random number is generated.
154+
// This method **must** be implemented on the same contract that requested the random number.
155+
// This method should **never** return an error -- if it returns an error, then the keeper will not be able to invoke the callback.
156+
// If you are having problems receiving the callback, the most likely cause is that the callback is erroring.
157+
// See the callback debugging guide here to identify the error https://docs.pyth.network/entropy/debug-callback-failures
154158
function entropyCallback(
155159
uint64 sequenceNumber,
156160
address provider,
@@ -170,7 +174,12 @@ contract YourContract is IEntropyConsumer {
170174

171175
When the final random number is ready to use, the entropyCallback function will be called by the Entropy contract. This will happen in a separate transaction submitted by the requested provider.
172176

173-
**The entropyCallback function should be implemented in the same contract that is requesting the random number.**
177+
<Callout type="warning" emoji="⚠️">
178+
The `entropyCallback` function should **never** return an error. If it returns
179+
an error, the keeper will not be able to invoke the callback. If you are
180+
having problems receiving the callback, please see [Debugging Callback
181+
Failures](/entropy/debug-callback-failures).
182+
</Callout>
174183

175184
## Additional Resources
176185

0 commit comments

Comments
 (0)