Skip to content
This repository was archived by the owner on Jul 11, 2019. It is now read-only.
This repository was archived by the owner on Jul 11, 2019. It is now read-only.

Consider indexing contractName for the ImplementationChanged event of ImplementationDirectory #199

@facuspagnuolo

Description

@facuspagnuolo

We've been discussing with @frangio the idea of indexing the contractName field of the ImplementationChanged event for the ImplementationDirectory 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 a contractName in order to filter events by the indexed field. Then, we have two alternatives:

  1. Emitting a new event to register the hash of a contractName, we should do this only once per contractName. E.g.: event ContractName(string index hash, string contractName)

  2. 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 a contractName could be unset, we should store whether we have emitted said event for a contractName or not. For example, adding a new mapping like mapping (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 like mapping (string => bytes32) contractNameHashes to store the hash for every contractName. 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..

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind:discussionTo discuss on a task before implementing itkind:enhancementAn upgrade or a new feature that improves the system

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions