Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report] miner_client can not submit seal #3356

Closed
sanlee42 opened this issue Apr 20, 2022 · 0 comments · Fixed by #3362
Closed

[Bug Report] miner_client can not submit seal #3356

sanlee42 opened this issue Apr 20, 2022 · 0 comments · Fixed by #3362
Labels
bug Something isn't working

Comments

@sanlee42
Copy link
Member

Bug Report

Starcoin version:
升级actix 版本到0.13之后. #3271

Current behavior:
starcoin_miner client 无法提交 seal, 能获取到job, 但计算出来的 seal 无法提交至 starcoin node stratum service.

Steps to reproduce:

./target/debug/starcoin -n mychain:253 --genesis-config halley
RUST_LOG=debug ./target/debug/starcoin_miner  -u fikgol -a 127.0.0.1:9880 -n 4

可以观察到所有出块都是 starcoin node, starcoin_miner 能计算,但无法提交seal。

Related code:
cmd/miner_client/src/stratum_client_service.rs

impl ServiceHandler<StratumClientService, SubmitSealRequest> for StratumClientService {
    fn handle(
        &mut self,
        msg: SubmitSealRequest,
        _ctx: &mut ServiceContext<StratumClientService>,
    ) -> <SubmitSealRequest as ServiceRequest>::Response {
        //FIXME: Failed to receive this msg since upgrade actix to 0.13.
        if let Some(sender) = self.sender.clone().take() {
            if let Err(e) = sender.unbounded_send(Request::SubmitSealRequest(msg)) {
                error!("stratum handle submit seal request failed:{}", e);
            }
        } else {
            unreachable!()
        }
    }
}

the SubmitSealRequest message 的 handle 逻辑无法永远无法触发。

消息的发送端: cmd/miner_client/src/stratum_client.rs

    async fn submit_seal(&self, seal: SealEvent) -> Result<()> {
        let srv = self.stratum_cli_srv.clone();
        let mut n = Vec::new();
        n.write_u32::<LittleEndian>(seal.nonce)?;
        let nonce = hex::encode(n);
        let mint_extra = seal
            .extra
            .ok_or_else(|| anyhow::anyhow!("submit missing field"))?;
        if let Err(e) = srv.try_send(SubmitSealRequest(ShareRequest {
            id: mint_extra.worker_id,
            job_id: mint_extra.job_id,
            nonce,
            result: seal.hash_result,
        })) {
            error!("failed to submit seal request {:?}", e);
        }
        Ok(())
    }

如果send message 改成async 的

srv.send(SubmitSealRequest(ShareRequest {
            id: mint_extra.worker_id,
            job_id: mint_extra.job_id,
            nonce,
            result: seal.hash_result,
        })).await

则这里会一直卡住,无法返回。

改成srv.do_send则不会卡住,但是也没有报错。但依旧无法触发messge handle

@sanlee42 sanlee42 added the bug Something isn't working label Apr 20, 2022
@jolestar jolestar changed the title [Bug Report] [Bug Report] miner_client can not submit seal Apr 20, 2022
@jolestar jolestar linked a pull request Apr 22, 2022 that will close this issue
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant