-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
refactor: reunify common fields #4715
Conversation
Makes transactions and pseudo-transactions share the same commonFields again. This change technically allows pseudo-transactions to have a TicketSequence field, but those transactions are only ever constructed by code paths that don't add such a field, so this is not actually a transaction processing change. We could optionally add a separate check to make sure this and other fields that don't make sense on pseudo-transactions are never added to them, but I don't think that's necessary. Fixes XRPLF#4714
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a good change. It is a little strange to add fields that should never be present in those transactions, but it regularizes the code in a nice way. 👍
Suggested commit message:
|
With the way transactions' canonical format is defined, this refactor should not change the actual format of any transactions. Thus, it does not require an amendment. That said, this refactor changes the order in which fields are added to transaction types in |
Is there any testing done on this PR? Is there any test plan? |
Discussed with @SaxenaKaustubh and @manojsdoshi and decided on a test plan:
|
Make transactions and pseudo-transactions share the same commonFields again. This regularizes the code in a nice way. While this technically allows pseudo-transactions to have a TicketSequence field, pseudo-transactions are only ever constructed by code paths that don't add such a field, so this is not a transaction processing change. It may be possible to add a separate check to ensure TicketSequence (and other fields that don't make sense on pseudo-transactions) are never added to pseudo-transactions, but that should not be necessary. (TicketSequence is not the only common field that can not and does not appear in pseudo-transactions.) Note: TicketSequence is already documented as a common field. Related: XRPLF#4637 Fix XRPLF#4714
Ok, I did this experiment. I used rippled 1.12.0 to sign a bogus transaction, took the json and serialized output of that signing, then serialized and deserialized each respectively using a branch of the ripple-offline-tool built against 2.0.0-rc5, then compared the output of the two to determine they're identical.
(Note the only difference in the json is the absent |
@ximinez thank you very much for running this experiment. The ripple-offline-tool is very convenient! @Bronek The |
Currently |
Make transactions and pseudo-transactions share the same commonFields again. This regularizes the code in a nice way. While this technically allows pseudo-transactions to have a TicketSequence field, pseudo-transactions are only ever constructed by code paths that don't add such a field, so this is not a transaction processing change. It may be possible to add a separate check to ensure TicketSequence (and other fields that don't make sense on pseudo-transactions) are never added to pseudo-transactions, but that should not be necessary. (TicketSequence is not the only common field that can not and does not appear in pseudo-transactions.) Note: TicketSequence is already documented as a common field. Related: XRPLF#4637 Fix XRPLF#4714
Makes transactions and pseudo-transactions share the same
commonFields
again. This change technically allows pseudo-transactions to have aTicketSequence
field, but those transactions are only ever constructed by code paths that don't add such a field, so this is not actually a transaction processing change.(Note, my build is not working at the moment, but the amount I was able to build so far gets past this file at least.)
Context of Change
Fixes #4714
Type of Change
Future Tasks
We could optionally add a separate check to make sure this and other fields that don't make sense on pseudo-transactions are never added to them, but I don't think that's necessary.