Skip to content

Commit e209d3f

Browse files
devin-ai-integration[bot]Jayant Krishnamurthy
andcommitted
docs: add handling callback failures section to entropy best practices
Co-Authored-By: Jayant Krishnamurthy <[email protected]>
1 parent 19fc875 commit e209d3f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

pages/entropy/best-practices.mdx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,20 @@ function mapRandomNumber(
3333
3434
```
3535

36+
## Handling Callback Failures
37+
38+
While the default entropy provider is highly reliable, in rare cases a callback might not be received. This typically happens when there's an issue with your contract's callback implementation rather than with the provider itself. The most common causes are:
39+
40+
1. The callback function is using more gas than the allowed limit
41+
2. The callback function contains logic that throws an error
42+
43+
If you're not receiving a callback, you can manually invoke it to identify the specific issue. This allows you to:
44+
- See if the transaction fails and why
45+
- Check the gas usage against the chain's callback gas limit
46+
- Debug your callback implementation
47+
48+
For detailed instructions on how to manually invoke and debug callbacks, refer to the [Debug Callback Failures](./debug-callback-failures) guide.
49+
3650
Notice that using the modulo operator can distort the distribution of random numbers if it's not a power of 2. This is
3751
negligible for small and medium ranges, but it can be noticeable for large ranges.
3852
For example, if you want to generate a random number between 1 and 52, the probability of having value 5 is approximately

0 commit comments

Comments
 (0)