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
Hi!
I'm trying to extract the ABI of the near-sdk-rs/examplescode using cargo-near. However, it seems that it extracts the wrong ABI in some cases.
When I run cargo-near in examples/cross-contract-call/high-level , the factorial function comes out view function. But it only success when n = 1, and if n>1, the following error occurs: Error: Querying [object Object] failed: wasm execution failed with error: FunctionCallError(HostError(ProhibitedInView { method_name: "promise_batch_create" })).
It success when I use call.
Also in the case of examples/factory-contract/high-level, kind of deploy_status_message and get_result comes out view. However when I execute that method using view, an error occurs as same in the above case. And It works well when I use call.
This is a part of a bigger problem where near-sdk-rs decides whether a function is call or view purely based on how self is borrowed. In this case, factorial borrows &self, which indicates that this is a view function. This is obviously false though as the function makes a cross-contract call. We could add an ad-hoc case where we check the return and mark functions as call if the return type is Promise.
The long-term fix would probably have to be explicit #[call]/#[view] annotations for all functions.
Hi!
I'm trying to extract the ABI of the
near-sdk-rs/examples
code usingcargo-near
. However, it seems that it extracts the wrong ABI in some cases.When I run
cargo-near
inexamples/cross-contract-call/high-level
, thefactorial
function comes outview
function. But it only success when n = 1, and if n>1, the following error occurs:Error: Querying [object Object] failed: wasm execution failed with error: FunctionCallError(HostError(ProhibitedInView { method_name: "promise_batch_create" })).
It success when I use
call
.cross-contract-high-level-abi.json
:Also in the case of
examples/factory-contract/high-level
, kind ofdeploy_status_message
andget_result
comes outview
. However when I execute that method usingview
, an error occurs as same in the above case. And It works well when I usecall
.I'm not sure but I think that abi is extracted like this in the case of a cross-contract call. Could you check this issue?
The text was updated successfully, but these errors were encountered: