signet: fixing mining for OP_TRUE challenge #29032

pull Sjors wants to merge 1 commits into bitcoin:master from Sjors:2023/12/signet-no-challenge changing 3 files +53 −24
  1. Sjors commented at 2:46 pm on December 8, 2023: member

    BIP325 mentions the following rule:

    In the special case where an empty solution is valid (ie scriptSig and scriptWitness are both empty) this additional commitment can optionally be left out. This special case is to allow non-signet-aware block generation code to be used to test a custom signet chain where the challenge is trivially true.

    Such a signet can be created using e.g. -signetchallenge=51 (OP_TRUE). However contrib/signet/miner can’t handle this, as it fails with PSBT signing failed.

    This PR improves the miner by skipping the PSBT for known trivial scripts (just OP_TRUE for now). This also avoids appending the 4 byte signet header to the witness commitment, as allowed by the above rule.

  2. DrahtBot commented at 2:46 pm on December 8, 2023: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Code Coverage

    For detailed information about the code coverage, see the test coverage report.

    Reviews

    See the guideline for information on the review process. A summary of reviews will appear here.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #30203 (Enhance signet chain configuration in bitcoin.conf by BrandonOdiwuor)
    • #30130 (contrib/signet/miner: increase miner search space by edilmedeiros)
    • #29838 (Feature: Use different datadirs for different signets by BrandonOdiwuor)
    • #28417 (contrib/signet/miner updates by ajtowns)

    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.

  3. Sjors commented at 2:50 pm on December 8, 2023: member

    My own goal with this is to test Stratum v2 stuff, e.g. #28983. It’s nice to have a test network with difficulty adjustment. Regular testnet difficulty is too high for my humble S9 (let alone a CPU miner) to win blocks.

    Using real mining equipment as opposed to a CPU miner is useful, because of the many quirks real devices have (e.g. version bit grinding). Afaik there’s no good emulator.

    Although I won’t actually need this mining script to test local pool software, I patched it anyway to serve as a reference to compare the pool software against.

    cc @ajtowns, @kallewoof

  4. kallewoof commented at 12:36 pm on December 11, 2023: member
    This looks reasonable to me, although I’m not super familiar with all the code being changed.
  5. fanquake requested review from ajtowns on Jan 15, 2024
  6. DrahtBot added the label CI failed on Jan 16, 2024
  7. signet: miner skips PSBT step for OP_TRUE 3488f3e4c2
  8. Sjors force-pushed on Feb 13, 2024
  9. DrahtBot removed the label CI failed on Feb 13, 2024
  10. edilmedeiros commented at 3:48 am on May 16, 2024: contributor

    Concept ACK

    Code looks good, I’m still to test it.


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-07-01 13:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me