You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pages/entropy/best-practices.mdx
+14Lines changed: 14 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,6 +33,20 @@ function mapRandomNumber(
33
33
34
34
```
35
35
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
+
36
50
Notice that using the modulo operator can distort the distribution of random numbers if it's not a power of 2. This is
37
51
negligible for small and medium ranges, but it can be noticeable for large ranges.
38
52
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