-
Notifications
You must be signed in to change notification settings - Fork 37.7k
Stratum v2 Template Provider (take 2) #28983
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
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
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. |
576828e ci: test-each-commit merge base optional (Sjors Provoost) e9bfbb5 ci: forks can opt-out of CI branch push (Cirrus only) (Sjors Provoost) Pull request description: Maintainer note: `SKIP_BRANCH_PUSH=true` must be set in Cirrus for `bitcoin-core/gui` before merging this. See `https://cirrus-ci.com/github/bitcoin-core/gui` -> Settings. --- I find myself making pull requests against my fork (mostly on top of #28983, or asking others to do so. Currently only the Github actions are run on forks, because we use self-hosted runners for the Cirrus tasks. While setting up my own self-hosted runners for my fork, I ran into a number of issues. Some of those were addressed by #29441, but remaining issues are: 1. When PRs are opened in the fork, cirrus CI jobs are run twice because PRs and branches reside in the same repository, rather than a main repository and a fork repository, as is the case with bitcoin/bitcoin PRs. Fix this by adding a `SKIP_BRANCH_PUSH` configuration option that allows skipping CI runs not directly associated with a PR. The fix is a generalization of [#20328](#20328), which fixed a similar problem for the bitcoin-core/gui mirror repository, and it allows removing a hardcoded reference to that repository. Github actions jobs will still run twice despite this change, see [#29274 (comment)](#29274 (comment)). Initially this PR tried to prevent that with b9fdd0d, but this had some potentially negative side effects, see [#29274 (comment)](#29274 (comment)), so that commit was dropped for now. 2. When PRs are opened in the fork, the "test-each-commit" github action can fail due to not being able to find a recent merge commit. This problem doesn't happen in the bitcoin/bitcoin repository because branches in this repository used as the base for pull requests always point at merge commits. This PR replaces #29259 using the self hosted workers via Cirrus instead of Github. You can see this PR in action on this pull request to my fork: Sjors#30 To test it yourself: 1. spin up at least two [self hosted runners](https://github.com/cirruslabs/cirrus-cli/blob/master/PERSISTENT-WORKERS.md). Either use a seperate VM for each, or give them their own user. 3. Install Podman and other CI dependencies (see .cirrus.yml) 4. Give Cirrus access to your fork at https://cirrus-ci.com/settings/github/YOU 5. Get a token from Cirrus and use it to start your worker(s) 6. Optionally set SKIP_BRANCH_PUSH=true ~and NO_ARM=true~ env variables (see .cirrus.yml) make a pull request to your own fork, with this PR as the base branch Security wise: when dealing with code from strangers on the internet, review it first before running the CI. There's a Cirrus check-box that requires approval for people without write access to trigger CI. ACKs for top commit: maflcko: ACK 576828e ryanofsky: Code review ACK 576828e. Tree-SHA512: fb6be2f228aa62f45a65ce5c613c979b6f387df396f9601ce4622b27aa317a66f198e7d7a194592b0bb397b32a2f50f8be47065834d74af4ea09407c5c8d306d
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)