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

Finish physical redesign #4997

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

thejohnfreeman
Copy link
Collaborator

@thejohnfreeman thejohnfreeman commented Apr 19, 2024

This is the final and most disruptive phase of the physical redesign. It makes these changes:

  • CMake modules are moved into their own top-level cmake/ directory.
  • libxrpl headers are moved into include/xrpl/.
  • libxrpl sources are moved to src/libxrpl/.
  • rippled sources are moved to src/xrpld/.
  • The ripple C++ namespace is unchanged.
  • libxrpl headers are installed to both the xrpl/ and ripple/ subdirectories of the header installation prefix. (ripple/ is a symbolic link to xrpl/, even on Windows.) They include each other with path prefix xrpl/, but existing projects can continue to include them with path prefix ripple/ and migrate to prefix xrpl/ at their own pace.
  • rippled is installed as both rippled and xrpld. (xrpld is a symbolic link to rippled, even on Windows.)
  • CMake source lists are computed from globs. Newly added source and header files are automatically built and installed without any intervention from contributors.
  • CMake target names are cleaned up and standardized.

There is a non-trivial (but, I think, easy) process to merge existing branches-in-progress with this one. I will describe it here. Look at the sequence of commits. Notice the commit with subject "Add bin/physical.sh". Call that the checkpoint commit. There are no file movements before the checkpoint commit. The four commits following the checkpoint commit are generated by running the bin/physical.sh script added in the checkpoint commit.

When you want to merge, you should:

  • Merge with develop. Resolve conflicts yourself. Be sure that all of the source files added in your branch (if any) appear in the correct source lists in Builds/CMake/RippledCore.cmake, between the BEGIN/END marker comments (example) . The restructure script moves only the files in these lists, and stops early if any files are leftover (because they were omitted from the lists). Remember the commit ID of this merge. Call it your marker commit.
    git merge develop
    marker=$(git log -1 --pretty=format:%h)
    
  • Merge with the checkpoint commit. Resolve conflicts yourself. (I will try to keep this instruction up-to-date, but the commit ID below may be incorrect. Please double-check the commits in this PR to identify the correct checkpoint commit.)
    git merge 64a6c40
    
  • Regenerate the next four commits by executing bin/physical.sh, passing it your marker commit from the first step:
    ./bin/physical.sh ${marker}
    
  • Check the sort order in Builds/levelization/results/ordering.txt. Lines beginning with xrpl. must appear before lines beginning with xrpld. Different versions of sort have been inconsistent on this matter in my experience. On my machine, sort puts xrpl. after xrpld, which does not match the output of sort in our CI job that checks the file.
    ${EDITOR} Builds/levelization/results/ordering.txt
    git add --update .
    git commit --amend
    

Then you can git merge -X ours $upstream where upstream points to the head of this branch. It will automatically resolve conflicts in your branch's favor. Then you can git diff $upstream and see your work ported.

This PR requires the same finishing steps as #4966:

  • Confirm it has at least two approvals from qualified reviewers.
  • Rebase the commits on top of develop. The commit sequence that predates the review should be preserved. Fixes made since the review opened should be merged into earlier commits.
  • Rewrite non-substantive (e.g. formatting) commits as authored by "Pretty Printer <cpp@ripple.com>".
  • Add rewritten non-substantive commit IDs to .git-blame-ignore-revs.
  • Confirm the branch still passes all tests after making these changes.

@thejohnfreeman thejohnfreeman force-pushed the restructure branch 2 times, most recently from e604953 to e068be2 Compare April 20, 2024 15:12
@codecov-commenter
Copy link

codecov-commenter commented Apr 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 71.3%. Comparing base (d576416) to head (92bd4ca).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           develop   #4997     +/-   ##
=========================================
- Coverage     71.3%   71.3%   -0.0%     
=========================================
  Files          796     796             
  Lines        66883   66883             
  Branches     10866   10870      +4     
=========================================
- Hits         47685   47677      -8     
- Misses       19198   19206      +8     
Files Coverage Δ
include/xrpl/basics/BasicConfig.h 87.7% <ø> (ø)
include/xrpl/basics/Buffer.h 100.0% <ø> (ø)
include/xrpl/basics/ByteUtilities.h 100.0% <ø> (ø)
include/xrpl/basics/CompressionAlgorithms.h 0.0% <ø> (ø)
include/xrpl/basics/CountedObject.h 100.0% <ø> (ø)
include/xrpl/basics/DecayingSample.h 87.9% <ø> (ø)
include/xrpl/basics/Expected.h 100.0% <ø> (ø)
include/xrpl/basics/FeeUnits.h 90.1% <ø> (ø)
include/xrpl/basics/IOUAmount.h 100.0% <ø> (ø)
include/xrpl/basics/LocalValue.h 100.0% <ø> (ø)
... and 159 more

... and 1254 files with indirect coverage changes

Impacted file tree graph

conanfile.py Show resolved Hide resolved
CMakeLists.txt Show resolved Hide resolved
@Bronek
Copy link
Collaborator

