-
Notifications
You must be signed in to change notification settings - Fork 112
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
Many miner and oracle improvements #985
Conversation
1f3d498
to
6ad5dd8
Compare
Take this off draft whenever you're ready and I'll give it another read-through. |
e1fe101
to
28709cc
Compare
c69565b
to
7657238
Compare
909713c
to
a6b2ca7
Compare
1e20d75
to
9476417
Compare
9476417
to
f2f1ae8
Compare
@@ -74,7 +74,6 @@ process.env.SOLIDITY_COVERAGE | |||
}); | |||
|
|||
beforeEach(async () => { | |||
await goodClient.resetDB(); | |||
await goodClient.initialise(colonyNetwork.address); | |||
|
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.
No resetDB
here?
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.
Wait, am I confusing myself?
https://github.com/JoinColony/colonyNetwork/pull/985/files#r702122227
There's a lot of medium sized things in this PR, but they're all around the reputation miner/oracle.
More performant version of SQLite
Migrated to Better SQLite which does a much better job of showing off why it's good on the linked GitHub page than I do.
More performant use of SQLite
We now use only one connection to the database which is left open, rather than opening and closing the file for every request, and also use prepared queries for improved performance. By not repeatedly opening and closing the file we remove the possibility of collisions, which we were starting to see as more people use the app.
Cache relevant responses
Requested reputation proofs corresponding to a particular user / reputation / state combination are now cached for an hour. This duration was chosen to match the mining cycle length - the majority of requests are for a particular reputation in the current state, which only lasts for an hour, and so caching for longer seems only very occasionally relevant (e.g. caching a reputation proof involved in a vote would be useful).
New oracle endpoints
I've added an oracle endpoint to return all reputations that a user has in a colony. It's at
:reputationRootHash/:colonyAddress/all/:userAddress
, intended to align with the endpoint used for a reputation proof for a specific reputation. It is required to implement this GUI element in a sensible way (i.e. without querying the oracle for every reputation a user could possibly have):There is also now an endpoint for a single user's reputation in a state that ends with
/noProof
, which in the case where only the value is not required, should be much faster (as the entire reputation state doesn't have to be loaded).Improve oracle and miner reliability with unreliable endpoints
The ability to use multiple endpoints through Ether's Fallback Provider. We're using a wrapped version of it, that in the event of a failed request will retry it up to ten times (the default of the
exponential-backoff
npm package.This version of the miner is current running on QA. There may be further tweaks/improvements/adjustments as I see it fail in new and more interesting ways, but there's enough here to start getting feedback on. By creating a branch/PR it also means the frontend team can use it, and continue development using the new oracle endpoint.