In giveLoan functions of Lender.sol, when pool lender giving the loan of it's pool to another pool then auctionLength inside transferred loan is not updated according to new pool unlike other variables lender and interestRate. Because of this pool and loan struct's auctionLength value will be different, and this loan's auctionLength value will be according to it's old pool from where that loan is transferred using giveLoan function. Surely it is not the intended behaviour of giveLoan function.
Same auctionLengthis not updated inside buyLoan function also.
In giveLoan function, loan is transferred from old pool to new pool by old pool's lender. But in giveLoan function updating of auctionLength for transferred loan is missing. It is for all those loanIds which were passed in giveLoan function. All loans will have their old Pool auctionLength value which is neither intended behaviour from this function nor is good for lenders of new pools
where passed loanIds loans is transferred respectively. Each one for loop iteration for 1 loan transfer to their new pool respectively.
Note: For full function code check above hyperlinks on the code
Lender start auction by calling startAuction function for those loans whom he wants to auction.
In buyLoan function loan.auctionLength used so if loan holds wrong value of auctionLength then auction will not last according to current lender of loan.
https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Lender.sol#L471
Inside buyLoan function auctionLength also not updated.
After giveLoan function execution, whenever in future new lender will call startAuction to start the auction then the auction will last according to old Pool auctionLength not new pool where the loan is currently present. Because in buyLoan function, auction length is decided based on auctionLength value present inside loan(line 471) not it's current Pool and loan is holding auctionLength value of old pool that's not intended behaviour for new pool lender and creates confusion.
Same for buyLoan function.
Manual Review
Inside giveLoan function update auctionLength also for transferred loan as lender and interestRate are updated according to new pool where the loan is transferred using buyLoan function inside for loop. So it will be updated for all passed loanIds.
Same like this update auctionLength inside buyLoan function also.
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.