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

multi: Remove deprecated missed and expired tickets RPCs. #2911

Conversation

davecgh
Copy link
Member

@davecgh davecgh commented Mar 28, 2022

This requires #2909 and #2910.

Per the second phase of #2774, this removes all RPCs and associated code related to missed and expired tickets.

As stated in the original proposal, the only known way these RPCs are used is to support wallet staking statistics, but due to the automatic revocations consensus change, wallets will not really need the RPCs to calculate the vast majority of the information anymore since they can detect missed and expired tickets through a combination of seeing the revocation and comparing the number of confirmations against the ticket purchase height.

Further, these RPCs are really not something that dcrd should be maintaining by default anyway because they have some fairly significant downsides:

  • The set of missed tickets and revoked tickets are both unbounded which means they take up more and more resources over time
  • With the automatic revocations consensus change, the entire notion of a missed category effectively no longer exists
  • The sets are already large enough that they take a non-trivial amount of RAM and I/O and will only become more burdensome over time
  • Even though the missed category will effectively no longer exist, continued support of these RPCs requires the current ticket database and related consensus code to continue to be able to track and manipulate these unbounded sets

That final point is perhaps one of the most important ones, because the ticket database design can be significantly optimized due to the introduction of the automatic revocations consensus change so long as the RPCs in question are no longer supported.

The removals have been split into multiple commits to ease the review process and also ensure everything continues to work properly each step of the way.

The following is a high level overview of the changes:

  • Bumps the RPC server major version to 8.0.0
  • Removes the entries for the following RPCs and notifications from the JSON-RPC API docs:
    • missedtickets
    • rebroadcastmissed
    • existsmissedtickets
    • existsexpiredtickets
    • notifyspentandmissedtickets
    • spentandmissedtickets
  • Removes all code for the following methods and notification tracking from the rpcclient:
    • MissedTicketsAsync
    • MissedTickets
    • ExistsMissedTicketsAsync
    • ExistsMissedTickets
    • ExistsExpiredTicketsAsync
    • ExistsExpiredTickets
    • NotifySpentAndMissedTicketsAsync
    • NotifySpentAndMissedTickets
    • OnSpentAndMissedTickets
  • Removes all code from the RPC server for handling the following RPCs and notifications:
    • missedtickets
    • rebroadcastmissed
    • existsmissedtickets
    • existsexpiredtickets
    • notifyspentandmissedtickets
    • spentandmissedtickets
  • Removes the following methods from blockchain that are no longer used as they only existed to support the RPCs:
    • MissedTickets
    • CheckMissedTickets
    • CheckExpiredTicket
    • CheckExpiredTickets
  • Removes the NTSpentAndMissedTickets and associated code to send the notification from blockchain
  • Updates the blockchain.TicketNotificationsData struct to remove the TicketsSpent and TicketsMissed fields
  • Removes the following types, constants, and registrations along with associated tests from rpc/jsonrpc/types:
    • MissedTicketsCmd
    • MissedTicketsResult
    • RebroadcastMissedCmd
    • ExistsMissedTicketsCmd
    • ExistsExpiredTicketsCmd
    • NotifySpentAndMissedTicketsCmd
    • SpentAndMissedTicketsNtfnMethod
    • SpentAndMissedTicketsNtfn

This closes #2774.

@davecgh davecgh added the rpc server api change Issues and/or pull requests that involve a new RPC server version or breaking to change to the API. label Mar 28, 2022
@davecgh davecgh added this to the 1.8.0 milestone Mar 28, 2022
@davecgh
Copy link
Member Author

davecgh commented Mar 28, 2022

As an additional point, I debated whether or not to replace the notifyspentandmissedtickets with a notifyspenttickets notification, but I decided against it because it would contain the exact same information as notifywinningtickets given every block after the autorevocations consensus change is active will necessarily spend all of the winning tickets through a vote or an automatic revocation.

@davecgh davecgh force-pushed the multi_remove_deprecated_missed_and_expired_tickets_rpcs branch from 9559d05 to 1571ef9 Compare March 30, 2022 23:07
Copy link
Member

@rstaudt2 rstaudt2 left a comment

Choose a reason for hiding this comment

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

Looks good, nice to see all of that removed. All of the separate commits made this really easy to follow.

@davecgh davecgh force-pushed the multi_remove_deprecated_missed_and_expired_tickets_rpcs branch from 1571ef9 to 8e656e5 Compare April 11, 2022 22:46
@davecgh davecgh added the waiting for consensus change Pull requests that are waiting for consensus changes to activate. label Apr 12, 2022
@davecgh davecgh force-pushed the multi_remove_deprecated_missed_and_expired_tickets_rpcs branch from 8e656e5 to 54c41c2 Compare April 25, 2022 23:13
This bumps the major version of the JSON RPC server in anticipation of
upcoming changes to remove deprecated RPCs related to missed and expired
tickets.

This is part of the overall removal of deprecated RPCs related to missed
and expired tickets.
This removes the deprecated missedtickets method from the JSON-RPC API
documentation.

This is part of the overall removal of deprecated RPCs related to missed
and expired tickets.
This removes support for the deprecated missedtickets method from the
RPC client.

This is part of the overall removal of deprecated RPCs related to missed
and expired tickets.
This removes the deprecated missedtickets method from the RPC server.

This is part of the overall removal of deprecated RPCs related to missed
and expired tickets.
This removes the types and associated code for the deprecated
missedtickets RPC.

This is part of the overall removal of deprecated RPCs related to missed
and expired tickets.
This removes the deprecated rebroadcastmissed method from the JSON-RPC
API documentation.

This is part of the overall removal of deprecated RPCs related to missed
and expired tickets.
This removes the deprecated rebroadcastmissed method from the RPC
server.

This is part of the overall removal of deprecated RPCs related to missed
and expired tickets.
This removes the MissedTickets method from blockchain now that it is no
longer used.
This removes the type and associated code for the deprecated
rebroadcastmissed RPC.

This is part of the overall removal of deprecated RPCs related to missed
and expired tickets.
This removes the deprecated existsmissedtickets method from the JSON-RPC
API documentation.

This is part of the overall removal of deprecated RPCs related to missed
and expired tickets.
This removes support for the deprecated existsmissedtickets method from
the RPC client.

This is part of the overall removal of deprecated RPCs related to missed
and expired tickets.
This removes the deprecated existsmissedtickets method from the RPC
server.

This is part of the overall removal of deprecated RPCs related to missed
and expired tickets.
This removes the CheckMissedTickets method from blockchain now that it
is no longer used.
This removes the type and associated code for the deprecated
existsmissedtickets RPC.

This is part of the overall removal of deprecated RPCs related to missed
and expired tickets.
This removes the deprecated existsexpiredtickets method from the
JSON-RPC API documentation.

This is part of the overall removal of deprecated RPCs related to missed
and expired tickets.
This removes support for the deprecated existsexpiredtickets method from
the RPC client.

This is part of the overall removal of deprecated RPCs related to missed
and expired tickets.
This removes the deprecated existsexpiredtickets method from the RPC
server.

This is part of the overall removal of deprecated RPCs related to missed
and expired tickets.
This removes the CheckExpiredTicket and CheckExpiredTickets methods from
blockchain now that they are no longer used.
This removes the type and associated code for the deprecated
existsexpiredtickets RPC.

This is part of the overall removal of deprecated RPCs related to missed
and expired tickets.
This removes the deprecated notifyspentandmissedtickets method and
associated spentandmissedtickets notification from the JSON-RPC API
documentation.
This removes support for the deprecated notifyspentandmissed method from
the RPC client.

This is part of the overall removal of deprecated RPCs related to missed
and expired tickets.
This removes the deprecated notifyspentandmissedtickets method from the
RPC server.

This is part of the overall removal of deprecated RPCs related to missed
and expired tickets.
This removes the NTSpentAndMissedTickets notification and associated
code to send the notification now that it is no longer used.

It also updates the TicketNotification struct to only include the new
tickets since it is now only used for that purpose.
This removes the type and associated code for the deprecated
notifyspentandmissedtickets RPC.

This is part of the overall removal of deprecated RPCs related to missed
and expired tickets.
@davecgh davecgh force-pushed the multi_remove_deprecated_missed_and_expired_tickets_rpcs branch from 54c41c2 to 0969534 Compare May 8, 2022 10:27
@davecgh davecgh merged commit 0969534 into decred:master May 8, 2022
@davecgh davecgh deleted the multi_remove_deprecated_missed_and_expired_tickets_rpcs branch May 8, 2022 10:32
@davecgh davecgh removed the waiting for consensus change Pull requests that are waiting for consensus changes to activate. label Jun 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rpc server api change Issues and/or pull requests that involve a new RPC server version or breaking to change to the API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Proposal to deprecate and remove RPCs related to missed and expired tickets
4 participants