Skip to content

[flashloan] new public enums missing #[non_exhaustive] — future variant additions will be semver-breaking #144

@obchain

Description

@obchain

Refs #39

File: crates/charon-core/src/types.rs (FlashLoanSource), crates/charon-core/src/flashloan.rs, crates/charon-flashloan/src/

Problem

FlashLoanSource in types.rs already lacks #[non_exhaustive] (flagged in PR #27 review, not yet fixed). PR #39 introduces FlashLoanQuote and likely additional enums in charon-flashloan. Any pub enum in a library crate that may gain variants in future milestones must carry #[non_exhaustive] from its first commit. Adding the attribute later is a semver-breaking change: existing exhaustive match arms become compile errors in downstream crates.

FlashLoanSource already has BalancerV2 and UniswapV3 variants with no adapters implemented — the design explicitly anticipates future variants. All match arms on it are currently exhaustive by accident.

Fix

Add #[non_exhaustive] to:

  • FlashLoanSource in crates/charon-core/src/types.rs
  • Any pub enum introduced by this PR in charon-flashloan/src/ or charon-core/src/flashloan.rs

If FlashLoanQuote is a struct, ensure all fields are pub so downstream crates can construct it, or provide a builder — #[non_exhaustive] on structs blocks struct-literal construction outside the crate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinglayer:rustRust crates (core / scanner / protocols / executor / cli)priority:p2-polishNice-to-have / polish

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions