Skip to content

Remove TaprootKeyHelper workaround after NBitcoin upgrade to 10.0.4+ #838

@dangershony

Description

@dangershony

Summary

TaprootKeyHelper in src/shared/Angor.Shared/Protocol/Scripts/TaprootKeyHelper.cs is a workaround for a Mono JIT bug that causes TaprootFullPubKey.Create to produce all-zero output keys on Android ARM64 and Blazor WASM.

The bug only triggers when the calling assembly targets net6.0 (NBitcoin 7.0.46). NBitcoin 10.0.4+ ships a net8.0 build that avoids the Mono JIT bug and includes the span-aliasing fix (MetacoSA/NBitcoin#1300).

Task

Once NBitcoin is upgraded to 10.0.4+:

  1. Remove TaprootKeyHelper.cs
  2. Revert all call sites to use PubKey.GetTaprootFullPubKey() and TaprootFullPubKey.Create() directly:
    • InvestmentScriptBuilder.cs
    • SeederScriptTreeBuilder.cs
    • InvestorTransactionActions.cs
    • FounderTransactionActions.cs
    • TaprootScriptBuilder.cs (revert to using treeInfo.OutputPubKey directly)
  3. Remove TaprootOutputKeyTests.cs (or adapt to test NBitcoin directly)
  4. Consider removing TransactionGuard.RejectAllZeroP2trOutputs or keeping as defense-in-depth

Context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions