What can be the reasons for this error other then Transform function? What I know is only one that is transform function, in which we need to fix our responses so that all replicas have same res for consensus. In my knowledge i did that. What else i can do to avoid this error?
Am i missing anything?
PS: What if i send empty body and headers to transform function for a simple outgoing call ? Would that call reach consensus?
I don’t know any other sources of No Consensus Reached other than the transform function being a problem. A common cause for such problems is when the requests don’t arrive at the exact same time (e.g. an exchange producing a different price for the timestamps 12:54:34.01 and 12:54:34.03).
To debug, I’d start with a super obviously not-wrong transform function, e.g. it just returns "test". Then very slowly add more parts to the response until you can be sure what exactly is the problem.
Summary of the DM conversation for other people that have the same problem:
Exact error message is:
Call was rejected:
Request ID: 51984767509836d8bf040b9df8b2be4707fb50eba181c52b61011e4573d5fc91
Reject code: 4
Reject text: Canister http responses were different across replicas, and no consensus was reached
Problem was/is that the subnet does not contain the breaking change yet. How to verify:
This is a resolved thread, but I am asking because I got the same error and unknown.
I am getting the same error when I make an HTTP request after deploying.
Failed to fetch price data from CoinGecko: Error: Call was rejected:.
Request ID: bde2ddbeec03b2379a682d7bcfd05381d84f7f25e1cb87b742938880194dfc0f
Reject code: 4
Reject text: Canister http responses were different across replicas, and no consensus was reached
Following the steps in this thread, the subnet name and Replica Version obtained are as follows:
Subnet: 3hhby-wmtmw-umt4t-7ieyg-bbiig-xiylg-sblrt-voxgt-bqckd-a75bf-rqe
Elect Replica Version: 2023-09-18 Release: da97e4757dc3746fe513e233ffcf22547948e911 - ICP Dashboard
My understanding is that the version has already been upgraded beyond the deadline (2022-11-07, 16:03:58 UTC) and is not the cause of the error in this thread. If you have a cause that you can identify with this error, please let me know.
I finally understand, I have just changed the example code to the real time price API and didn’t write the transform function, I need to round the price with a function so that the replicas prices are the same.
Thank you very much!
Some advice: If you round the price, then you can have the situation where 1/2 of the replicas round up and the others down. It’s usually better to request the price for a specific timestamp (here you’d use system time to get the current timestamp and then request the price for that timestamp) because this should return the same value for all replicas. Requesting the latest price will produce different prices because of latency