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
Stratum v2 Template Provider (take 2) #28983
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code CoverageFor detailed information about the code coverage, see the test coverage report. ReviewsSee the guideline for information on the review process. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
6422c27
to
6c03adb
Compare
Rebased and fixed encoding mistake I made during rebase: diff --git a/src/node/sv2_messages.h b/src/node/sv2_messages.h
index fd6974b998..d3b257c31c 100644
--- a/src/node/sv2_messages.h
+++ b/src/node/sv2_messages.h
@@ -533,11 +533,11 @@ struct Sv2SubmitSolutionMsg
s >> m_template_id >> m_version >> m_header_timestamp >> m_header_nonce;
// Ignore the 2 byte length as the rest of the stream is assumed to be
// the m_coinbase_tx.
s.ignore(2);
- s >> TX_NO_WITNESS(m_coinbase_tx);
+ s >> TX_WITH_WITNESS(m_coinbase_tx);
}
}; Yes, the coinbase transaction has a witness. |
6c03adb
to
2991270
Compare
I moved |
2991270
to
19d37d3
Compare
I de-duplicated code in I dropped Hopefully I didn't break anything, but I did test on my custom CPU mined signet. |
19d37d3
to
52408fa
Compare
Pleased clang-tidy. Fixed memory issue by disabling a broken test, added |
30417b2
to
e1b7e8a
Compare
Ran clang-tidy locally to (hopefully) fix its remaining complaints. Included @Fi3's Sjors#25 (plus additional header and test change) which drops the |
a546ff0
to
31f9ae2
Compare
I guess I didn't catch them all locally. Pushed a change to the last (linter commit). Also fixed the broken noise handshake test. Replaced @hebasto any idea how to handle class Sv2CipherState
{
public:
Sv2CipherState() = default;
...
ssize_t WriteMsg(Span<std::byte> msg); |
31f9ae2
to
eb0f61f
Compare
The template provider will listen for a Job Declarator client. It can establish a connection and detect various protocol errors. Co-Authored-By: Christopher Coverdale <chris.coverdale24@gmail.com> Co-Authored-By: Fi3
Co-Authored-By: Christopher Coverdale <chris.coverdale24@gmail.com>
Co-Authored-By: Christopher Coverdale <chris.coverdale24@gmail.com>
Co-Authored-By: Fi3
3bb4604
to
cfbdf2b
Compare
🚧 At least one of the CI tasks failed. Make sure to run all tests locally, according to the Possibly this is due to a silent merge conflict (the changes in this pull request being Leave a comment here, if you need help tracking down a confusing failure. |
🐙 This pull request conflicts with the target branch and needs rebase. |
(I plan to rebase this after some other stuff is merged) |
I opened a (draft) pull request for the Noise part of this: #29346 (will rebase this PR on that later, but right now that would break compatibility) |
Added two commits to stay in sync with SRI: stratum-mining/stratum#742 Next week I'll try to rebase this on the latest #29346, which has diverged a bit. |
I rebased on top of #29346 and pushed the result to: https://github.com/Sjors/bitcoin/tree/2024/02/sv2-poll-ellswift Once EllSwift lands on the SRI side (or if I make a revert commit for it) I'll update this PR. |
Added to |
I added tests for We'll need some way to limit the amount of memory that this can take up. Perhaps by pruning old (lower fee) templates more aggressively. |
This PR is superseeded by #29432. |
Based on on @Fi3's master...Fi3:bitcoin:PatchTemplates which is based on @ccdle12's #27854. I rebased it and re-wrote the commit history. See the original branch for the evolution of the spec.
See docs/stratum-v2.md for a brief description of Stratum v2 and the role of Bitcoin Core in that system..
What to test and review?
See the testing guide for various ways to test this PR. This branch is actively used by (testnet) pools, so it should be ready for high level review.
I'll make separate pull requests for parts that are ready for detailed review. Probably starting with ECDH and the Noise Protocol.
Implementation notes
Silent Payments also needs the ECDH module, so I cherry-picked the commit from #28122. It uses ECDH is a slightly different way, but perhaps there's more overlap to be had.
Contributing
If you want to help out with any of the issues below, please open a PR to my fork. I will then squash your commits into my own where needed.
Upstream issues
Spec
ProvideMissingTransactions
? (followup?)default_coinbase_tx_additional_output_size
(seegetblocktemplate
RPC)Noise
Networking
-sv2bind
and-sv2allowip
-sv2cert
Sv2Transport
subclass similar toV2Transport
: Introduce Sv2Transport Sjors/bitcoin#27Sv2TemplateProvider::SendBuf
, reuse p2p socket handling if possiblecoinbase_output_max_additional_size
sv2_messages.h
Testing
Template generation and updating
coinbase_tx_additional_output_size
Misc
GetMerklePathForCoinbase
helper (see Future Work in original PR, and Fix NewTemplate.merkle_path in bitcoind stratum-mining/stratum#567)Potential followups
test/sv2_template_provider_tests.cpp
)bitcoin-tp
binary, see multiprocess.mdSubmitSolution
message)