I have extracted the method parse_read_state_response from the IC (Internet Computer) source code, which is used for parsing and signature verification of read_state within a canister. It was running smoothly a month ago, but now I’ve observed that this function throws an exception under the inspect_message function. Interestingly, it works fine under the update function. When tested in a local IC virtual environment, the function exhibits no exceptions under both inspect_messageand update function.
I don’t see why it wouldn’t work all the time. What problem are you observing?
When I comment out the parse_read_state_response
method in the inspect_message function, the request can be passed.
Assigned to the corresponding method of ic_cdk::api::call::method_name().as_str()
, using parse_read_state_response
in the corresponding method can pass and parse Result<RequestStatus, String>
normally
It seems that parse_read_state_response
method cannot be used in inspect_message
I commented the code in the inspect_message
method line by line and redeployed it to the IC chain for testing. I found that only parse_read_state_response
could not be executed without commenting it out. Because I could not find how to throw an error in inspect_message
, I could not determine what happened to it.
Maybe to step back a little: What are you trying to accomplish? I’m struggling to come up with a scenario where you would want to run this in inspect_message
(TBH I’m not sure about running it in an update call either, but there I can see it a bit better). In general this is code that is not meant to be executed in a canister