-
Notifications
You must be signed in to change notification settings - Fork 2k
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
BlockchainInterface
as a protocol
#18486
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
arvidn
force-pushed
the
blockchain-interface
branch
from
August 18, 2024 15:36
bf81e0c
to
40da493
Compare
arvidn
added
the
Changed
Required label for PR that categorizes merge commit message as "Changed" for changelog
label
Aug 18, 2024
arvidn
force-pushed
the
blockchain-interface
branch
from
August 18, 2024 16:35
40da493
to
de6f7d2
Compare
Pull Request Test Coverage Report for Build 10468518822Details
💛 - Coveralls |
arvidn
force-pushed
the
blockchain-interface
branch
from
August 19, 2024 00:09
de6f7d2
to
cf9de12
Compare
I'm not sure what to do about the test coverage.
|
altendky
requested changes
Aug 19, 2024
…mplex) test use case of mocking a blockchain object
arvidn
force-pushed
the
blockchain-interface
branch
from
August 20, 2024 08:59
cf9de12
to
ab4470d
Compare
altendky
reviewed
Aug 20, 2024
altendky
approved these changes
Aug 21, 2024
wjblanke
approved these changes
Aug 22, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aok
Draft
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Changed
Required label for PR that categorizes merge commit message as "Changed" for changelog
ready_to_merge
Submitter and reviewers think this is ready
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is best reviewed one commit at a time.
Purpose:
Prepare for adding a new implementation of
BlockchainInterface
by:BlockchainInterface
into aProtocol
and fix-upBlockCache
andWalletBlockchain
. This enablesmypy
to check these classes and fail if they don't implement the protocol.BlockchainInterface
into its own protocol,BlockRecordsProtocol
.BlockchainInterface
subsumes it. Most functions that take aBlockchainInterface
today really only need the, simpler,BlockRecordsProtocol
. So transition some function calls to take it instead.BlockchainMock
(essentially the same asBlockCache
) that implementsBlockchainInterface
and simplifyBlockCache
to only implementBlockRecordsProtocol
. This moves a large amount of code out from production to testing utilities. The main use case of theBlockchainInterface
is in tests where we mock the blockchain class.Current Behavior:
BlockchainInterface
is of questionable value and does not help type checking.BlockchainInterface
don't need most of its complexity.BlockCache
is for the benefit of a few tests.New Behavior:
BlockchainInterface
is a python protocol, which subsumes (a simpler)BlockRecordsProtocol
which most of production code uses.BlockCache
is simple and only supports what the production code requires (implementingBlockRecordInterface
).BlockchainMock
) implements the test functionality that previously was covered byBlockCache
Testing Notes: