Skip to content
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

Getblocktemplate broken in v 0.1.10 #123

Open
laakie opened this issue Apr 20, 2023 · 24 comments
Open

Getblocktemplate broken in v 0.1.10 #123

laakie opened this issue Apr 20, 2023 · 24 comments

Comments

@laakie
Copy link

laakie commented Apr 20, 2023

./BGL-cli getblocktemplate '{"rules": ["segwit"]}'
error code: -1
error message:
basic_string::_M_construct null not valid

Compiled from source ( After fixing some configure errors.... )

@naftalimurgor
Copy link
Contributor

What Os version are you on? I'd like to:

  • Reproduce this
  • Debug
  • Submit bug fix and a corresponding unit test

@naftalimurgor
Copy link
Contributor

still experiencing this issue?

Got it building on Ubuntu 22.04 (gcc 11.3.0)

@laakie
Copy link
Author

laakie commented Jun 30, 2023

Not able to build most if the versions from source.
They all have a ton of errors.
Running 0.1.8, it's the only version that I managed to compile after a few tweaks

@naftalimurgor
Copy link
Contributor

It would be great to provide:

  • clang or gcc?
  • What versions?
  • OS version?
    Thanks

@laakie
Copy link
Author

laakie commented Jun 30, 2023

All other versions then 0.1.8
Ubuntu 20.04, and 22.04
Gcc 9,10,11

@janus
Copy link
Collaborator

janus commented Jun 30, 2023

All other versions then 0.1.8 Ubuntu 20.04, and 22.04 Gcc 9,10,11

I look into this issue. Just give me some time.

@naftalimurgor
Copy link
Contributor

All other versions then 0.1.8
Ubuntu 20.04, and 22.04
Gcc 9,10,11

I'll check with those versions and give you feedback soon.

@janus
Copy link
Collaborator

janus commented Jul 8, 2023

Not able to build most if the versions from source. They all have a ton of errors. Running 0.1.8, it's the only version that I managed to compile after a few tweaks

They all have a ton of errors.
Please what is the configuration that you used? I would like to fix the errors.

@gitcoindev
Copy link
Contributor

Hi @janus , @naftalimurgor , @van-orton I am able to reproduce this bug.

I finally discovered build errors as well - 0.1.10 tag is broken and the build was fixed at later commit in release-0.1.10 branch.

Master branch getblocktemplate works fine, both gcc and clang:

'{"rules": ["segwit"]}'
{
  "capabilities": [
    "proposal"
  ],
  "version": 536870912,
  "rules": [
    "csv",
    "!segwit",
    "taproot"
  ],
  "vbavailable": {
  },
  "vbrequired": 0,
  "previousblockhash": "2e14eaec9745ec9690602feddf650eb6e436d32a3ae8453cf6a90ef1d53a6c42",
  "transactions": [
  ],
  "coinbaseaux": {
  },
  "coinbasevalue": 20000000000,
  "longpollid": "2e14eaec9745ec9690602feddf650eb6e436d32a3ae8453cf6a90ef1d53a6c422",
  "target": "dfff000000000000000000000000000000000000000000000000000000000000",
  "mintime": 1585958401,
  "mutable": [
    "time",
    "transactions",
    "prevblock"
  ],
  "noncerange": "00000000ffffffff",
  "sigoplimit": 80000,
  "sizelimit": 400000,
  "weightlimit": 400000,
  "curtime": 1690895708,
  "bits": "2100dfff",
  "height": 1,
  "default_witness_commitment": "6a24aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf9"
}

whereas 0.1.10 release build returns the following error:

error code: -1
error message:
basic_string::_M_construct null not valid

I went through a quite entertaining debugging session with GDB and was able to find the root cause and the commit that introduced the change. VersionBitsDeploymentInfo contains null value for the taproot.

Thread 22 "b-httpworker.3" hit Breakpoint 6, gbt_vb_name (pos=Consensus::DEPLOYMENT_TAPROOT) at rpc/mining.cpp:495
495	    const struct VBDeploymentInfo& vbinfo = VersionBitsDeploymentInfo[pos];
(gdb) p VersionBitsDeploymentInfo
$9 = {{name = 0x55656fc0a2ac "testdummy", gbt_force = true}, {name = 0x55656fc0a2b6 "taproot", gbt_force = true}, {name = 0x0, gbt_force = false}}
(gdb) 

I already have a fix that works for me locally, I will submit a PR asap.

@gitcoindev
Copy link
Contributor

PR with the fix opened #128

@janus
Copy link
Collaborator

janus commented Aug 1, 2023

Hi @janus , @naftalimurgor , @van-orton I am able to reproduce this bug.

I finally discovered build errors as well - 0.1.10 tag is broken and the build was fixed at later commit in release-0.1.10 branch.

Master branch getblocktemplate works fine, both gcc and clang:

'{"rules": ["segwit"]}'
{
  "capabilities": [
    "proposal"
  ],
  "version": 536870912,
  "rules": [
    "csv",
    "!segwit",
    "taproot"
  ],
  "vbavailable": {
  },
  "vbrequired": 0,
  "previousblockhash": "2e14eaec9745ec9690602feddf650eb6e436d32a3ae8453cf6a90ef1d53a6c42",
  "transactions": [
  ],
  "coinbaseaux": {
  },
  "coinbasevalue": 20000000000,
  "longpollid": "2e14eaec9745ec9690602feddf650eb6e436d32a3ae8453cf6a90ef1d53a6c422",
  "target": "dfff000000000000000000000000000000000000000000000000000000000000",
  "mintime": 1585958401,
  "mutable": [
    "time",
    "transactions",
    "prevblock"
  ],
  "noncerange": "00000000ffffffff",
  "sigoplimit": 80000,
  "sizelimit": 400000,
  "weightlimit": 400000,
  "curtime": 1690895708,
  "bits": "2100dfff",
  "height": 1,
  "default_witness_commitment": "6a24aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf9"
}

whereas 0.1.10 release build returns the following error:

error code: -1
error message:
basic_string::_M_construct null not valid

I went through a quite entertaining debugging session with GDB and was able to find the root cause and the commit that introduced the change. VersionBitsDeploymentInfo contains null value for the taproot.

Thread 22 "b-httpworker.3" hit Breakpoint 6, gbt_vb_name (pos=Consensus::DEPLOYMENT_TAPROOT) at rpc/mining.cpp:495
495	    const struct VBDeploymentInfo& vbinfo = VersionBitsDeploymentInfo[pos];
(gdb) p VersionBitsDeploymentInfo
$9 = {{name = 0x55656fc0a2ac "testdummy", gbt_force = true}, {name = 0x55656fc0a2b6 "taproot", gbt_force = true}, {name = 0x0, gbt_force = false}}
(gdb) 

I already have a fix that works for me locally, I will submit a PR asap.

Great job!

@gitcoindev
Copy link
Contributor

Hi! I see my five pull requests have stalled for the last weeks. I still have some resources to help solve any issue that you think would be helpful to push the project forward. Is there anything to work on or would you like me to rework anything @janus @naftalimurgor @van-orton @wu-emma ?

@wu-emma
Copy link
Collaborator

wu-emma commented Aug 14, 2023

@gitcoindev thank you for the participation! Personally I think we can check BIPs that are not implemented in BTC and check if we can add ideas to BGL that we find interesting.
@janus @van-orton guys, could you please check if we can merge PRs and other ideas for activity? Thanks!

@janus
Copy link
Collaborator

janus commented Aug 14, 2023

@gitcoindev thank you for the participation! Personally I think we can check BIPs that are not implemented in BTC and check if we can add ideas to BGL that we find interesting. @janus @van-orton guys, could you please check if we can merge PRs and other ideas for activity? Thanks!

@wu-emma I will merge the PRs. I will also cherry-pick Bitcoin repo to July 31st. I would be discussing with @van-orton.

@janus
Copy link
Collaborator

janus commented Aug 15, 2023

Hi! I see my five pull requests have stalled for the last weeks. I still have some resources to help solve any issue that you think would be helpful to push the project forward. Is there anything to work on or would you like me to rework anything @janus @naftalimurgor @van-orton @wu-emma ?

Your last RP is great. It opened by eyes to the issue however the root of the issue is index out of range. I noticed that there was some left over codes that caused that. I have updated https://github.com/BitgesellOfficial/bitgesell/tree/release-0.1.10. I commented in one of your PRs, however, you have yet to respond. I will go through the rest of the PRs.

@laakie Please use this source, https://github.com/BitgesellOfficial/bitgesell/tree/release-0.1.10. And let me know the outcome.

@gitcoindev
Copy link
Contributor

gitcoindev commented Aug 16, 2023

Hi @janus yes the root of the issue was index out of range. If you meant your comment in #127 we can close the pr now after the recent update, I guess you will fix it altogether when syncing to July 31st.

@janus
Copy link
Collaborator

janus commented Aug 16, 2023

Hi @janus yes the root of the issue was index out of range. If you meant your comment in #127 we can close the pr now after the recent update, I guess you will fix it altogether when syncing to July 31st.

@gitcoindev Who have not responded to review comments.

@gitcoindev
Copy link
Contributor

Hi @janus yes the root of the issue was index out of range. If you meant your comment in #127 we can close the pr now after the recent update, I guess you will fix it altogether when syncing to July 31st.

@gitcoindev Who have not responded to review comments.

hi @janus I must have missed that one but cannot find it, is it possible for you to paste the link to that review comment?

@laakie
Copy link
Author

laakie commented Mar 22, 2024

Same problem occurs in v0.1.11
Reverting back to v0.1.8 for mining
https://github.com/BitgesellOfficial/bitgesell/releases/tag/0.1.11

./BGL-cli getblocktemplate '{"rules": ["segwit"]}'
error code: -1
error message:
basic_string::_M_construct null not valid

@janus
Copy link
Collaborator

janus commented Mar 24, 2024

Same problem occurs in v0.1.11 Reverting back to v0.1.8 for mining https://github.com/BitgesellOfficial/bitgesell/releases/tag/0.1.11

./BGL-cli getblocktemplate '{"rules": ["segwit"]}' error code: -1 error message: basic_string::_M_construct null not valid

I will get back to you.

@janus
Copy link
Collaborator

janus commented Mar 28, 2024

@laakie
I got the below using branch bitcoinsync31July2023 which should be same as the https://github.com/BitgesellOfficial/bitgesell/releases/tag/0.1.11. I use both BGL-cli and BGLd from the branch. I will compile v0.1.11 and try same.

{
  "capabilities": [
    "proposal"
  ],
  "version": 536870912,
  "rules": [
    "csv",
    "!segwit",
    "taproot_discarded",
    "taproot"
  ],
  "vbavailable": {
  },
  "vbrequired": 0,
  "previousblockhash": "000000000000068812b074c0f9a17296305f2fdd842f3e6afd6e2a157f9c6185",
  "transactions": [
  ],
  "coinbaseaux": {
  },
  "coinbasevalue": 2500000000,
  "longpollid": "000000000000068812b074c0f9a17296305f2fdd842f3e6afd6e2a157f9c618582817",
  "target": "00000000000007eb160000000000000000000000000000000000000000000000",
  "mintime": 1711617892,
  "mutable": [
    "time",
    "transactions",
    "prevblock"
  ],
  "noncerange": "00000000ffffffff",
  "sigoplimit": 80000,
  "sizelimit": 400000,
  "weightlimit": 400000,
  "curtime": 1711619238,
  "bits": "1a07eb16",
  "height": 205608,
  "default_witness_commitment": "6a24aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf9"
}```

@wu-emma
Copy link
Collaborator

wu-emma commented Apr 8, 2024

@janus @laakie @naftalimurgor
@van-orton has reuploaded 0.1.11 builds from master branch and they should have the issue with getblocktemplate fixed. Please try the build and report if all is working properly. It was related to taproot version bit that was overwritten.

@laakie
Copy link
Author

laakie commented Apr 8, 2024

I've compiled from the new master and can confirm the changes are working as expected.
Thanks for all the hard work and effort put into updating the code.

@naftalimurgor
Copy link
Contributor

This is indeed great. I'll update my affected repos as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants