Skip to content

Commit 7e593f5

Browse files
authored
feat(entropy): More best practices (#337)
* feat(entropy): More best practices * Update etherlink gaslimit
1 parent db50963 commit 7e593f5

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

components/EntropyDeployments.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ export const EntropyDeployments: Record<string, EntropyDeployment> = {
163163
"berachain-testnet-v2": {
164164
rpc: "https://evm-rpc-bera.rhino-apis.com/",
165165
network: "testnet",
166-
delay: "",
166+
delay: "https://bartio.beratrail.io/address/$ADDRESS",
167167
address: "0x36825bf3Fbdf5a29E2d5148bfe7Dcf7B5639e320",
168168
explorer: "",
169169
gasLimit: "500K",
@@ -236,7 +236,7 @@ export const EntropyDeployments: Record<string, EntropyDeployment> = {
236236
address: "0x23f0e8FAeE7bbb405E7A7C3d60138FCfd43d7509",
237237
explorer: "https://testnet-explorer.etherlink.com/address/$ADDRESS",
238238
delay: "",
239-
gasLimit: "500K",
239+
gasLimit: "15M",
240240
network: "testnet",
241241
rpc: "https://node.ghostnet.etherlink.com",
242242
},

pages/entropy/best-practices.mdx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
# Best Practices
22

3+
## Limit gas usage on the callback
4+
5+
Keeping the callback function simple is crucial because the entropy providers limit gas usage.
6+
This ensures gas usage is predictable and consistent, avoiding potential issues with the callback.
7+
8+
For example, if you want to use entropy to generate a random number for each player in a round of game,
9+
you need to make sure that the callback function works for the maximum number of players that can be in each round.
10+
Otherwise, the callbacks will work for some rounds with fewer players, but will fail for rounds with more players.
11+
12+
Multiple solutions are possible to address this problem. You can store the random number received from the callback and
13+
either ask users to submit more transactions after the callback to continue the flow or run a background crank service
14+
to submit the necessary transactions.
15+
16+
The gas limit for each chain is listed on the [contract addresses](./contract-addresses) page.
17+
318
## Generating random values within a specific range
419

520
You can map the random number provided by Entropy into a smaller range using the solidity [modulo operator](https://docs.soliditylang.org/en/latest/types.html#modulo).

0 commit comments

Comments
 (0)