Skip to content

Conversation

maflcko
Copy link
Member

@maflcko maflcko commented Apr 1, 2022

Now that the commit (7c08d81) which changes taproot to be enforced for all blocks is sufficiently buried by other commits, and thus less likely to be reverted, it seems a good time to remove no longer needed non-consensus code.

In particular, the taproot deployment status will be reported on RPC. However, the result is neither wrong nor correct. While it can tell the block height at which taproot activated, it doesn't reflect that the rules are enforced since genesis. Since it is possible to determine the taproot activation height by running a previous release or simply looking it up in the BIP, there is no need to report it in a field.

@maflcko maflcko force-pushed the 2204-rem-code- branch 2 times, most recently from faea171 to fa47617 Compare April 1, 2022 12:40
@DrahtBot
Copy link
Contributor

DrahtBot commented Apr 1, 2022

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

No conflicts as of last run.

@@ -213,19 +213,6 @@ def check_signalling_deploymentinfo_result(self, gdi_result, height, blockhash,
},
'active': False
},
'taproot': {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other soft forks are marked as burried, rather than completely omitted.

Copy link
Member Author

@maflcko maflcko Apr 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think this is a reason to remove them as well. Once they are buried, their activation height is a constant. So there is no need to report it dynamically over RPC. Apart from being overkill, I don't see a use case either.

If someone wants to know if the wallet supports $feature, they can use a wallet RPC or the GUI. (This RPC won't help them)
If someone wants to know if the mempool supports $feature, this RPC won't help them either. I think the best they can do is read the release notes to figure out if the mempool supports $feature regardless of blockchain height. Alternatively they can just test if their use case is supported.
If someone read the release notes, but wants to know over RPC which version of Bitcoin Core they are running, they can use the appropriate call.

As mentioned in OP, returning a result for taproot here (buried or vb) is neither right or wrong. While the result may reflect the height at which the BIP activated on the network (as mentioned in the BIP as well), it does not reflect the height at which this software enforces the rules. The rules are theoretically enforced since genesis, practically only after witness is allowed in blocks. This is not something that can/should be explained by returning a JSON.

If you insist on returning a JSON, my preference would be to return 'taproot': True. Until then, my preference is to remove it, since it is unknown if there is a use case for this (and if there is one) what the use case is.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think this is a reason to remove them as well.

I'm not opposed to that, but the inconsistency doesn't help review. Why not set it to burried now and make another PR to drop all buried soft forks from the RPC, using the above reasoning. Such a followup would be an RPC-only change.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, my suggestion to remove the others as well was a bit over eager. They are still used and the activation height actually affects code paths. In fact the tests use -testactivationheight to mock the activation height. Though, this isn't true for taproot.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I already tried to bury taproot in #23505. Though there wasn't much/enough appetite to get it in before the 23.0 feature freeze. As burying is a breaking RPC change and we already had one (getdeploymentinfo) in 23.0, it could have been bundled with that. However, now that 23.0 is out, it would be a breaking change in 24.0 to bury it. Then, if it is decided to remove, it will be another breaking change.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it a breaking change? A correct parser should look for taproot and then check the type field. It should be able to handle buried. If an implementation can't handle that, it might also break when taproot is missing entirely.

@ajtowns
Copy link
Contributor

ajtowns commented Sep 7, 2022

Since it is possible to determine the taproot activation height by running a previous release or simply looking it up in the BIP, there is no need to report it in a field.

I don't think I quite agree with this -- it seems better to me to have the program document its own behaviour, rather than expecting you to look up documentation that might not even be in sync with the code (our behaviour since #23536 isn't documented in a BIP, is it?). So, better to keep the report, but have it match what the code is doing. For example, it might be better to report something like:

$ bitcoin-cli getdeploymentinfo 0000000000000000000f14c35b2d841e986ab5441de8c585d5ffe55ea1e395ad | jq .deployments.taproot
{
  "type": "almost_always",
  "active": true,
  "almost_always": {
      "active_this_block": false,
      "exception_blocks": [
          "00000000000002dc756eebf4f49723ed8d30cc28a5f108eb94b1ba88ac4f9c22",
          "0000000000000000000f14c35b2d841e986ab5441de8c585d5ffe55ea1e395ad",
      ]
  },
}

(and perhaps likewise for bip16/p2sh, though going overboard with reporting ancient changes that no block violates doesn't seem particularly useful).

@Sjors
Copy link
Member

Sjors commented Sep 9, 2022

I like the exception block listing. Maybe a little less verbose:

{
  "type": "buried",
  "active": true,
  "exception_blocks": [
    "00000000000002dc756eebf4f49723ed8d30cc28a5f108eb94b1ba88ac4f9c22",
    "0000000000000000000f14c35b2d841e986ab5441de8c585d5ffe55ea1e395ad",
  ]
}

Here active refers to the block you're requesting and buried implies the existence of exception_blocks, which may be empty.

@ajtowns
Copy link
Contributor

ajtowns commented Sep 9, 2022

Here active refers to the block you're requesting

active refers to the following block (and mempool, if that block is the current tip):

      "active" : true|false,            (boolean) true if the rules are enforced for the mempool and the next block

Should have a consistent meaning across deployment types, though I could see doing a breaking change for all deployment types to make it less confusing...

and buried implies the existence of exception_blocks, which may be empty.

Elsewhere, we put any extra info that's specific to a deployment method in a sub-object, named after the type (ie "bip9": {...}). Maybe { "buried": { "exceptions": [ ... ] } } might be reasonable?

@Sjors
Copy link
Member

Sjors commented Sep 9, 2022

Ah ok, then active_this_block makes sense. But we can also drop it, because the user can check exceptions.

"buried": { "exceptions": could make sense yes.

@maflcko
Copy link
Member Author

maflcko commented Sep 12, 2022

it seems better to me to have the program document its own behaviour, rather than expecting you to look up documentation that might not even be in sync with the code (our behaviour since #23536 isn't documented in a BIP, is it?)

It is documented in doc/bips.md as part of this pull.

though going overboard with reporting ancient changes that no block violates doesn't seem particularly useful

Agree. I've added a second commit, though let me know if I should drop it again.

Copy link
Member

@Sjors Sjors left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the new exception blocks field. I still prefer to mark taproot as buried rather than dropping it.

@@ -213,19 +213,6 @@ def check_signalling_deploymentinfo_result(self, gdi_result, height, blockhash,
},
'active': False
},
'taproot': {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it a breaking change? A correct parser should look for taproot and then check the type field. It should be able to handle buried. If an implementation can't handle that, it might also break when taproot is missing entirely.

@ajtowns
Copy link
Contributor

ajtowns commented Sep 12, 2022

Don't really like the idea of reporting the exceptions without reporting what's "normal".

I was thinking more along the lines of: ajtowns@809a545 (possibly reporting bip16 support/exceptions as well) which gives output like:

{
  "hash": "00000000000000000007e4449a4d61ba2d2a3f0bbc0bbf355d2fcc8deecdb864",
  "height": 753789,
  "deployments": {
    ...
    "bip16": {
      "type": "buried",
      "buried": {
        "exceptions": [
          "00000000000002dc756eebf4f49723ed8d30cc28a5f108eb94b1ba88ac4f9c22"
        ]
      },
      "active": true,
      "height": 0
    },
    ...
    "segwit": {
      "type": "buried",
      "active": true,
      "height": 481824
    },
    "taproot": {
      "type": "buried",
      "buried": {
        "exceptions": [
          "00000000000002dc756eebf4f49723ed8d30cc28a5f108eb94b1ba88ac4f9c22",
          "0000000000000000000f14c35b2d841e986ab5441de8c585d5ffe55ea1e395ad"
        ]
      },
      "active": true,
      "height": 0
    }
  }
}

@maflcko
Copy link
Member Author

maflcko commented Sep 13, 2022

Ok, leaving up for grabs for now

@Sjors
Copy link
Member

Sjors commented Sep 23, 2022

Picked this up along with @ajtowns's changes in #26162. Work in progress though.

@bitcoin bitcoin locked and limited conversation to collaborators Sep 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants