From b27eed824d44af8914d76408462b287748b501a3 Mon Sep 17 00:00:00 2001 From: Jayant Krishnamurthy Date: Thu, 5 Dec 2024 07:06:00 -0800 Subject: [PATCH 1/3] add pointer to debug guide --- pages/entropy/generate-random-numbers/evm.mdx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pages/entropy/generate-random-numbers/evm.mdx b/pages/entropy/generate-random-numbers/evm.mdx index 698ede81..195ab9cf 100644 --- a/pages/entropy/generate-random-numbers/evm.mdx +++ b/pages/entropy/generate-random-numbers/evm.mdx @@ -151,6 +151,10 @@ contract YourContract is IEntropyConsumer { // @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. // @param randomNumber The generated random number. // This method is called by the entropy contract when a random number is generated. + // This method **must** be implemented on the same contract that requested the random number. + // This method should **never** return an error -- if it returns an error, then the keeper will not be able to invoke the callback. + // If you are having problems receiving the callback, the most likely cause is that the callback is erroring. + // See the callback debugging guide here to identify the error https://docs.pyth.network/entropy/debug-callback-failures function entropyCallback( uint64 sequenceNumber, address provider, @@ -170,7 +174,9 @@ contract YourContract is IEntropyConsumer { 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. -**The entropyCallback function should be implemented in the same contract that is requesting the random number.** + + The `entropyCallback` function should **never** return an error. If it returns an error, the keeper will not be able to invoke the callback. + If you are having problems receiving the callback, please see [Debugging Callback Failures](/entropy/debug-callback-failures). ## Additional Resources From a39981ae6cdee6908a15d825826c07b0f2ad1be2 Mon Sep 17 00:00:00 2001 From: Jayant Krishnamurthy Date: Thu, 5 Dec 2024 07:14:11 -0800 Subject: [PATCH 2/3] fix tag --- pages/entropy/generate-random-numbers/evm.mdx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pages/entropy/generate-random-numbers/evm.mdx b/pages/entropy/generate-random-numbers/evm.mdx index 195ab9cf..055c05a7 100644 --- a/pages/entropy/generate-random-numbers/evm.mdx +++ b/pages/entropy/generate-random-numbers/evm.mdx @@ -175,8 +175,11 @@ contract YourContract is IEntropyConsumer { 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. - The `entropyCallback` function should **never** return an error. If it returns an error, the keeper will not be able to invoke the callback. - If you are having problems receiving the callback, please see [Debugging Callback Failures](/entropy/debug-callback-failures). + The `entropyCallback` function should **never** return an error. If it returns + an error, the keeper will not be able to invoke the callback. If you are + having problems receiving the callback, please see [Debugging Callback + Failures](/entropy/debug-callback-failures). + ## Additional Resources From 4dbb7caa252b43f488f03c7707b2e3d0f623a000 Mon Sep 17 00:00:00 2001 From: Jayant Krishnamurthy Date: Fri, 6 Dec 2024 06:05:46 -0800 Subject: [PATCH 3/3] fix highlight --- pages/entropy/generate-random-numbers/evm.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/entropy/generate-random-numbers/evm.mdx b/pages/entropy/generate-random-numbers/evm.mdx index 055c05a7..a6ec0808 100644 --- a/pages/entropy/generate-random-numbers/evm.mdx +++ b/pages/entropy/generate-random-numbers/evm.mdx @@ -119,7 +119,7 @@ This method returns a sequence number and emits a [`RequestedWithCallback`](http ### 3. Implement callback for Entropy -```solidity {28-38} copy +```solidity {28-42} copy pragma solidity ^0.8.0; import { IEntropyConsumer } from "@pythnetwork/entropy-sdk-solidity/IEntropyConsumer.sol";