Skip to content

Conversation

@achow101
Copy link
Member

BaseSignatureChecker has virtual functions which are overridden by its child classes. These virtual functions have a default implementation. However because of the default implementation, bugs can be introduced by failing to implement one of them (e.g. #21151). To avoid this, those functions are made into pure virtual functions so that child classes must implement those functions. There are a few places where a BaseSignatureChecker was being created; these instances have been replaced with the DUMMY_CHECKER.

GenericTransactionSignatureChecker has two constructors, one which takes a PrecomputedTransactionData and one which does not. It can be difficult to understand which one to use, and whether a particular GenericTransactionSignatureChecker has a PrecomputedTransactionData. This has lead to some bugs as well (e.g. #22784). Looking through the codebase, the only place where PrecomputedTransactionData does not need to be provided is in the unit tests. As such, this PR changes GenericTransactionSignatureChecker to have only one constructor which requires PrecomputedTransactionData to be provided. This has a side effect of requiring the same for MutableTransactionSignatureCreator, which also had two constructors, and the one that did not require PrecomputedTransactionData was only used in tests.

@theStack
Copy link
Contributor

theStack commented Sep 1, 2021

Concept ACK

1 similar comment
@glozow
Copy link
Member

glozow commented Sep 1, 2021

Concept ACK

@DrahtBot
Copy link
Contributor

DrahtBot commented Sep 16, 2021

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #26101 (script: create V1SigVersion for functions which should only accept taproot/tapscript by theuni)
  • #24058 (BIP-322 basic support by kallewoof)
  • #13525 (policy: Report reason inputs are nonstandard from AreInputsStandard by Empact)

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.

Copy link
Contributor

@david-bakin david-bakin Jun 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add inline keyword to this variable defn in a header? I know this class doesn't have any data members - in fact all it has is a virtual table pointer. So the fact that it (right now) has internal linkage and is thus duplicated wherever interpreter.h is included doesn't cost much. At all. But, maybe its better to mark it properly.

(Builds properly both without and the inline keyword ...)

@david-bakin
Copy link
Contributor

david-bakin commented Jun 6, 2022

ACK 30d8600 - code reviewed (looks v.g. but left one comment), tested by building (without GUI) and running unit tests only.

I also merged in #25097 which is open and which mocks BaseSignatureChecker in several places and the merge, though it required changes, was straightforward (and I'm prepared to make it there if this PR lands first).

Instead of having BaseSignatureChecker implement default behavior for
its member functions, make those functions completely virtual and force
subclasses to implement all functions. The users of BaseSignatureChecker
are changed to use DummySignatureChecker which have similar
implementations of those functions.
Without a PrecomputedTransactionData, DataFromTransaction will be
missing data and unable to verify some kinds of transactions, thereby
making it unable to extract data from the transaction.
MutableTransactionSignatureCreator now requires a
PrecomputedTransactionData.
GenericTransactionSignatureChecker now requires a
PrecomputedTransactionData.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants