Skip to content

[#824] Refactor aliases storage in Cleveland

Diogo Castro requested to merge diogo/#824-refactor-emulator into master

Description

Problem: We're storing aliases in three five places:

  • PureState._psAliases: stores aliases of contracts and implicit accounts (and secret keys of implicit accounts).
  • PureState._psContractsNames: stores aliases of contracts.
  • GState.gsAddressAliases: stores aliases of contracts.
  • PureState._psImplicitAliases: stores aliases (and secret keys) of implicit accounts.
  • PureState._psContractAliases: stores aliases of contracts.
  • PureState._psContractsNames: stores aliases of contracts.
  • GState.gsImplicitAddressAliases: not currently used, it's always empty.
  • GState.gsContractAddressAliases: stores aliases of contracts.

This MR:

  • Stores aliases of implicit accounts in GState.gsImplicitAddressAliases. GState is now the single source of truth for aliases.
  • Deletes PureState._psContractsNames and _psContractAliases as they're entirely redundant.
  • Delete alias data from PureState._psImplicitAliases, replace it with _psSecretKeys :: Map Address SecretKey.~

It also deletes GSAddImplicitAddressAlias, as it's not being used anywhere.

See each commit's message/contents - each of the above steps is done in an individual commit to make it easier to review.

Related issue(s)

Resolves #824 (closed)

Checklist for your Merge Request

Related changes (conditional)

  • Tests (see short guidelines)

    • If I added new functionality, I added tests covering it.
    • If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again.
  • Documentation

    • I checked whether I should update the docs and did so if necessary:
    • I updated changelog files of all affected packages released to Hackage if my changes are externally visible.

Stylistic guide (mandatory)

Edited by Diogo Castro

Merge request reports