Skip to content

Spike: Reconcile the two divergent TrustFlow contract implementations #56

Description

@meshackyaro

Description

contracts/src/{dispute,settlement,governance,oracle,fee,storage,types,events,errors}.rs is presented in the README's "Project Structure" section as the canonical contract source tree, but it was explicitly excluded from the Cargo workspace in commit 419c01d ("Fix workspace members to exclude contracts/src") and isn't compiled or deployed — contracts/src/lib.rs only declares mod dispute; mod errors; mod storage; mod types;, so settlement.rs, governance.rs, oracle.rs, fee.rs, and events.rs aren't even reachable from that.

Meanwhile the actually-deployed contract, contracts/trustflow/src/lib.rs, implements its own dispute/escrow logic that diverges from the orphaned tree — e.g. the orphaned settlement.rs deducts a FeeBps fee on release, while the live trustflow contract has no fee logic at all.

It's unclear whether contracts/src/ is dead code left over from a prior structure that should be deleted, or a rewrite-in-progress that was paused mid-migration and needs to be finished and swapped in. Either way, the diverging business rules (fees, governance, oracle pricing) need to be reconciled before anyone can trust either tree as the source of truth.

Component

Contract

Difficulty

🟣 Spike — investigation required, scope not yet defined

Tasks

  • Git-archaeology contracts/src/ — when it was last actively developed, and whether 419c01d was a deliberate pause or an oversight
  • Diff the business logic between contracts/src/settlement.rs/governance.rs/oracle.rs/fee.rs and the equivalent logic in contracts/trustflow/src/lib.rs
  • Decide: delete the orphaned tree, or resume it as the intended rewrite (and if so, scope what's left to finish)
  • If keeping the fee/governance/oracle model, reconcile it with the live contract's current behavior (which has no fee logic today)

Acceptance Criteria

  • A written recommendation: delete vs. resume contracts/src/, with rationale
  • A reconciled statement of the intended fee/governance/oracle model going forward
  • Follow-up implementation issue(s) filed (either "remove dead code" or "finish migration to contracts/src")
  • Any blocking unknowns flagged

Estimated Time

1-2 days (time-boxed spike)

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26difficulty: spikeResearch/investigation issue — scope and approach are not yet definedpriority: highHigh priority issuequestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions