-
Notifications
You must be signed in to change notification settings - Fork 127
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
JDS can't submit block if some transactions are missing #912
Comments
I just want to add that I got this issue during last weeks of testing on testnet3. |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
I'm writing a Message Generator test to reproduce this scenario. main test:
JDC mock:
@GitGab19 since you reported this bug and have a more refined understanding of the message flow, can you make sure I'm not missing anything? Please note that this is not following strictly the issue description. Since JDC is a mock, there's no need to include messages that represent the interactions between JDC and TP. Also, here's a few questions that come to mind:
|
It seems everything is there (in the message flow) 👍 |
@plebhash to be completely sure about the unnecessity of TP in the MG test, try to run JDS without it and see if JDC is able to connect to it. |
The content of |
If I remember correctly, some time ago we decided that if the JDS cannot propagate the block, or if there an RPC error, the JDS should close the connection. So, I think this is the expected behavior. I don't like it too, tbh |
I don't remember this, imo it shouldn't close connection for this specific error. Maybe it would make sense for other RPC errors (I don't think so but I don't have a strong opinion on this) but not for this one |
A posssible approach is to use rpc client in order relay transactions to the bitcoin network |
yep I think that JDS should send to bitcoind every missing txs that it receive |
right now my test is incomplete, and it looks like this: main test:
JDC mock:
if I remove step 3, JDS never complains about not being able to reach TP. But with step 3, I see these logs:
this is not doing anything related to @GitGab19 do you think this is enough to reproduce the issue you wanted to report here? or should one interesting thing is that JDS sends a |
@plebhash are you using our hosted TP for this test? Could it be that JDS is not using the correct port for RPC? |
Btw, |
so far there's absolutely no TP on this setup, but it seems we need one I don't think we are able to mock a TP for RPC, right? it seems to me that the only solution is to launch a real TP |
I think that connecting this JDS to our hosted one could be just fine! |
The node will likely refuse remote rpc connection. I remember that when I dev the rpc client wasn't possible to connect to VPS for this reason. It can be disable btw, but I don't remember well. |
I enabled this yesterday: #990 (comment) |
IMO, if the JDS cannot reconstruct the block, there is no way it can send a submit_block, and then it returns an error. So, here is the exact part where the JDS disconnects if there is a mempool error. // this is called by `error_handling::handle_result!`
pub async fn handle_error(sender: &Sender, e: JdsError) -> error_handling::ErrorBranch {
tracing::debug!("Error: {:?}", &e);
match e {
JdsError::Io(_) => send_status(sender, e, error_handling::ErrorBranch::Break).await,
JdsError::ChannelSend(_) => {
//This should be a continue because if we fail to send to 1 downstream we should continue
//processing the other downstreams in the loop we are in. Otherwise if a downstream fails
//to send to then subsequent downstreams in the map won't get send called on them
send_status(sender, e, error_handling::ErrorBranch::Continue).await
}
JdsError::ChannelRecv(_) => {
send_status(sender, e, error_handling::ErrorBranch::Break).await
}
JdsError::BinarySv2(_) => send_status(sender, e, error_handling::ErrorBranch::Break).await,
JdsError::Codec(_) => send_status(sender, e, error_handling::ErrorBranch::Break).await,
JdsError::Noise(_) => send_status(sender, e, error_handling::ErrorBranch::Continue).await,
JdsError::RolesLogic(_) => send_status(sender, e, error_handling::ErrorBranch::Break).await,
JdsError::Custom(_) => send_status(sender, e, error_handling::ErrorBranch::Break).await,
JdsError::Framing(_) => send_status(sender, e, error_handling::ErrorBranch::Break).await,
JdsError::PoisonLock(_) => send_status(sender, e, error_handling::ErrorBranch::Break).await,
JdsError::Sv2ProtocolError(_) => {
send_status(sender, e, error_handling::ErrorBranch::Break).await
}
JdsError::MempoolError(_) => {
send_status(sender, e, error_handling::ErrorBranch::Break).await
}
JdsError::ImpossibleToReconstructBlock(_) => {
send_status(sender, e, error_handling::ErrorBranch::Continue).await
}
JdsError::NoLastDeclaredJob => {
send_status(sender, e, error_handling::ErrorBranch::Continue).await
}
}
} it is in JdsError::MempoolError(_) => {
send_status(sender, e, error_handling::ErrorBranch::Break).await
} To fix it, you can either returning a @plebahash this is related to a plan that you wanted to do some moneths ago (I share you the document in pvt) |
it seems
is that correct? that is a bit confusing, maybe we should do something about it here stratum-mining/sv2-spec#77 anyways, I added a new
I created an issue for this: #1002 |
Yeah it is. |
this is the actual fix for stratum-mining#912
this is the actual fix for stratum-mining#912
this is the actual fix for stratum-mining#912
this is the actual fix for stratum-mining#912
this is the actual fix for stratum-mining#912
this is the actual fix for stratum-mining#912
this is the actual fix for stratum-mining#912
this is the actual fix for stratum-mining#912
this is the actual fix for stratum-mining#912
this is the actual fix for stratum-mining#912 use handle_result! macro following suggestion by @lorbax stratum-mining#1025 (comment) the implementation diverged a bit from the suggestion, but it was still a good reminder that we should leverage `handle_result!` macro here
this is the actual fix for stratum-mining#912 use handle_result! macro following suggestion by @lorbax stratum-mining#1025 (comment) the implementation diverged a bit from the suggestion, but it was still a good reminder that we should leverage `handle_result!` macro here
As you can see from the logs attached here, this is the messages flow which causes the issue:
NewTemplate
received by JDCRequestTransactionData
from JDC to TPRequestTransactionDataSuccess
from TP to JDCDeclareMiningJob
from JDC to JDSProvideMissingTransactions
from JDS to JDCProvideMissingTransactionsSuccess
a block is found, so there's aSubmitSolution
from JDC to JDSProvideMissingTransaction
message, so errors are generatedJDS logs:
JDC logs:
The big problem here is that connection between JDS and JDC is closed in this case, so JDC stops working properly after that.
We should manage this situation better, avoiding the connection to be closed.
The text was updated successfully, but these errors were encountered: