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

Move and rename crate::policy::semantic::Policy to crate::r#abstract::Abstract #604

Closed
wants to merge 8 commits into from

Commits on Sep 27, 2023

  1. Use wilcard import in unit tests

    We can import types to test in unit tests using `use super::*`.
    tcharding committed Sep 27, 2023
    Configuration menu
    Copy the full SHA
    0232152 View commit details
    Browse the repository at this point in the history
  2. Rename semantic module to abstract

    We used "semantic" so as not to clash with the reserved Rust keyword
    "abstract", however there is a language feature to deal with such name
    clashes - the raw identifier syntax `r#foo`.
    
    Use `r#abstract` and rename the `policy/semantic.rs` file to
    `policy/abstract.rs`. There is more re-naming to do to complete the
    semantic -> abstract change but here we _only_ do the module name to
    ease review.
    tcharding committed Sep 27, 2023
    Configuration menu
    Copy the full SHA
    b3f55f6 View commit details
    Browse the repository at this point in the history
  3. Move Liftable to crate::abstract module

    The `Liftable` trait is its own thing, it defines a trait to lift
    miniscript, descriptors, and concrete policies to an abstract policy.
    
    Move the `Liftable` and associated error type and impls to a new `lift`
    module that lives under the recently created `crate::r#abstract` module.
    
    Note we alse remove the `Semantic` and `Concrete` public
    re-names/re-exports from `crate::policy` because we are transitioning
    away from using the term "semantic", however to minimise the changes in
    this patch we add a bunch of
    
      `use crate::policy::concrete::Policy as Concrete`
    
    statements.
    tcharding committed Sep 27, 2023
    Configuration menu
    Copy the full SHA
    f00e538 View commit details
    Browse the repository at this point in the history
  4. Use Abstract instead of Semantic

    We are moving away from the usage of "semantic" as a synonym for
    "abstract".
    
    Use `Abstract` instead of `Semantic` as the type alias for
    `crate::policy::r#abstract::Policy`.
    tcharding committed Sep 27, 2023
    Configuration menu
    Copy the full SHA
    08ddb6c View commit details
    Browse the repository at this point in the history
  5. Use Abstract type alias in Liftable for Tr

    Make it explicit that the `Policy` returned by `lift` in the
    `descriptor::tr` module is a `r#abstract::Policy`.
    tcharding committed Sep 27, 2023
    Configuration menu
    Copy the full SHA
    298e8d8 View commit details
    Browse the repository at this point in the history
  6. Move abstract::Policy to crate/abstract/mod.rs

    The abstract policy is different from the concrete policy because it is
    only part of rust-miniscript and not miniscript in general. To help
    differentiate it move it to a separate module.
    
    Note to reviewers, `git` couldn't work out that this is basically a file
    move so I've left the `src/policy/abstract.rs` file in the repo but it
    is not included in the build. Reviewers can do `diff
    src/policy/abstract.rs src/abstract/mod.rs` to ease review. It will be
    removed in the next patch.
    tcharding committed Sep 27, 2023
    Configuration menu
    Copy the full SHA
    463a41f View commit details
    Browse the repository at this point in the history
  7. Remove unused abstract.rs file

    We do not build this file in the build, remove it.
    tcharding committed Sep 27, 2023
    Configuration menu
    Copy the full SHA
    70b2e5f View commit details
    Browse the repository at this point in the history
  8. Rename abstract::Policy to Abstract

    Use the identifier `Abstract` to further disambiguate the abstract
    policy and the concrete policy. This has the nice advantage of removing
    a few usages of the kind-of-ugly `r#abstract::Policy`.
    tcharding committed Sep 27, 2023
    Configuration menu
    Copy the full SHA
    b79be87 View commit details
    Browse the repository at this point in the history