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

Add featureRetire2017Amendments: #3368

Closed
wants to merge 1 commit into from

Conversation

scottschurr
Copy link
Collaborator

If the Retire2017Amendments amendment is activated, then those amendments that are ...

  1. Enabled,
  2. No longer dependent on runtime amendment checks, and
  3. Listed in detail::retiringAmendments() ...

will be removed from the Amendment ledger object and the AmendmentTable.

The motivation for this change is to reduce the number of amendments stored in the Amendment ledger object. It also reduces noise in the feature RPC command (and source code) regarding amendments that have been enabled for a long time.

Copy link
Collaborator

@seelabs seelabs left a comment

Choose a reason for hiding this comment

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

I did a pass on this, and only found one minor nit. Great job on this!

a period of two weeks before being accepted. The following example outlines the
process of an Amendment from its conception to approval and usage.

* A community member makes proposes to change transaction processing in some
Copy link
Collaborator

Choose a reason for hiding this comment

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

Typo? makes proposes -> proposes

// For every retiring amendment, if we find it remove it from
// amendmentObject.
//
// Note that we can't remove the amendments from the AmendmentTable
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't quite follow this comment. If we hit this code, the Retire2017Amendments amendment has gained majority is being activated. This happens in lockstep due to the way consensus operates. The only servers that won't be in lockstep are servers that are about to become amendment blocked anyways.

What am I missing?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I see your perspective. In a practical sense all validators should be doing this on the same ledger and the outcome should, under ordinary circumstances, be a foregone conclusion.

What I'm attempting to say here is that, in general, we don't assume that all validators move in lock step. We expect them to produce different ledgers initially and then negotiate a ledger they can all agree on. Just because the Change transaction is applied locally doesn't allow us to assume that the Change will be in the validated ledger. We have to wait for all of the validators to weigh in before we can assume that.

Once we see featureRetire2017Amendments in a validated ledger then we're allowed to modify AmendmentTable. But at this point we're not allowed to assume that everyone will agree on featureRetire2017Amendments. So we wait and make the change in AmendmentTable:: doValidatedLedger.

If you find the comment confusing I'm happy to remove it or reword it. Or maybe I'm just confused...

// yet since the AmendmentTable is not a ledger object. Just
// because we do the Change doesn't guarantee enough other
// validators will.
for (uint256 const& retire : detail::retiringAmendments())
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't this code basically std::set_difference?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good spotting, and almost. But set_difference operates on sorted ranges and neither detail::retiringAmendments nor amendments are sorted.

Copy link
Contributor

@nbougalis nbougalis Apr 24, 2020

Choose a reason for hiding this comment

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

Which raises the interesting question of whether they should be. The existing "temporal" order has one benefit: it shows what activated in what order, but sorting offers benefits too. No change needed; just thinking out loud.

@codecov-io
Copy link

Codecov Report

Merging #3368 into develop will increase coverage by 0.02%.
The diff coverage is 97.67%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #3368      +/-   ##
===========================================
+ Coverage    70.41%   70.44%   +0.02%     
===========================================
  Files          683      683              
  Lines        54775    54806      +31     
===========================================
+ Hits         38570    38606      +36     
+ Misses       16205    16200       -5     
Impacted Files Coverage Δ
src/ripple/protocol/Feature.h 100.00% <ø> (ø)
src/ripple/protocol/impl/Feature.cpp 90.90% <87.50%> (-0.76%) ⬇️
src/ripple/app/misc/impl/AmendmentTable.cpp 98.38% <98.41%> (+4.46%) ⬆️
src/ripple/app/misc/AmendmentTable.h 100.00% <100.00%> (ø)
src/ripple/app/tx/impl/Change.cpp 81.25% <100.00%> (+0.87%) ⬆️
src/ripple/rpc/handlers/Feature1.cpp 100.00% <100.00%> (+7.40%) ⬆️
src/ripple/server/impl/BaseHTTPPeer.h 87.57% <0.00%> (-3.56%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 020b285...447e423. Read the comment docs.

@pwang200
Copy link
Contributor

The spec and in code comments are really helpful! To confirm my understanding, all nodes will remove the retired amendments from the ledger at the same ledger sequence. But the fixing of AmendmentTable data structure is done later and nodes may do it at different times, which is ok. 

If the Retire2017Amendments amendment is activated, then
those amendments that are ...

a. Enabled,
b. No longer dependent on runtime amendment checks, and
c. Listed in detail::retiringAmendments() ...

will be removed from the Amendment ledger object and the
AmendmentTable.

The motivation for this change is to reduce the number of
amendments stored in the Amendment ledger object.  It also
reduces noise in the feature RPC command (and source code)
regarding amendments that have been enabled for a long time.
@scottschurr
Copy link
Collaborator Author

Squashed, clang-formatted, and rebased to 1.6.0-b4.

@nbougalis
Copy link
Contributor

Having spoken with @scottschurr, I think that we don't quite feel comfortable merging this in yet. The code is fine, but this is a "breaking change" from a user's standpoint. The spec behind this will remain open, to solicit further feedback. Please see XRPLF/XRPL-Standards#14

@nbougalis nbougalis closed this May 13, 2020
@scottschurr scottschurr deleted the retire-amendments branch September 15, 2020 00:14
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

Successfully merging this pull request may close these issues.

5 participants