Skip to content

Long-term: remove the const_cast workaround in SLEBase's resolveEntry() #8069

Description

@mvadari

SLEBase's resolveEntry() helper (include/xrpl/ledger/helpers/SLEBase.h) uses const_cast<ReadView*> to reach ApplyView::peek() from a ReadView const&. This is safe today only because xrpld never holds a truly const-qualified ReadView, but it's fragile.

Ideas raised in PR #7886 review, roughly in order of preference:

  1. Fix ApplyView::read() to use the cache (see ApplyView::read() doesn't go through the apply-state-table cache like peek() does #8068) — would remove the need for this workaround entirely.
  2. Add a const peek() to ReadView that just calls read(), and call peek() here unconditionally.
  3. Make ApplyView::peek() a const function (with the members it touches mutable), then cast view to ApplyView const* instead of stripping const off a ReadView*.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions