Support Testnet4 Network#2945
Conversation
Pull Request Test Coverage Report for Build 9740234288Details
💛 - Coveralls |
Pull Request Test Coverage Report for Build 9742783239Details
💛 - Coveralls |
Pull Request Test Coverage Report for Build 9742953216Details
💛 - Coveralls |
|
Kixunil
left a comment
There was a problem hiding this comment.
Please squash the commits, some changes are hard to review this way.
I will pay attention to this in squash commit |
Pull Request Test Coverage Report for Build 9747218577Details
💛 - Coveralls |
Pull Request Test Coverage Report for Build 9747894544Details
💛 - Coveralls |
Kixunil
left a comment
There was a problem hiding this comment.
I tried to find the hash problem for a bit but couldn't so far.
Pull Request Test Coverage Report for Build 9754139109Details
💛 - Coveralls |
I've made several attempts so far and I haven't made any progress. Now in doubt some of 'script::Builder::push_slice' internal logic, because Testnet4 provides a new 'genesis_msg' : Trying some hack didn't seem to work either |
|
I don't think it's that. Perhaps it'll be faster if you debug-serialize the transaction and compare it to the one in Core repo. Also important note: while that Core PR is not merged and released this PR cannot be merged. |
I understand the need to wait for progress on |
Ok I try to debug Since I started writing Rust, C++ has almost forgotten, debugging is also a knowledge review :) |
This comment was marked as outdated.
This comment was marked as outdated.
Pull Request Test Coverage Report for Build 9764933554Details
💛 - Coveralls |
After a lot of cross-debug with the Thanks for the tip |
Kixunil
left a comment
There was a problem hiding this comment.
The code looks good now, I'll be happy to ACK once Core is released.
bitcoin/src/network.rs
Outdated
There was a problem hiding this comment.
| "test4" => Testnet(TestnetVersion::V4), | |
| "testnet4" => Testnet(TestnetVersion::V4), |
bitcoind node will return testnet4 and serialization will fail, you should use actual value instead of test4
curl --location --request POST 'http://127.0.0.1:48332' \
--header 'Authorization: Basic ...snip...' \
--header 'Content-Type: application/json' \
--data-raw '{
"method": "getblockchaininfo",
"params": []
}'{
"result": {
"chain": "testnet4",
"blocks": 36409,
"headers": 36409,
"bestblockhash": "0000000000000058e9f909a8d5a86afc8f58d39b661b02f07433d4cae8b6481d",
"difficulty": 44472500.68822794,
"time": 1721977342,
"mediantime": 1721974212,
"verificationprogress": 1,
"initialblockdownload": false,
"chainwork": "000000000000000000000000000000000000000000000048dcdd24a9fc06ef13",
"size_on_disk": 284698607,
"pruned": false,
"warnings": [
"This is a pre-release test build - use at your own risk - do not use for mining or merchant applications"
]
},
"error": null
}
There was a problem hiding this comment.
Insane, so the Core devs decided to make it as inconsistent as possible?
There was a problem hiding this comment.
PR is not yet finalized, but for now chain serialized as testnet4 string
https://github.com/bitcoin/bitcoin/pull/29775/files/aba504759caa13338aa574a7839d078b989fbf6d#diff-254a3b28822b27e42585d1a3f4f41cc8d7712c911b7e85be78a2ee11564f4bd8R19
|
🚨 API BREAKING CHANGE DETECTED To see the changes click details on "Check semver breaks / PR Semver - stable toolchain" job then expand "Run semver checker script" and scroll to the end of the section. |
|
🚨 API BREAKING CHANGE DETECTED To see the changes click details on "Check semver breaks / PR Semver - stable toolchain" job then expand "Run semver checker script" and scroll to the end of the section. |
Thank you very much for your valuable suggestions, I have made the code synchronous changes related to the suggestions |
|
🚨 API BREAKING CHANGE DETECTED To see the changes click details on "Check semver breaks / PR Semver - stable toolchain" job then expand "Run semver checker script" and scroll to the end of the section. |
apoelstra
left a comment
There was a problem hiding this comment.
ACK 1ef2ab9b62c15602338d5cf97d442805ef614bee successfully ran local tests
tcharding
left a comment
There was a problem hiding this comment.
Thanks for sticking with this, with the comment removed: ACK 1ef2ab9b62c15602338d5cf97d442805ef614bee
|
🚨 API BREAKING CHANGE DETECTED To see the changes click details on "Check semver breaks / PR Semver - stable toolchain" job then expand "Run semver checker script" and scroll to the end of the section. |
The corresponding comments have been removed, thank you for your valuable time review |
|
Let's try to backport this. |
Looks like this is going into 0.33? 0.32 and 0.31? How far should we backport? |
|
Just to 0.32 is fine. |
2424b65 feat: rust-bitcoin supports testnet4 (BinChengZhao) afa91a2 Introduce TestnetVersion enum with only TestnetV3 (BinChengZhao) Pull request description: Fixed: rust-bitcoin#2749 1. Adjust `Network` to support `Testnet4`. (Based on rust-bitcoin#2749 (comment) as an implementation idea.) 2. Handle conflicting procedure macros and declaration macros, since the original macros can't handle the new `Network::Testnet(TestnetVersion)` structure properly, and make internal implementations compatible with previous versions (e.g., `testnet` for `Testnet3`, `testnet4` for `Testnet4`, to minimize user-side effects). 3. add `Testnet4` related Params, Block. 4. optimize compatibility test cases. 5. Regarding `fn: genesis_block`, calling `bitcoin_genesis_tx` with any Network type internally gets a reasonable `merkle_root`, but not `Testnet4`. (By comparison, I confirmed that the built-in transaction data provided is correct, and combined with the fixed `merkle_root` of `Testnet4` the correct block hash can be computed, which is not possible if the transaction data is incorrect.) **I'd appreciate it if some developer could guide me on what the problem is, and I'll work on it.** Of course, all these changes are based on rust-bitcoin#2749 , and the consensus of the discussion, if you have any comments, please leave a message, I will actively improve, and promote the support of `Testnet4`. ACKs for top commit: tcharding: ACK 2424b65 apoelstra: ACK 2424b65 successfully ran local tests Tree-SHA512: a501f0a320460afdad2eb12ef6ff315b6357b7779dfe7c7028ea090da567019c947599006a06b3834265db1481129752f015629ef72fea6f862d01323ce9d024
|
Backported in #3453 |

Fixed: #2749
Adjust
Networkto supportTestnet4. (Based on Support for testnet4 #2749 (comment) as an implementation idea.)Handle conflicting procedure macros and declaration macros, since the original macros can't handle the new
Network::Testnet(TestnetVersion)structure properly, and make internal implementations compatible with previous versions (e.g.,testnetforTestnet3,testnet4forTestnet4, to minimize user-side effects).add
Testnet4related Params, Block.optimize compatibility test cases.
Regarding
fn: genesis_block, callingbitcoin_genesis_txwith any Network type internally gets a reasonablemerkle_root, but notTestnet4. (By comparison, I confirmed that the built-in transaction data provided is correct, and combined with the fixedmerkle_rootofTestnet4the correct block hash can be computed, which is not possible if the transaction data is incorrect.) I'd appreciate it if some developer could guide me on what the problem is, and I'll work on it.Of course, all these changes are based on #2749 , and the consensus of the discussion, if you have any comments, please leave a message, I will actively improve, and promote the support of
Testnet4.