The reputation check in CustomerEngine.trigger_demand() is completely ineffective,
allowing customers to trigger demand regardless of the company's reputation score.
This defeats the entire reputation system designed to incentivize good company
behavior.
Normal Behavior: Customers should only be able to trigger demand when company
reputation ≥ 60, creating incentive for companies to maintain good standing
Specific Issue: The reputation is only updated in sell_to_customer(), but this
function is only called AFTER the reputation check passes, creating a logical
circular dependency
Likelihood:
This occurs EVERY TIME a customer attempts to trigger demand, regardless of
company performance
The circular dependency ensures reputation changes can never affect the gating
mechanism
No reputation-based restrictions are ever enforced
Impact:
Complete bypass of the reputation system
No incentive for companies to maintain good reputation
System fairness and economic model completely compromised
Reputation becomes a meaningless metric
EXPLANATION OF POC:
This proof of concept demonstrates the circular dependency by showing:
CustomerEngine.vy: The reputation check happens at the beginning of trigger_demand()
Cyfrin_Hub.vy: The reputation updates happen in sell_to_customer()
Circular Dependency: The check in CustomerEngine happens BEFORE the update in Cyfrin_Hub
Vulnerability: This makes the reputation check completely ineffective because it can
never see updated reputation values
The key insight is that the reputation system is split across two contracts, with the
check happening in one contract before the updates can occur in the other contract.
Explanation of Mitigation
This mitigation fixes the circular dependency by:
Moving reputation check to Cyfrin_Hub.vy: The reputation check now happens in the
same contract where reputation updates occur
Proper ordering in Cyfrin_Hub.vy: Holding costs are applied first, then bankruptcy
check, then reputation check
Removing check from CustomerEngine.vy: Eliminates the circular dependency by
removing the early reputation check
Centralized validation: All validation logic is now in one place, making the
system more maintainable
The key insight is that the reputation check was happening in the wrong contract
(CustomerEngine.vy) before any reputation updates could occur. By moving it to
Cyfrin_Hub.vy where the reputation updates happen, we ensure the check operates
on the current state rather than a stale state.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.
The contest is complete and the rewards are being distributed.