-
Notifications
You must be signed in to change notification settings - Fork 1
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
Wrapper class for Fee Ledger Object #24
base: wrapper
Are you sure you want to change the base?
Conversation
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.
Rather than add review notes for every suggested change, I'll describe the process that I followed during my review. I edited all of the changes I suggest into a [FOLD]
commit that you can find here: https://github.com/scottschurr/rippled/commits/chenna-feesWrap You are welcome to use that commit any way you like, including cherry-picking. I'm hoping that providing my review comments in this fashion will be more useful than isolated comments.
The feesWrap branch did not build for me initially because the following files...
- src/ripple/app/ledger/impl/BuildLedger.cpp
- src/ripple/app/ledger/impl/InboundLedger.cpp
- src/ripple/app/main/Application.cpp
- src/ripple/app/reporting/ReportingETL.cpp
- src/ripple/nodestore/impl/Shard.cpp
were all missing the following line:
#include <ripple/protocol/Fees.h>
Once I added that #include
to all of those files then the project built. I wonder if the reason you did not notice this problem is that you use unity builds? At any rate, with this branch a non-unity debug build failed with errors.
I then looked in src/ripple/protocol/Fees.h
I noticed...
using FeesLgrObjectRd = FeesImpl<false>;
In particular, FeesImpl
is not defined as FeesLgrObjectImpl
. That felt like an asymmetry to me. I think that it's important that the names of the three related classes (Impl
, Rd
, and <mutable>
) keep a uniform relationship.
You did a good job refining the Fees
name to distinguish it from the pre-exisiting Fees
class. Indicating that the new one represents a ledger object is a great way to distinguish it from the pre-exisiting Fees
class. But I felt like the choice of spelling out "Object" while abbreviating "Lgr" was odd. Since I wanted to change the name of the "Impl" class anyway, I decided that I preferred the name FeesLedgerObjImpl
over FeesLgrObjectImpl
. It has the same number of characters and emphasizes "Ledger", which I think is more important than "Object" in the name.
So I renamed the "Impl" class, the file that contains it, the two using
s, and the name of the #include
guard.
Then I grepped for occurrences of FeesImpl
and fixed those. I only found those in Keylet.h.
At this point I re-built the project to find all of the #include
s that I needed to fix because of the renamed file. I fixed up those files.
While I was fixing that up I noted that the #include
s in Ledger.cpp and RCLValidations_test.cpp were not sorted correctly and fixed those up as well.
After that successfully built I did a grep for keylet::fees
to look at peek()
vs peekSLE()
and variable names. That all looked good. I didn't change anything.
I am not keen on using auto
for return types unless there's an obvious benefit. When I'm reading source code it's really useful for the return type to be visible as part of the function/method declaration. Without that then I need to go digging through the implementation of the function, and even that may not give me the explicit name of the returned type.
So I changed all of the auto
returns in FeeLedgerObj.h to be explicit types.
After that built successfully I did:
git difftool HEAD~2
to look over the accumulation of your changes plus my suggested changes.
I noted that the copyright in FeesLedgerObj.h was 2021, so I changed it to 2023. The copyright date in AcctRoot.h is 2021, but that's probably correct because that's when that code was originally developed.
I also remembered that I had suggested keeping the definitions in Keylet.h alphabetical, so I moved the definition of FeesKeylet
below AccountRootKeylet
.
That's pretty much the process. I hope that helps.
@@ -82,8 +82,8 @@ skip() noexcept; | |||
Keylet | |||
skip(LedgerIndex ledger) noexcept; | |||
|
|||
/** The (fixed) index of the object containing the ledger fees. */ | |||
Keylet const& | |||
/** The (permanent) index of the object containing the ledger fees. */ |
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.
Yeah, I think that comment change helps clarify the meaning. Thanks.
@@ -19,12 +19,12 @@ | |||
|
|||
#include <ripple/app/consensus/RCLValidations.h> | |||
#include <ripple/app/ledger/Ledger.h> | |||
#include <ripple/basics/Log.h> |
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.
Thanks for noticing that Log.h
is not needed.
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.
CLion did it for me :)
@scottschurr Thanks for the detailed reply, I'll keep these suggestions in mind. I'm still unclear on differing compilation behaviours in our machines. I have not switched to a non-unity debug build, so hopefully such discrepencies will not arise again. Regarding the return types of the functions, I was not 100% sure about the types, so I hid behind |
Regarding not knowing return types, here's a trick I use fairly often... Suppose I have an
You can usually coerce the compiler to tell you what the type is by assigning that type to an incompatible type. Like this:
This will (usually) cause the compiler to stop with an error. Often the compiler will be helpful and tell you what type it cannot assign to an Very occasionally the return type can legally be assigned to If you use this trick be sure to remove all vestiges of the experiment you were running before submitting a pull request. |
Regarding...
Got me? I have no experience with CLion. Other than with the debugger, I work pretty much just with a text editor and the command line. I can show you the command lines that I use, but I have no idea what (command line equivalents) CLion produces. |
In the past |
okay 👍 I have cherry-picked your commit to update this PR, thank you very much, I'll keep these suggestions in mind for future PRs. |
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.
Looks great! Thanks for doing this.
Two suggestions for pushing this forward.
- Let's hold off on making a pull request against develop until we've had a chance to request reviewers for all of the wrapper pull requests. We can do that at the huddle on June 7th.
- Squash all of these commits together before making the pull request. Your reviewers do not need to see your development process.
I think that's if from me. Let's hope for the best from the other reviewers.
Thank you so much Scott! I'll keep these points in mind :+1
Regards,
Keshava
…On Tue, Jun 6, 2023 at 5:01 PM Scott Schurr ***@***.***> wrote:
***@***.**** approved this pull request.
Looks great! Thanks for doing this.
Two suggestions for pushing this forward.
1. Let's hold off on making a pull request against develop until we've
had a chance to request reviewers for all of the wrapper pull requests. We
can do that at the huddle on June 7th.
2. Squash all of these commits together before making the pull
request. Your reviewers do not need to see your development process.
I think that's if from me. Let's hope for the best from the other
reviewers.
—
Reply to this email directly, view it on GitHub
<https://urldefense.com/v3/__https://github.com/scottschurr/rippled/pull/24*pullrequestreview-1466327583__;Iw!!PZTMFYE!9rFDbkzmwOrXBiZtXZIxqeDju94A8WUp7RPxREki6ELNgNZnbb_FOaay05uWzTXdLvIJHvsviPt14dsDItc9V1ai0A$>,
or unsubscribe
<https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AFB4TNIPOPIGGJKMCU7SDETXJ7AFHANCNFSM6AAAAAAYUUGWTA__;!!PZTMFYE!9rFDbkzmwOrXBiZtXZIxqeDju94A8WUp7RPxREki6ELNgNZnbb_FOaay05uWzTXdLvIJHvsviPt14dsDItfASRxxgQ$>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
High Level Overview of Change
This PR introduces wrapper for Fees Ledger Object
Type of Change