-
Notifications
You must be signed in to change notification settings - Fork 32
Implement version specific types #116
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
base: master
Are you sure you want to change the base?
Conversation
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.
Looking good mate. I wouldn't personally bother pruning at the moment. At this stage just checking that the returned data is the correct shape is enough.
I have effected the changes reviewed, please do have a check when you are chanced. |
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.
Getting there man, keep at it.
Changes effected... Thank you so much for all the reviews, I am really learning and understanding the codebase more. |
I just introduced a new style of writing test code in #125. Please follow the same style when you write your new tests. Thanks man! |
Alright, I will check it out... Thank you :). |
def6957
to
392c684
Compare
0f349df
to
a5cc879
Compare
You got a rebase mistake in there mate. In |
In case its useful to you I have this alias which mc
mc: aliased to git grep -l '<<<<' Then I use |
This is going to be hard for me to review because its so big but also I appreciate that it is hard to work on this crate without doing big changesets so I'm happy to review this but there may be a few iterations. |
Some things I found:
let json: VerifyTxOutProof = node.client.verify_tx_out_proof(&proof)?;
let model: Result<mtype::VerifyTxOutProof, _> = json.into_model();
let txids = model.unwrap(); The point to this is to check that all the re-exports were done correctly. Or using let _: PruneBlockchain = node.client.prune_blockchain(target_height); It would probably be best to push up an initial patch that does just one method completely so I can review that and then you could do all the others as a second patch. Sorry I should have said that weeks ago, my bad. There is a way to stage code chunks so you can pull the changes out - let me know if you want more tips on that. |
a5cc879
to
eb52f15
Compare
Appreciate your efforts man, this is not the easiest crate to work on. Holla at me if you have any other questions. |
adeb378
to
6ac7abc
Compare
6ac7abc
to
0a5785c
Compare
Noted, thank you for spotting it out. |
No Problem, I will make all changes necessary as you review! :). |
True, almost forgot changing their status to done. Okayyy, now I see the reason why, for this particular methods, most of them returns I will also push up an initial patch with single method so you can review, before doing the others. I will look it up i.e. stage code chucks, and if there is anything I don't understand, I will definitely ask for clarity. Once again thank you always :). |
f76918a Format code (GideonBature) 99751f6 Implement listbanned method and test (GideonBature) Pull request description: The JSON-RPC method `listbanned` does return a type. We want to test this to catch any changes in behavior in future Core versions. This PR adds a client function that errors if the return value is anything other than the type it returns, along with an integration test that calls this function. Ref: [#116](#116) ACKs for top commit: jamillambert: ACK f76918a tcharding: ACK f76918a Tree-SHA512: e7b5ad83a485ed4ea98fdda2d7eaa52ce13af506f0444e0a0b666331b321125c043fe31545745e2c357c625618f0c034cf2191c74cd1a669217c574f6316d17a
8c14cd0 Implement backupwallet method and test (GideonBature) Pull request description: The JSON-RPC method `backupwallet` does return null. We want to test this to catch any changes in behavior in future Core versions. This PR adds a client function that errors if the return value is anything other than `null`, along with an integration test that calls this function. Ref: [#116](#116) ACKs for top commit: tcharding: ACK 8c14cd0 Tree-SHA512: ee68c57b2e8be5c10408b7e21f05d477429d20bcd6a6e4758a933f6607f277f6d4cca825885cca1780524761ffe89c2ad64866bee76d5b934f27807efc0f2626
e513cbe Format code changes (GideonBature) 2d469bf Implement encryptwallet method and test (GideonBature) Pull request description: The JSON-RPC method `encryptwallet` does return a type. We want to test this to catch any changes in behavior in future Core versions. This PR adds a client function that errors if the return value is anything other than the type it returns, along with an integration test that calls this function. Ref: [#116](#116) ACKs for top commit: jamillambert: ACK e513cbe tcharding: ACK e513cbe Tree-SHA512: 276126a1b80ba96aa5b1c4ef48e47288188a0e2c94e323b190a498feb322e9d6157d86175aa60bb133fa96feeac8e96ba042f7368bd0e63cf73d6dcebc6a0d78
859ec74 Implement importaddress method and test (GideonBature) Pull request description: The JSON-RPC method `importaddress` does return null. We want to test this to catch any changes in behavior in future Core versions. This PR adds a client function that errors if the return value is anything other than `null`, along with an integration test that calls this function. Ref: [#116](#116) ACKs for top commit: jamillambert: ACK 859ec74 tcharding: ACK 859ec74 Tree-SHA512: 1a4c4eceba4f7e7adb2928b50ea7ce42116388522874df2eb4179b7330370376f8f9db0b91b6f71633258a0ea5a95292221a0f2d6e162b2a44dd14fff72b9b10
4eef869 Format code (GideonBature) e6d00b9 Implement importprunedfunds and test (GideonBature) Pull request description: The JSON-RPC method `importprunedfunds` does not return anything. We want to test this to catch any changes in behavior in future Core versions. This PR adds a client function that errors if the return value is anything other than `null`, along with an integration test that calls this function. Ref: [#116](#116) ACKs for top commit: tcharding: ACK 4eef869 Tree-SHA512: a589ac5cefd2510546e1621c268d10d223727d76c4dce05689de4f5a894bd653857a8ea537f5b345fdfa990479db05eb400aa2d91c1dc5ec8c37e7b0deddc657
1430723 Implement importpubkey method and test (GideonBature) Pull request description: The JSON-RPC method `importpubkey` does not return anything. We want to test this to catch any changes in behavior in future Core versions. This PR adds a client function that errors if the return value is anything other than `null`, along with an integration test that calls this function. Ref: [#116](#116) ACKs for top commit: tcharding: ACK 1430723 Tree-SHA512: 06ed71c3636a386d7b90750fdea74b846a8514b68066bd44d5b71c7300a20e023729ad944871da57d6f3bf33cabb8cdebf7359ac1c1acc9a00a7f938be168b54
ec24420 Format code (GideonBature) 4667b26 Implement importmulti method and test (GideonBature) Pull request description: The JSON-RPC method `importmulti` does return a type. We want to test this to catch any changes in behavior in future Core versions. This PR adds a client function that errors if the return value is anything other than the type it returns, along with an integration test that calls this function. Ref: [#116](#116) ACKs for top commit: tcharding: ACK ec24420 Tree-SHA512: 97294e566586bd51e05042be06ca169272689b131510a239682dc6bade95eb87acbf9d86553cba1e06e3554389402b0525bd925eb5ee2c5ceb71d9a6aa4208eb
c62b4d2 Implement importwallet method and test (GideonBature) Pull request description: The JSON-RPC method `importwallet` does not return anything. We want to test this to catch any changes in behavior in future Core versions. This PR adds a client function that errors if the return value is anything other than `null`, along with an integration test that calls this function. Ref: [#116](#116) ACKs for top commit: tcharding: ACK c62b4d2 Tree-SHA512: efb9e543ec9796badf0d781e841cb54025f975425f9bc7e6183b51e3de06cd78fdc23e6f98ddcd17d6f8e4a6a36f2dcbb5f5ed1da9b28e68713c4b5076a7c509
f42ff9b Implement keypoolrefill method and test (GideonBature) Pull request description: The JSON-RPC method `keypoolrefill` does not return anything. We want to test this to catch any changes in behavior in future Core versions. This PR adds a client function that errors if the return value is anything other than `null`, along with an integration test that calls this function. Ref: [#116](#116) ACKs for top commit: tcharding: ACK f42ff9b Tree-SHA512: f1b632b718e36836092b25814a9073e0acf9ba2d34db72a6541c3bc4407e34b81673d9bbb180f067ff04421fa3f2ada3bd4d2fcea78363d9650155b80392ec9e
045b25e Format code (GideonBature) 98ea4be Implement lockunspent method and test (GideonBature) Pull request description: The JSON-RPC method `lockunspent` does return a type. We want to test this to catch any changes in behavior in future Core versions. This PR adds a client function that errors if the return value is anything other than the type it returns, along with an integration test that calls this function. Ref: [#116](#116) ACKs for top commit: tcharding: ACK 045b25e Tree-SHA512: 2a927892fbde9f2a332578afe26439843923ff5930439a6eb4533845e8d7d9235bba3d02ecc60df3b428f63a7ecba177ee53fecb283e66973e13d4182acad0d8
1fa1026 Implement removeprunedfunds method and test (GideonBature) Pull request description: The JSON-RPC method `removeprunedfunds` does not return anything. We want to test this to catch any changes in behavior in future Core versions. This PR adds a client function that errors if the return value is anything other than `null`, along with an integration test that calls this function. Ref: [#116](#116) ACKs for top commit: tcharding: ACK 1fa1026 Tree-SHA512: 310b0717bd27e4ee908729b1d49efd3b0a06cd5d59d1e62d117122cb689577557460824d77c8549961feb5552155b19bb89eaccd540c2552458c731817008de3
cce7153 Implement sethdseed method and test (GideonBature) Pull request description: The JSON-RPC method `sethdseed` does not return anything. We want to test this to catch any changes in behavior in future Core versions. This PR adds a client function that errors if the return value is anything other than `null`, along with an integration test that calls this function. Ref: [#116](#116) ACKs for top commit: tcharding: ACK cce7153 Tree-SHA512: 73fdb4b5df21a7318b91262b18f70f90366b3269b5d1ad3352aa82a43983bd47b4af3dc281ddfcdc2627c38b8399a6816169b5fc72205f78239401f17c2e7824
52e1b53 Format code (GideonBature) 8a72e1f Implement settxfee method and test (GideonBature) Pull request description: The JSON-RPC method `settxfee` does return a type. We want to test this to catch any changes in behavior in future Core versions. This PR adds a client function that errors if the return value is anything other than the type it returns, along with an integration test that calls this function. Ref: [#116](#116) ACKs for top commit: jamillambert: ACK 52e1b53 tcharding: ACK 52e1b53 Tree-SHA512: 17dfeaa0ddfeb5aaa5007759d6f025c142418026e943312c4fdfddd9a7f7105adc34951e50ee861eb9038db091f6c3760432f05cdaa3a2d7c3c5aed193d9c9ae
22acb26 Implement walletlock method and test (GideonBature) Pull request description: The JSON-RPC method `walletlock` does not return anything. We want to test this to catch any changes in behavior in future Core versions. This PR adds a client function that errors if the return value is anything other than `null`, along with an integration test that calls this function. Ref: [#116](#116) ACKs for top commit: jamillambert: ACK 22acb26 tcharding: ACK 22acb26 Tree-SHA512: 6c339d362b49b03392bfb5a122cabf9220579cf88a7278f003784859123915d5e0e741364cc2c769a48350ac32e59a297c2c7c1af999ffa1c7bc2b586c199453
86b06c5 Implement walletpassphrase method and test (GideonBature) Pull request description: The JSON-RPC method `walletpassphrase` does not return anything. We want to test this to catch any changes in behavior in future Core versions. This PR adds a client function that errors if the return value is anything other than `null`, along with an integration test that calls this function. Ref: [#116](#116) ACKs for top commit: jamillambert: ACK 86b06c5 tcharding: ACK 86b06c5 Tree-SHA512: 54a44b8084ec3a5395e1cbf175a56aaa143b9ff97396b491159ee703497ac956ff8b8726d400cecf472d0ff87f0cc31365529856e6b9e24ad66e3a3c514bd524
Implement Version-Specific Types for Status
omitted
This PR addresses issue #115 by implementing the methods with status of
'omitted'
in methods with version-specific types. Previously,'omitted'
was used in cases where return types were standard or seemingly inconsequential (e.g.,null
, standard library types). However, this approach introduced a risk: if the return type of such methods changes in future Bitcoin Core versions, we would not catch it.To fix this, this PR:
Method::new_no_model
in corresponding methods.This improves type safety, clarity, and future-proofing of the client interface.
Summary of Work Done
🚀 Blockchain Methods
Tested with:
cargo test --features=28_0 --test blockchain
🌐 Network Methods
Tested with:
cargo test --features=28_0 --test network
💰 Wallet Methods
Tested with:
cargo test --features=28_0 --test wallet
✅ Ready for review
Closes #115