(VDB-1039) Add pot join event transformer#68
Conversation
transformers/test_data/pot_join.go
Outdated
| common.HexToHash("0x049878f300000000000000000000000000000000000000000000000000000000"), | ||
| common.HexToHash("0x000000000000000000000000e7bc397dbd069fc7d0109c0636d06888bb50668c"), | ||
| common.HexToHash("0x000000000000000000000000000000000000000000000000417fa3222791bd1a"), | ||
| common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"), |
There was a problem hiding this comment.
These topics are from a real kovan event (the one used in integration tests), and I just thought it was weird how it has 3 topics even though we're only expecting 2. I'm probably missing some subtlety of solidity, but it seemed worth mentioning
There was a problem hiding this comment.
I think this is because LogNote always includes 4 topics, regardless of how many topics are actually used by an individual note modifier. Hopefully we could (theoretically) omit this field and everything would still behave correctly.
There was a problem hiding this comment.
Yeah everything does seem to work correctly if we omit the 3rd and 4th topics, but the part that seemed weird to me was that the 3rd topic isn't empty. In other events shaped the same way (e.g. vat heal events), the 3rd and 4th topics are all zeroes, like the 4th one is here.
There was a problem hiding this comment.
Oh wait I think topics[2] is the wad value we want. Pretty sure topics[1] is the msg.sender: https://github.com/makerdao/dss/blob/master/src/lib.sol#L37
transformers/test_data/pot_join.go
Outdated
| common.HexToHash("0x049878f300000000000000000000000000000000000000000000000000000000"), | ||
| common.HexToHash("0x000000000000000000000000e7bc397dbd069fc7d0109c0636d06888bb50668c"), | ||
| common.HexToHash("0x000000000000000000000000000000000000000000000000417fa3222791bd1a"), | ||
| common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"), |
There was a problem hiding this comment.
I think this is because LogNote always includes 4 topics, regardless of how many topics are actually used by an individual note modifier. Hopefully we could (theoretically) omit this field and everything would still behave correctly.
transformers/test_data/pot_join.go
Outdated
| var rawPotJoinLog = types.Log{ | ||
| Address: common.HexToAddress(PotAddress()), | ||
| Topics: []common.Hash{ | ||
| common.HexToHash("0x049878f300000000000000000000000000000000000000000000000000000000"), |
There was a problem hiding this comment.
Totally nbd but I think we conventionally populate topic0 with the signature from the constants. Can't think of any reason that matters other than consistency, though
| func TestPotJoin(t *testing.T) { | ||
| RegisterFailHandler(Fail) | ||
| RunSpecs(t, "PotJoin Suite") | ||
| } |
There was a problem hiding this comment.
I was going to say we should logrus.SetOutput(ioutil.Discard), but that actually doesn't seem necessary. I wonder if we can delete this from other places if transformers are just converters and converters aren't logging? 🤔
e7f90af to
279ad2a
Compare
279ad2a to
ea28f60
Compare
No description provided.