-
Notifications
You must be signed in to change notification settings - Fork 4
Add integrate recent participants contract #355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add integrate recent participants contract #355
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC, we were discussing a different approach in the past:
- spark-evaluate creates a JSON object linking to measurement commitments included in the evaluation plus the evaluation outcomes
- spark-evaluate uploads this JSON object to web3storage and commits the CID of this JSON object to the smart contract
- the smart contract emits an event with the round index and evaluation commitment CID
- spark-stats listens for these events, downloads the evaluation results & linked measurements, and runs data analysis & aggregation over the data obtained this way
I'd rather avoid creating many smart contract methods & events individually for each stats field like "recent participants" because it would be a lot of work, IMO.
In particular, if we are interested in recent participants only, then I don't think we need a new contract for that - we can find the participant addresses either in the committed measurements or in the history of setScores
calls.
export const createMeridianContract = (contractAddress = SparkImpactEvaluator.ADDRESS) => { | ||
return new ethers.Contract( | ||
contractAddress, | ||
SparkImpactEvaluator.ABI, | ||
provider | ||
) | ||
} | ||
|
||
export const recentParticipantsContract = new ethers.Contract( | ||
SparkEvaluationsRecentParticipants.ADDRESS, | ||
SparkEvaluationsRecentParticipants.ABI, | ||
provider | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you know why we need a factory function for the meridian contract (createMeridianContract
)? I find it surprising that there isn't a factory function for "recent participants" contract as well.
https://github.com/filecoin-station/spark-evaluations-recent-participants
Also added a refactor of
ie-contract.js
, while I was there.