Bronek commented May 20, 2024

Note, this is moving files from impl and details to their parent directories, which I think is a problem because that expands the libxrpl API surface with the following files (which were designed to be implementation and not API)

json/impl/json_assert.h

protocol/impl/STVar.h  protocol/impl/b58_utils.h  protocol/impl/secp256k1.h  protocol/impl/token_errors.h

resource/impl/Entry.h  resource/impl/Import.h  resource/impl/Key.h  resource/impl/Kind.h  resource/impl/Logic.h  resource/impl/Tuning.h

server/impl/BaseHTTPPeer.h  server/impl/BaseWSPeer.h  server/impl/JSONRPCUtil.h  server/impl/PlainHTTPPeer.h  server/impl/SSLHTTPPeer.h  server/impl/ServerImpl.h
server/impl/BasePeer.h      server/impl/Door.h        server/impl/LowestLayer.h  server/impl/PlainWSPeer.h    server/impl/SSLWSPeer.h    server/impl/io_list.h

@Bronek
Copy link
Collaborator

Bronek commented Jun 7, 2024

Note, this is moving files from impl and details to their parent directories, which I think is a problem because that expands the libxrpl API surface with the following files (which were designed to be implementation and not API)

json/impl/json_assert.h

protocol/impl/STVar.h  protocol/impl/b58_utils.h  protocol/impl/secp256k1.h  protocol/impl/token_errors.h

resource/impl/Entry.h  resource/impl/Import.h  resource/impl/Key.h  resource/impl/Kind.h  resource/impl/Logic.h  resource/impl/Tuning.h

server/impl/BaseHTTPPeer.h  server/impl/BaseWSPeer.h  server/impl/JSONRPCUtil.h  server/impl/PlainHTTPPeer.h  server/impl/SSLHTTPPeer.h  server/impl/ServerImpl.h
server/impl/BasePeer.h      server/impl/Door.h        server/impl/LowestLayer.h  server/impl/PlainWSPeer.h    server/impl/SSLWSPeer.h    server/impl/io_list.h

@thejohnfreeman thanks for addressing this concern.

Copy link
Collaborator

@Bronek Bronek 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 this a lot.

Copy link
Collaborator

@Bronek Bronek left a comment

Choose a reason for hiding this comment

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

I noticed that the most recent rebase has reverted the change to which I refer here
#4997 (comment)

Is it intentional ?

@Bronek
Copy link
Collaborator

Bronek commented Jun 10, 2024

I noticed that the most recent rebase has reverted the change to which I refer here #4997 (comment)

Thanks @thejohnfreeman , I see that's fixed now.

@scottschurr
Copy link
Collaborator

I'm trying to follow the directions for merging an in-process branch with the physical restructure. Everything was going well until I ran bin/physical.sh. There I had two surprises.

The output from bin/physical.sh was this:

move protocol buffers
move libxrpl headers
move libxrpl sources
check leftovers
leftover files:
beast//utility/src/beast_PropertyStream.cpp crypto//impl/secure_erase.cpp

The leftover files was a surprise, and the instructions did not say what to do if that happened, so I'm reporting it here.

Additionally, I checked the sort order of Builds/levelization/results/ordering.txt as instructed. To my surprise it contained no lines that started with either xrpl. or xrpld. All 229 lines in the file started with either ripple. or test.. So I suspect something went wrong.

Suggestions? Thanks.

@thejohnfreeman
Copy link
Collaborator Author

@scottschurr what branch did you try?

@scottschurr
Copy link
Collaborator

@thejohnfreeman
Copy link
Collaborator Author

I just merged that branch without a hitch: https://github.com/thejohnfreeman/rippled/tree/blocked-book

I'll try to replicate your experience on macOS soon.

@scottschurr
Copy link
Collaborator

Thanks. And if there are any experiments you would like me to try I'm happy to do so. Best of luck.

thejohnfreeman and others added 3 commits June 11, 2024 19:31
- Remove CMake module "MultiConfig".
- Update clang-format configuration, CodeCov configuration,
  levelization script.
- Replace source lists in CMake with globs.
@thejohnfreeman
Copy link
Collaborator Author

thejohnfreeman commented Jun 12, 2024

The problem is what I expected, the environment. The requirements I found missing on macOS are:

  • GNU sed
  • GNU find
  • Bash >= 4 (for readarray)
  • clang-format-10 must be on the PATH

Can you run the script in a Linux environment? Alternatively, if you can get these programs on your PATH (brew install gnu-sed findutils will install gsed and gfind; Homebrew doesn't have clang-format-10) and invoke the script with Bash (the default shell in macOS is now Zsh), then it should work.

@scottschurr
Copy link
Collaborator

I don't have a readily available Linux environment, but I can install gsed and gfind using homebrew and invoke the script with Bash. I'm in the middle of a different (unrelated) problem right now, but I should be able to get you results in a day or so. Thanks for the help.

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.

None yet

4 participants