anchor
anchor copied to clipboard
fix anchor keys list command
Problem
the flag anchor keys listis intended to show (or generate if not exists) the current program pubkeys
However, since it's not ensured that the current working directory is always the top level, the behavior is not desired since it will try to create a new target folder in the invoking path
Solution
move the function to the with_workspace closure
@skrrb is attempting to deploy a commit to the 200ms Team on Vercel.
A member of the Team first needs to authorize it.
This seems like a pretty clean fix / change to how the workspace error is triggered.
I wasn't really sure how to replicate the original buggy behaviour it's not ensured that the current working directory is always the top level, namely whatever exactly this means.
But it still looks ok, and if someone else using anchor keys list comes and complains this new behaviour messes up their program call we can just revert this PR.
This seems like a pretty clean fix / change to how the workspace error is triggered.
I wasn't really sure how to replicate the original buggy behaviour
it's not ensured that the current working directory is always the top level,namely whatever exactly this means.But it still looks ok, and if someone else using
anchor keys listcomes and complains this new behaviour messes up their program call we can just revert this PR.
oh, I'm sorry it was not clear what I mean. the issue is that if you run $ anchor keys list on any folder inside an anchor workspace, it will try to create a new target/deploy/keypair.json file instead of moving to the root of the workspace which is where right target dir is placed. For example:
$ anchor init dummy
dummy initialized
$ cd dummy/programs/dummy/src
$ ls
lib.rs
$ anchor keys list
dummy: 3XrRRGbzexwfVKjwK6cufHN1cAuRrahX1DCd2cFkANq2
$ ls
lib.rs target
^^^^^^ this folder should not exist