Skip to content

quicklendx-contracts does not compile on main (broken merge of #1451: recompute_investor_tier / compute_investor_tier) #1601

Description

@giftexceed

Summary

The quicklendx-contracts crate does not compile on main (currently cac37b5f) — neither for the native host nor the wasm32-unknown-unknown target. cargo check reports 19 errors; cargo build --target wasm32-unknown-unknown --release reports 18. This blocks CI for every PR against main.

The breakage traces to the merge of #1451 (f9462647, feat(investor-kyc): deterministic recompute_investor_tier…), which appears to have been merged in a non-compiling state.

Root cause

#1451 renamed the 3-arg wrapper determine_investor_tier(env, investor, risk_score) to compute_investor_tier, and changed its body (and other call sites) to call a 4-arg deterministic compute_investor_tier(total_invested, successful_investments, defaulted_investments, risk_score). That 4-arg function was never defined, and you cannot have both a 3-arg and a 4-arg compute_investor_tier (Rust has no overloading). Additionally, recompute_investor_tier was duplicated verbatim in two files.

Errors (deduplicated)

  • Duplicate recompute_investor_tiersrc/lib.rs:1962 & 1972 (identical), and src/verification.rs:1481 & 1536 (identical). This also cascades into ~8 macro errors at the #[contractimpl] on src/lib.rs:392 (E0034/E0428×4/E0592×3).
  • Missing 4-arg compute_investor_tiercompute_investor_tier at src/verification.rs:1240 has a 3-arg signature (env, investor, risk_score) but its body (:1248) and recompute_investor_tier (:1510, :1565) and update_investor_analytics (:1364) call it with 4 args → E0061 ×4.
  • Unresolved determine_investor_tier — imported at src/lib.rs:275 and called at src/verification.rs:1119, but no longer exists (renamed) → E0432 + E0425.
  • PlatformFeeConfig is privatesrc/lib.rs:270 imports it from profits, but it is not pub → E0603.
  • Dispute initializer missing resolution_outcomesrc/lib.rs:3285 constructs Dispute { … } without the resolution_outcome: Option<DisputeResolution> field (defined at src/types.rs:128) → E0063.

Proposed fix

  1. Keep determine_investor_tier(env, investor, risk_score) as the 3-arg wrapper (revert the rename), restoring the lib.rs import and the verification.rs:1119 call site.
  2. Add the missing 4-arg deterministic compute_investor_tier(total_invested, successful_investments, defaulted_investments, risk_score) -> Result<InvestorTier> implementing the threshold table documented in the feat(investor-kyc): deterministic recompute_investor_tier, public ent… #1451 doc-comment (VIP/Platinum/Gold/Silver/Basic by risk score, total invested, successful investments, and max default rate). The wrapper delegates to it.
  3. Remove the duplicate recompute_investor_tier definitions in lib.rs and verification.rs.
  4. Make PlatformFeeConfig pub in profits.rs.
  5. Add resolution_outcome to the Dispute initializer at lib.rs:3285.

Steps 1, 3, 4, 5 are mechanical. Step 2 reconstructs logic lost in the merge (including the default-rate thresholds), so it needs sign-off from the #1451 author on the intended tier semantics.

Repro

cd quicklendx-contracts
cargo check                                              # 19 errors
cargo build --target wasm32-unknown-unknown --release   # 18 errors

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions