首页 > 解决方案 > 未处理的拒绝:ChainErr("missing field `proof`")

问题描述

我正在使用 docker 运行带有单个验证器的本地测试网。在将用 Rust 编写的智能合约部署到链上后,我从网络服务器(也是用 Rust 编写)调用合约的方法之一。通过构建一个 SignedTransaction(来自near_primitives::transaction::*)并通过 JSON-RPC 将其广播到网络来进行调用:

const NEAR_NODE: &'static str = "http://localhost:3030";

macro_rules! json_reqwest {
    ($req:expr => $client:ident) => {
        {
            let res = $client.post(NEAR_NODE)
                .json(&$req)
                .send()
                .await
                .map_err(|e| e.to_string())?
                .json::<Response>()
                .await
                .map_err(|e| e.to_string())?;
            serde_json::from_value(res.result.map_err(|e| e.message)?)
                .map_err(|e| e.to_string())?
        }
    };
}

async fn broadcast_tx(client: &Client, signed_tx: &mut SignedTransaction) -> Result<FinalExecutionOutcomeView, String> {
    signed_tx.init();
    println!("NEAR Tx hash: {}", signed_tx.get_hash());
    let tx = signed_tx.try_to_vec().map_err(|e| e.to_string())?;
    Ok(json_reqwest!(Message::request("broadcast_tx_commit".to_string(), Some(json!([to_base64(&tx)]))) => client))
}

这是来自网络的回应:

Unhandled rejection: ChainErr("missing field `proof`")

这个错误是什么意思,我该如何解决?

谢谢你的帮助!

标签: rustblockchainsmartcontractsnearprotocol

解决方案


这个问题存在于旧版本的近核中,应该在 1.0.0+ 中解决。


推荐阅读