singnet / snet-rfai

Contract for Request for AI service
MIT License
2 stars 9 forks source link

Updated code as per Solidified Audit Report #4

Closed ksridharbabuus closed 5 years ago

ksridharbabuus commented 5 years ago

Updated code as per Solidified Audit Report

raamb commented 5 years ago

@astroseger please review the change.

astroseger commented 5 years ago

My biggest concern is following: As I see you've removed settleFundsAndChangeStatus (which automatically returned funds back) from rejectRequest and closeRequest. Which I'm totally fine with, but it was only one advantage of the current algorithm with limited number of Stakers in respect of proposed solution with unlimited number of Stackers (see https://github.com/singnet/snet-rfai/issues/3).

So, If we don't want to make automatic refunding in rejectRequest and closeRequest, then we could simply implement algorithm proposed in #3 and have unlimited number of Stakers.

As I've explained here https://github.com/ksridharbabuus/RFAI-Contracts/issues/2 we can easily mimic the current contract API for end-user (almost...)

ksridharbabuus commented 5 years ago

@astroseger The main reason for the removal of function settleFundsAndChangeStatus is to avoid the for loops in settling the funds back and to divide the gas consumption across the staking members by their own settlement rather than spent by the Foundation Member or Request Owner (Either Request Owner or Foundation owner can close the request).

Also I have tried with the unlimited staking and voting and we will ran into the gas limits as the array size increases while calling the function. That is one of the main reason I went through the limited number of stakes based on your suggestion.