Skip to content

Stratum v2 Template Provider common functionality #49

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

Open
wants to merge 10 commits into
base: 2024/06/sv2_connection
Choose a base branch
from

Conversation

@Sjors
Copy link
Owner Author

Sjors commented Aug 13, 2024

Updated to the latest interface changes proposed in bitcoin#30409 and #53.

@Sjors Sjors force-pushed the 2024/06/sv2_connection branch from b549fd6 to 22d033c Compare August 13, 2024 17:14
@Sjors Sjors force-pushed the 2024/07/sv2-tp-common branch 2 times, most recently from 491755c to 16d2381 Compare August 13, 2024 18:07
@Sjors Sjors force-pushed the 2024/06/sv2_connection branch 3 times, most recently from 4f957ee to b69544c Compare August 29, 2024 11:49
@Sjors Sjors force-pushed the 2024/07/sv2-tp-common branch 2 times, most recently from ca73422 to 4fa25e0 Compare August 29, 2024 11:59
@Sjors
Copy link
Owner Author

Sjors commented Aug 29, 2024

Rebased for CMake

@Sjors
Copy link
Owner Author

Sjors commented Aug 30, 2024

One test still seems brittle:

src/test/sv2_template_provider_tests.cpp(256): fatal error: in "sv2_template_provider_tests/client_tests": critical check tester.GetBlockTemplateCount() == 3 has failed [2 != 3]

@Sjors Sjors force-pushed the 2024/06/sv2_connection branch from b69544c to 1ca68d2 Compare September 5, 2024 12:57
@Sjors Sjors force-pushed the 2024/07/sv2-tp-common branch from 1f720ff to 1912743 Compare September 5, 2024 15:56
@Sjors Sjors force-pushed the 2024/06/sv2_connection branch from 1ca68d2 to b578e0a Compare September 10, 2024 14:54
@Sjors Sjors force-pushed the 2024/07/sv2-tp-common branch 2 times, most recently from 598f08a to 436dc4d Compare September 11, 2024 05:39
@Sjors
Copy link
Owner Author

Sjors commented Sep 11, 2024

Moved TemplateProvider from node to common so that in #48 bitcoin-mine does not depend on bitcoin-node.

@Sjors Sjors force-pushed the 2024/07/sv2-tp-common branch from 436dc4d to 46fa8f1 Compare September 11, 2024 06:37
@Sjors Sjors force-pushed the 2024/06/sv2_connection branch from b578e0a to 489c9fb Compare September 19, 2024 15:02
@Sjors Sjors force-pushed the 2024/07/sv2-tp-common branch 2 times, most recently from 7db898e to 765af74 Compare September 19, 2024 16:13
@Sjors
Copy link
Owner Author

Sjors commented Feb 10, 2025

Possible thread issue, found by CI in #68: https://cirrus-ci.com/task/5072000852426752?logs=ci#L3303

@Sjors Sjors force-pushed the 2024/06/sv2_connection branch from 2503578 to 360aedd Compare February 10, 2025 14:31
@Sjors Sjors force-pushed the 2024/07/sv2-tp-common branch from 6b5dfc5 to fe053b0 Compare February 10, 2025 14:40
@Sjors
Copy link
Owner Author

Sjors commented Feb 10, 2025

Rebased after bitcoin#31384.

@Sjors Sjors force-pushed the 2024/06/sv2_connection branch from 360aedd to 49ea07a Compare February 21, 2025 15:07
@Sjors Sjors force-pushed the 2024/07/sv2-tp-common branch from fe053b0 to 5c3f9cb Compare February 21, 2025 15:14
@Sjors
Copy link
Owner Author

Sjors commented Feb 21, 2025

Rebased in hopes of making #80 magically go away.

@Sjors Sjors force-pushed the 2024/06/sv2_connection branch from 49ea07a to ac05646 Compare March 6, 2025 12:04
@Sjors Sjors force-pushed the 2024/07/sv2-tp-common branch from 5c3f9cb to 802ffdc Compare March 6, 2025 12:28
@Sjors
Copy link
Owner Author

Sjors commented Mar 6, 2025

I squashed 4c132d0 "Incrementally update sv2 block template" into 61eeca1 "Sv2: construct and submit block templates" and then refactored the combined commit ad3120b to fix #80. Every client now has its own thread in the TemplateProvider.

It could be improved further, e.g. the handshake is blocking and we're not using optimistic send, but I'm going to wait to see what @theuni comes up with in terms of an alternative approach to Connman.

@Sjors Sjors force-pushed the 2024/06/sv2_connection branch from ac05646 to 185eb09 Compare March 20, 2025 16:29
@Sjors Sjors force-pushed the 2024/07/sv2-tp-common branch from 802ffdc to 6a29c1d Compare March 20, 2025 16:31
@Sjors
Copy link
Owner Author

Sjors commented Mar 20, 2025

Occasional failing on CentOS probably means the tests need to be made more robust. https://cirrus-ci.com/task/5262823086882816

@Sjors Sjors force-pushed the 2024/06/sv2_connection branch from 185eb09 to 1a0f0f3 Compare April 8, 2025 17:49
@Sjors Sjors force-pushed the 2024/07/sv2-tp-common branch from 6a29c1d to b2f6576 Compare April 8, 2025 18:28
@Sjors Sjors force-pushed the 2024/06/sv2_connection branch 2 times, most recently from 5692ffa to 7d5d5ad Compare April 15, 2025 13:21
Sjors and others added 10 commits April 15, 2025 09:22
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 <[email protected]>
Co-Authored-By: Fi3
Co-authored-by: Christopher Coverdale <[email protected]>
Incrementally update the template.
The Consensus Cleanup soft fork proposal includes enforcing that coinbase transactions set their
locktime field to the block height, minus 1 (as well as their nSequence such as to not disable the
timelock). If such a fork were to be activated by Bitcoin users, miners need to be ready to produce
compliant blocks at the risk of losing substantial amounts mining would-be invalid blocks. As miners
are unfamously slow to upgrade, it's good to make this change as early as possible.

Although Bitcoin Core's GBT implementation does not provide the "coinbasetxn" field, and mining
pool software crafts the coinbase on its own, updating the Bitcoin Core mining code is a first step
toward convincing pools to update their (often closed source) code. A possible followup is also to
introduce new fields to GBT. In addition, this first step also makes it possible to test future
Consensus Cleanup changes.

The changes to the seemingly-unrelated RBF tests is because these tests assert an error message
which may vary depending on the txid of the transactions used in the test. This commit changes the
coinbase transaction structure and therefore impact the txid of transactions in all tests.

The change to the "Bad snapshot" error message in the assumeutxo functional test is because this
specific test case reads into the txid of the next transaction in the snapshot and asserts the error
message based it gets on deserializing this txid as a coin for the previous transaction. As this
commit changes this txid it impacts the deserialization error raised.
On by default.

Allow Stratum v2 miners to opt out, pending more discussion on the BIP.
@Sjors Sjors force-pushed the 2024/07/sv2-tp-common branch from b2f6576 to 134d8b3 Compare April 15, 2025 13:32
@Sjors
Copy link
Owner Author

Sjors commented Apr 15, 2025

Rebased after bitcoin#31785 landed, which completes the interface changes needed for the Template Provider. Dropped the use of waitTipChanged() on startup and added a shutdown check in ThreadSv2ClientHandler().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants