Skip to content

(VDB-1075) deny event transformer#82

Merged
gslaughl merged 1 commit intostagingfrom
vdb-1075-deny
Jan 2, 2020
Merged

(VDB-1075) deny event transformer#82
gslaughl merged 1 commit intostagingfrom
vdb-1075-deny

Conversation

@gslaughl
Copy link
Copy Markdown
Contributor

This PR attempts to use the same transformer across all contracts' deny events, despite Vat's LogNote events being shaped slightly differently.

Copy link
Copy Markdown
Contributor

@elizabethengelman elizabethengelman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😺 just a couple of questions/small things, but LGTM!

repository = "github.com/makerdao/vdb-mcd-transformers"
migrations = "db/migrations"
contracts = ["MCD_CAT", "MCD_FLAP", "MCD_FLIP_ETH_A", "MCD_FLIP_BAT_A", "MCD_FLIP_SAI", "MCD_FLOP", "MCD_JUG",
"MCD_POT", "MCD_SPOT", "MCD_VOW", "OSM_ETH", "OSM_BAT"]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I may not be looking at this right, but it doesn't look like Osm implementation of deny doesn't have a note modifier, so I don't think it would emit a log event, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, maybe I'm looking in the wrong place? Is this the correct OSM implementation?

https://github.com/makerdao/osm/blob/master/src/osm.sol#L39

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking in etherscan, I can see that the contract at the address specified in the changelog doesn't have the note modifier, so you're totally right. Wish I could figure out how to get from a release to that version's OSM contract in GitHub though 🤔

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the way that contract versions in dss-deploy-scripts was changed as of 2.16. Instead of looking in the contracts directory for, we now can look at the .dapp.json file which includes the revision for the dss, osm and cdp_manager repos.

Copy link
Copy Markdown
Contributor

@elizabethengelman elizabethengelman Jan 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For osm, here's the revision that was used for 2.17: sky-ecosystem/osm@504c474. And it looks like the note modifier was added in release 1.0.1 🎉

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, that's super helpful!

}

contractAddress := log.Log.Address.String()
contractAddressID, contractAddressErr := shared.GetOrCreateAddress(contractAddress, db)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

}

func (c Converter) ToModels(_ string, logs []core.HeaderSyncLog, db *postgres.DB) ([]event.InsertionModel, error) {
numTopicsRequired := shared.ThreeTopicsRequired + c.LogNoteArgumentOffset
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The LogNoteArgumentOffset is so that we can use the same ToModels method for all deny methods right? And then just pass the offset for the Vat deny events?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah exactly. I considered implementing this field differently, like making it a boolean indicating whether the transformer is watching the Vat contract, but I felt like this way gave a more precise description of how the value is being used.

})
})

func denyIntegrationTest(blockNumber int64, contractAddressHex, usrAddressHex string, logNoteArgumentOffset int) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥇

)

Context("Cat deny events", func() {
denyIntegrationTest(int64(14764643), test_data.CatAddress(), "0x13141b8a5e4a82ebc6b636849dd6a515185d6236", defaultOffset)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super small, but I wonder if we could "0x13141b8a5e4a82ebc6b636849dd6a515185d6236" out into a var?

@gslaughl gslaughl force-pushed the vdb-1075-deny branch 2 times, most recently from bd01e82 to ef40476 Compare January 2, 2020 01:59
@gslaughl gslaughl merged commit decc928 into staging Jan 2, 2020
@gslaughl gslaughl deleted the vdb-1075-deny branch January 2, 2020 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants