This repository has been archived by the owner on Jul 11, 2019. It is now read-only.
Consider indexing contractName
for the ImplementationChanged
event of ImplementationDirectory
#199
Labels
kind:discussion
To discuss on a task before implementing it
kind:enhancement
An upgrade or a new feature that improves the system
Milestone
We've been discussing with @frangio the idea of indexing the
contractName
field of theImplementationChanged
event for theImplementationDirectory
contract (see #193 (comment))Following Fran's suggestion, the idea would be to index the
contractName
field and provide a way for clients to retrieve the corresponding hash for acontractName
in order to filter events by the indexed field. Then, we have two alternatives:Emitting a new event to register the hash of a
contractName
, we should do this only once percontractName
. E.g.:event ContractName(string index hash, string contractName)
Adding a public method to retrieve the hash of a
contractName
.If we go with
1.
, to make sure we emit this event only once per contract name, given acontractName
could be unset, we should store whether we have emitted said event for acontractName
or not. For example, adding a new mapping likemapping (string => bool) contractNameEmitted
. And, every time we set a new implementation we should check that field, and update it and emit the event when needed.If we go with
2.
, we will need to store this information. For example, adding a new mapping likemapping (string => bytes32) contractNameHashes
to store the hash for everycontractName
. And, every time we set a new implementation we should update the mapping when needed.Summing things up, both solutions are more or less the same, instead of storing a boolean + emitting a new event, we are storing a hash. Both mean a little gas cost increment that everyone will have to pay every time a new implementation is registered. Please correct me if I'm wrong.
Analyzing both alternatives, I think I'd go with
2.
.The text was updated successfully, but these errors were encountered: