-
Notifications
You must be signed in to change notification settings - Fork 31
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 :). |
359ac38 Implement disconnectnode method and test (GideonBature) Pull request description: Going by the conversations with tcharding for PR [#116 ](#116) on implementing one method at a time for easier review: This is the disconnectnode method which is a specific type that returns a (json null). Once this is approved, I’ll proceed with the next one. ACKs for top commit: tcharding: ACK 359ac38 Tree-SHA512: 3b16431e732e81edea1f290cf6436ae5ad0e72a591546b09e69eb47092c95ccef5e07be8908f20d32fb87a77cf623caf07eee0e96b96bc2fab7240af23e4286a
2408e45 Implement getconnectioncount method and test (GideonBature) Pull request description: The JSON-RPC method `getconnectioncount` does return a numeric. 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 `numeric`, along with an integration test that calls this function. Ref: [#116](#116) ACKs for top commit: tcharding: ACK 2408e45 Tree-SHA512: 8fadbbe57fe567daebe150cf76cce96d0693ee1763bd8bbfafe4b736751da8dc42b2681aeccf7eb8fbc03083a2ecb131ee59ffc24608ea20ec3693b944477147
e266b9f Update 'returns (std)' to 'version' for version methods (GideonBature) Pull request description: This PR updates `returns (std)` to `version` for all methods that have been implemented to return a type which wraps a standard value. Ref: #116 ACKs for top commit: tcharding: ACK e266b9f Tree-SHA512: 1162ac34fbffe51070d799cfc70fd9d6442817a8f3f916ea852c33b9eaa760e65422d7886382409ce8e087c88d24637a2fbc603005ac7d70b0954438e33b5bc7
8b1f578 Implement ping method and test (GideonBature) Pull request description: The JSON-RPC method `ping` 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 8b1f578 Tree-SHA512: c2626a22f96179e22154a8830a53d6b2568c959515244445dc6481572bde8f45ea9eec16f82bafa19ad8c31814c49d6ccf2e3d0a1d279191548e420d3d15d55d
e071183 Format code changes (GideonBature) 9753048 Implement setnetworkactive method and test (GideonBature) Pull request description: The JSON-RPC method `setnetworkactive` does return a boolean. 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 `boolean`, along with an integration test that calls this function. Ref: [#116](#116) ACKs for top commit: tcharding: ACK e071183 Tree-SHA512: 8a1a4f82da9cceeb2b7cb525893337fbe76595a5377887811831a4ee43962fe47b7c3c58e19ee545ad19a9e39ea08a5a1534fa3f9a61af52bcc695ce4981a388
5d6b977 Implement abandontransaction and test (GideonBature) Pull request description: The JSON-RPC method `abandontransaction` 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 5d6b977 tcharding: ACK 5d6b977 Tree-SHA512: 4801603b099f0fd04fd234dced71318e619cb201a22cb801140010cc88ce4ed316e372718c8c475b52e4caed8ce7cf8676b5197838953ee35e6c5482920b49ca
4b4e084 Implement importprivkey and test (GideonBature) Pull request description: The JSON-RPC method `importprivkey` 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 4b4e084 Tree-SHA512: 9a506b8b250d55099027241c53b2fa169f73cb988e92667c7dcb10ab30f63c14462b6501db40b595129be39a8f1e9d07581e53dcea02154f2249924c013c981c
9a24cfd Format code (GideonBature) 5decd11 Implement abortrescan method and test (GideonBature) Pull request description: The JSON-RPC method `abortrescan` 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 9a24cfd tcharding: ACK 9a24cfd Tree-SHA512: 1c5c58fc482691e7354d5ea61398b7bf37bae3b16578305d70ac8eb57c222c57102d12da7ab340b59faa49f2e1977259cadaa519917137b646bb0a64f03df54c
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
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