Ephemeral Anchors #29001

pull instagibbs wants to merge 30 commits into bitcoin:master from instagibbs:2023-12-ephemeral-anchors changing 53 files +2539 −164
  1. instagibbs commented at 4:30 pm on December 5, 2023: member

    Depends on #28948 and #28984

    Replaces #26403 to refresh the conversation.

    BIP text here: https://github.com/instagibbs/bips/blob/ephemeral_anchor/bip-ephemeralanchors.mediawiki

    Example usage: https://github.com/instagibbs/bolts/commits/zero_fee_commitment https://github.com/instagibbs/lightning/commits/commit_zero_fees

    TODO:

    1. figure out what precisely to do in a reorg when ephemeral transactions are trying to enter the mempool(and write a test)
    2. restrict ephemeral anchor value to 0 (future relaxation possible with more work/motivation)
    3. rebased on top of master, add in trim ephemeral anchor tx functionality when they are at 0-fee package feerate
  2. [mempool] evict everything paying 0 fees in TrimToSize()
    At this point it's not expected that there are any such transactions,
    except from reorgs.
    bb979f4c76
  3. [refactor] change Workspace::m_conflicts and adjacent funcs/structs to use Txid
    It's preferable to use type-safe transaction identifiers to avoid
    confusing txid and wtxid. The next commit will add a reference to this
    set; we use this opportunity to change it to Txid ahead of time instead
    of adding new uses of uint256.
    d72ba3d535
  4. [policy] policy rules for nVersion=3 b39cdfbd4c
  5. [validation] allow V3 transactions under certain conditions 4557e54c90
  6. [policy] allow individual v3 txns to be below min relay feerate
    As long as they are otherwise paid for, i.e. through package CPFP.
    If a v3 transaction loses its sponsor, we can evict them with no trouble
    because it will not have other descendants or ancestors to make the
    feerate assessment more complicated.
    95a99fea6d
  7. [test framework] parameterize version in create_self_transfer 104b3d39f4
  8. [functional test] v3 transaction submission 23777e19ac
  9. [doc] v3 policy 951db952b5
  10. [fuzz] v3 transactions 4fce51680c
  11. [doc] cpfp carveout is excluded in packages
    The behavior is not new, but this rule exits earlier than before.
    Previously, a carve out could have been granted in PreChecks() but then
    nullified in PackageMempoolChecks() when CheckPackageLimits() is called
    with the default limits.
    3824508d59
  12. [refactor] make some members MemPoolAccept-wide
    No change in behavior.
    
    For single transaction acceptance, this is a simple refactor:
    Workspace::m_all_conflicting         -> MemPoolAccept::m_all_conflicts
    Workspace::m_conflicting_fees        -> MemPoolAccept::m_conflicting_fees
    Workspace::m_conflicting_size        -> MemPoolAccept::m_conflicting_size
    Workspace::m_replaced_transactions   -> MemPoolAccept::m_replaced_transactions
    
    And local variables m_total_vsize and m_total_modified_fees are now
    MemPoolAccept members so they can be accessed from PackageMempoolChecks.
    
    We want these to be package-wide variables because
    - Transactions could conflict with the same tx (just not the same
    prevout), or their conflicts could share descendants.
    - We want to compare conflicts with the package fee rather than
    individual transaction fee.
    
    We reset these MemPoolAccept-wide fields for each subpackage
    evaluation to not cause state leaking, similar to temporary
    coins.
    2eb1cb681e
  13. [policy] attempt to check whether replacement is more incentive compatible
    Avoid accepting replacements that are not more incentive compatible to
    mine.  For now, as a somewhat conservative estimate, require that the minimum
    between the transaction's individual feerate and ancestor feerate is
    higher than the individual feerates of directly conflicting transactions
    and the ancestor feerates of all original transactions.
    
    Note that a package/transaction's ancestor feerate is not perfectly
    representative of its incentive compatibility; it may overestimate (some
    subset of the ancestors could be included by itself if it has other
    high-feerate descendants or are themselves higher feerate than this
    package/transaction).
    
    Co-authored-by: Suhas Daftuar <sdaftuar@chaincode.com>
    a625e2fbce
  14. [refactor] rename entries to be more descriptive 0f1ef3d2f4
  15. [unit test] for CheckAncestorScores 1447ee0ec2
  16. [packages/policy] implement package RBF for replacement clusters of size two 9aa975e5f6
  17. [test util] CreateValidMempoolTransaction version parameter, always signal bip125 f1e1df0643
  18. [test] package rbf c15ae6d1e6
  19. DrahtBot commented at 4:30 pm on December 5, 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:

    • #29093 (NOMERGE UFG Default permitbaremultisig=0 by ajtowns)
    • #29088 (tests: Don’t depend on value of DEFAULT_PERMIT_BAREMULTISIG by ajtowns)
    • #29086 (refactor: Simply include CTxMemPool::Options in CTxMemPool directly rather than duplicating definition by luke-jr)
    • #29050 (Add OP_TXHASH and OP_CHECKTXHASHVERIFY opcodes by stevenroose)
    • #28984 (Cluster size 2 package rbf by instagibbs)
    • #28972 (test: Add and use option for tx-version in MiniWallet methods by maflcko)
    • #28960 (kernel: Remove dependency on CScheduler by TheCharlatan)
    • #28950 (RPC: Add maxfeerate and maxburnamount args to submitpackage by instagibbs)
    • #28948 (v3 transaction policy for anti-pinning by glozow)
    • #28886 (refactor: Replace sets of txiter with CTxMemPoolEntryRefs by TheCharlatan)
    • #28676 ([WIP] Cluster mempool implementation by sdaftuar)
    • #27432 (contrib: add tool to convert compact-serialized UTXO set to SQLite database by theStack)
    • #26840 (refactor: importpubkey, importprivkey, importaddress, importmulti, and importdescriptors rpc by KolbyML)
    • #26593 (tracing: Only prepare tracepoint arguments when actually tracing by 0xB10C)

    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.

  20. instagibbs force-pushed on Dec 5, 2023
  21. DrahtBot added the label CI failed on Dec 5, 2023
  22. instagibbs force-pushed on Dec 5, 2023
  23. Add OP_TRUE <0x4e73> as a standard output type
    This will be used in following commits
    as the flag for ephemeral anchors, allowing
    dust values, but also requiring
    the output to be spend in the same relay package.
    4f484d6ac1
  24. make ephemeral anchor spend standard c24a51c015
  25. Disallow 3rd party wtxid malleability of anchor spend 7d87c6692a
  26. Allow dust anchor outputs
    Anchor outputs are not yet required
    to be spent in same mempool package.
    053d56edb6
  27. Allow one ephemeral anchor per transaction 19c54fab51
  28. Enforce constraints for ephemeral anchor transactions 68271cfd3b
  29. Require ephemeral anchors to be spent in mempool atomically
    Either in the same relay package, or by transactions RBFing
    the CPFP.
    6fc1b650df
  30. Add EPHEMERAL_ANCHOR_SCRIPT to test utils 2f2f08f9e8
  31. Add anchor argument to transaction creation rpcs f5274434d6
  32. Add functional tests for ephemeral anchors f1caa7ab8f
  33. notes about CheckEphemeralSpends via in mempool ancestors 4890cf7e67
  34. Allow bypassing CheckValidEphemeralTx during reorg 50347d3fb5
  35. instagibbs force-pushed on Dec 5, 2023
  36. DrahtBot removed the label CI failed on Dec 5, 2023
  37. fuzz: Add ephemeral anchor coverage to tx_package_eval target 9cba1a95f8
  38. ariard commented at 7:02 pm on December 10, 2023: member

    BIP text here: https://github.com/instagibbs/bips/blob/ephemeral_anchor/bip-ephemeralanchors.mediawiki

    “Be 0-fee”

    This is uncertain to me how this rule works with trimmed HTLCs on LN commitment transactions making their fees non-zero, even assuming anchor outputs where second-stage txn are signed with 0-feerate.

    Beyond, I think it should add an information section at destination of use-cases developers discouraging the usage of anyone-can-spend ephemeral anchor. Otherwise a time-sensitive package can be tampered by third-parties entering into replacement cycling games, without being a direct off-chain counterparty to the target transaction traffic.

  39. instagibbs commented at 8:01 pm on December 10, 2023: member
    @ariard I’d rather talk downstream details over here https://github.com/bitcoin/bips/pull/1524
  40. DrahtBot commented at 10:58 pm on December 15, 2023: contributor

    🐙 This pull request conflicts with the target branch and needs rebase.

  41. DrahtBot added the label Needs rebase on Dec 15, 2023
  42. luke-jr commented at 7:01 pm on December 16, 2023: member

    BIP text here: https://github.com/instagibbs/bips/blob/ephemeral_anchor/bip-ephemeralanchors.mediawiki

    Node policy is not a subject matter for standardization in itself. It’s the transaction format that the BIP (if there is one) should focus on, not speculative behaviour of individual nodes.

  43. glozow added the label TX fees and policy on Dec 18, 2023
  44. ariard commented at 0:44 am on December 21, 2023: member

    @ariard I’d rather talk downstream details over here https://github.com/bitcoin/bips/pull/1524

    Thanks good to me - Answered strong conceptual issues there.

  45. da2ce7 commented at 6:14 am on December 26, 2023: none

    @luke-jr

    BIP text here: https://github.com/instagibbs/bips/blob/ephemeral_anchor/bip-ephemeralanchors.mediawiki

    Node policy is not a subject matter for standardization in itself. It’s the transaction format that the BIP (if there is one) should focus on, not speculative behaviour of individual nodes.

    This Proposed BIP brings a set of concepts that allows the community to communicate using a coherent language regarding what “Ephemeral Anchors” are. By defining this term in context of how it could work, the community can reason about them in a clear and coherent manner, (no matter if they individuality choose to use them in their node policy or not).

    It is my opinion that such a BIP proposal is perfectly applicable and beneficial toward the community communication goals:

    An Informational BIP describes a Bitcoin design issue, or provides general guidelines or information to the Bitcoin community, but does not propose a new feature. […]

  46. instagibbs commented at 6:14 pm on March 28, 2024: member

    I have another branch I’m going to likely pursue once 1p1c relay is further along: https://github.com/instagibbs/bitcoin/commit/fe67ffda0f74c1f9ef95b8b75f030828adec8da3

    With v3 + sibling eviction, it makes sense to me to first open up the feature with current supported scriptpubkeys for when the output is considered dust.

    This allows people to pick anyone can spend or shared keyed anchors. It also means any outputs can be dust, as long as they get spent.

    Future updates can include:

    1. OP_1 <0xfees> style scripts as in the current PR.
    2. relaxation from V3: I suspect the cluster mempool interface will make the logic much simpler to extending it to be arbitrary tx topologies. This could allow batched CPFP and more.
  47. instagibbs commented at 5:35 pm on June 6, 2024: member
  48. instagibbs closed this on Jun 6, 2024

  49. bitcoin deleted a comment on Jul 1, 2024
  50. bitcoin deleted a comment on Jul 1, 2024
  51. bitcoin deleted a comment on Jul 1, 2024
  52. bitcoin locked this on Jul 1, 2024

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-11-21 09:12 UTC

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