ApeWorX / ape

The smart contract development tool for Pythonistas, Data Scientists, and Security Professionals
https://apeworx.io
Apache License 2.0
866 stars 133 forks source link

Bug: Account discrepancy when using different envs with different account plugins #655

Open antazoey opened 2 years ago

antazoey commented 2 years ago

Environment information

Env agnostic.

What went wrong?

Imagine this scenario:

  1. Create a virtual environment where you have ledger plugin installed.
  2. Create an account in the ledger plugin named "main"
  3. Create a separate virtual environment where you have the trezor plugin installed (and not the ledger)
  4. Create an accounts in the trezor plugin also named "main"
  5. Now, install the ledger plugin....

Notice the following:

  1. You now have two accounts with the same alias
  2. When you load this account, you get the first one it finds.

How can it be fixed?

the following would help:

  1. Have a way to rename account aliases
  2. Define .ape/plugin directory to specifcy it is for accounts and be smarter about checking for already-used aliases
  3. Warn when installing a plugin that already has accounts with the same alias installed
fubuloubu commented 2 years ago
  1. Have a way to rename account aliases

This would be handy, maybe CLI method under ape accounts?

  1. Define .ape/plugin directory to specifcy it is for accounts and be smarter about checking for already-used aliases

How do you mean?

  1. Warn when installing a plugin that already has accounts with the same alias installed

Yes, I think all account plugins should be checking against the global aliases list before adding, probably doesn't have that behavior currently which is the problem here.

antazoey commented 10 months ago

Yes, I think all account plugins should be checking against the global aliases list before adding, probably doesn't have that behavior currently which is the problem here.

It does do this, however aliases with missing plugins don't get checked, so it just needs to adjust to check for those somehow

edit: that is actually impossible to check for