-
Notifications
You must be signed in to change notification settings - Fork 1
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
Track colony versions in the database #4
Conversation
fe68498
to
ca3020b
Compare
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.
LGTM 👍
src/eventProcessor.ts
Outdated
|
||
await mutate('setCurrentVersion', { | ||
input: { | ||
key: 'colony', |
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.
Only suggestion would be moving this to a constant e.g COLONY_VERSION_KEY and referencing key: COLONY_VERSION_KEY
Note: This has to be merged after JoinColony/colonyCDapp#163 |
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.
Vert nice work yet again. I've left a comment but it's not something that needs to be done now.
* Function writing the highest colony version currently available in the network to the database | ||
* Subsequent changes to available version are handled in eventProcessor | ||
*/ | ||
const writeCurrentNetworkColonyVersion = async (): Promise<void> => { |
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.
I think it will be useful to write the latest version for colonies (and extensions) to the stats file as well.
This will help with checks once we get in production.
However, this will add some complexity, as you'll also need to add the logic of fetching the latest version when the ingestor starts initially.
In a effort to cut down on dev time, so we can actually make the end of february relese, I think we need to skip this for now
(but maybe create a issue for this so we can add it in at a later date)
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.
Opened #9
Description
This PR adds two concepts of tracking colony version:
To achieve 1), we listen to the
ColonyVersionAdded
event and utilise the existingCurrentVersion
model already used for tracking highest available extension versions:For extensions,
key
represents the extension hash, in case of colonies, since there's only one type to track,key
is set tocolony
string.Additionally, we write the current highest version to the db on ingestor startup.
For 2), there is a new
version
field on Colony model that gets updated onColonyUpgraded
event. In the corresponding CDapp PR, you'll see the field added to the schema as well as colony creation mutation modified to include it.Testing
Common steps
git checkout feat/102-track-colony-version
npm run dev
.npm run dev
.node scripts/temp-create-data.js
Storing the current colony version on ingestor start
listCurrentVersions
query, e.g.:You should see an entry with key
colony
andversion
set to 10.Storing the colony version when new version is added to network
npm run truffle console
and paste the following code line-by-line:You should see some logs in block-ingestor confirming it has picked up the event and if you run the
listCurrentVersions
query again, you should see the colony version updated.Tracking the individual colony version when colony is upgraded
listCurrentVersions
query. You should see an entry with key0x3a157280ca91bB49dAe3D1619C55Da7F9D4438c3
which is the address of the first dev colony (and the one we will be upgrading in the next step). Its version should be 10.npm run truffle console
, paste the code from the previous steps and add the following:Again, you should see some logs in block-ingestor console. Run
listCurrentVersions
again to verify that the colony version has been updated in the database.