Ackee-Blockchain / wake

Wake is a Python-based Solidity development and testing framework with built-in vulnerability detectors
https://ackee.xyz/wake/docs/latest/
ISC License
228 stars 28 forks source link

Migration to wake fails when vscode / tools for solidity is running #288

Open DrakeEvans opened 9 months ago

DrakeEvans commented 9 months ago

I got two errors when migrating which seemed to resolve after I killed vscode

The first wake lsp --port 64193 ╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮ │ /opt/homebrew/bin/wake:8 in │ │ │ │ 5 from wake.cli.main import main │ │ 6 if name == 'main': │ │ 7 │ sys.argv[0] = re.sub(r'(-script.pyw|.exe)?$', '', sys.argv[0]) │ │ ❱ 8 │ sys.exit(main()) │ │ 9 │ │ │ │ /opt/homebrew/lib/python3.11/site-packages/click/core.py:1130 in call │ │ │ │ 1127 │ │ │ 1128 │ def call(self, *args: t.Any, kwargs: t.Any) -> t.Any: │ │ 1129 │ │ """Alias for :meth:main.""" │ │ ❱ 1130 │ │ return self.main(args, kwargs) │ │ 1131 │ │ 1132 │ │ 1133 class Command(BaseCommand): │ │ │ │ /opt/homebrew/lib/python3.11/site-packages/rich_click/rich_command.py:126 in main │ │ │ │ /opt/homebrew/lib/python3.11/site-packages/click/core.py:1654 in invoke │ │ │ │ 1651 │ │ │ │ cmd_name, cmd, args = self.resolve_command(ctx, args) │ │ 1652 │ │ │ │ assert cmd is not None │ │ 1653 │ │ │ │ ctx.invoked_subcommand = cmd_name │ │ ❱ 1654 │ │ │ │ super().invoke(ctx) │ │ 1655 │ │ │ │ sub_ctx = cmd.make_context(cmd_name, args, parent=ctx) │ │ 1656 │ │ │ │ with sub_ctx: │ │ 1657 │ │ │ │ │ return _process_result(sub_ctx.command.invoke(sub_ctx)) │ │ │ │ /opt/homebrew/lib/python3.11/site-packages/click/core.py:1404 in invoke │ │ │ │ 1401 │ │ │ echo(style(message, fg="red"), err=True) │ │ 1402 │ │ │ │ 1403 │ │ if self.callback is not None: │ │ ❱ 1404 │ │ │ return ctx.invoke(self.callback, ctx.params) │ │ 1405 │ │ │ 1406 │ def shell_complete(self, ctx: Context, incomplete: str) -> t.List["CompletionItem"]: │ │ 1407 │ │ """Return a list of completions for the incomplete value. Looks │ │ │ │ /opt/homebrew/lib/python3.11/site-packages/click/core.py:760 in invoke │ │ │ │ 757 │ │ │ │ 758 │ │ with augment_usage_errors(self): │ │ 759 │ │ │ with ctx: │ │ ❱ 760 │ │ │ │ return callback(args, kwargs) │ │ 761 │ │ │ 762 │ def forward( │ │ 763 │ │ self, cmd: "Command", *args: t.Any, kwargs: t.Any # noqa: B902 │ │ │ │ /opt/homebrew/lib/python3.11/site-packages/click/decorators.py:26 in new_func │ │ │ │ 23 │ """ │ │ 24 │ │ │ 25 │ def new_func(*args, *kwargs): # type: ignore │ │ ❱ 26 │ │ return f(get_current_context(), args, kwargs) │ │ 27 │ │ │ 28 │ return update_wrapper(t.cast(F, new_func), f) │ │ 29 │ │ │ │ /opt/homebrew/lib/python3.11/site-packages/wake/cli/main.py:144 in main │ │ │ │ 141 │ │ │ 142 │ os.environ["PYTHONBREAKPOINT"] = "ipdb.set_trace" │ │ 143 │ │ │ ❱ 144 │ run_xdg_migration() │ │ 145 │ run_woke_wake_migration() │ │ 146 │ │ 147 │ │ │ │ /opt/homebrew/lib/python3.11/site-packages/wake/migrations/xdg_migration.py:52 in │ │ run_xdg_migration │ │ │ │ 49 │ │ else: │ │ 50 │ │ │ raise RuntimeError(f"Platform {system} is not supported.") │ │ 51 │ │ │ ❱ 52 │ global_config_path.mkdir(parents=True, exist_ok=True) │ │ 53 │ global_data_path.mkdir(parents=True, exist_ok=True) │ │ 54 │ │ │ 55 │ if config_path.exists(): │ │ │ │ /opt/homebrew/Cellar/python@3.11/3.11.6/Frameworks/Python.framework/Versions/3.11/lib/python3.11 │ │ /pathlib.py:1116 in mkdir │ │ │ │ 1113 │ │ Create a new directory at this given path. │ │ 1114 │ │ """ │ │ 1115 │ │ try: │ │ ❱ 1116 │ │ │ os.mkdir(self, mode) │ │ 1117 │ │ except FileNotFoundError: │ │ 1118 │ │ │ if not parents or self.parent == self: │ │ 1119 │ │ │ │ raise │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ FileExistsError: [Errno 17] File exists: '/Users/ade/.config/woke/config.toml'

Second Error: wake lsp --port 64193 Moved config file from /Users/ade/.config/Woke/config.toml to /Users/ade/.config/woke/config.toml ✅ Removed old config directory /Users/ade/.config/Woke ✅ Woke is Wake now 🌊🌊 (see more at getwake.io) • Moved old global data directory /Users/ade/.local/share/woke to /Users/ade/.local/share/wake ✅ • Failed to move old solc version file /Users/ade/.local/share/wake/.woke_solc_version to /Users/ade/.local/share/wake/solc-version.txt ❌

michprev commented 9 months ago

@DrakeEvans, thank you for your bug report. I think I've got the first one, preparing a fix (https://github.com/Ackee-Blockchain/wake/commit/b1e9b6d0280bccaeb3b52169db82568e54e9e6fe) right now.

Regarding the second one, there may be different system-level reasons why the file failed to move (file already exists, insufficient permissions, ...).

In general, none of the files/directories in the global config and data paths contain something super important. If the migration fails, you can just remove the problematic file/directory. There's also the migration guide https://ackeeblockchain.com/wake/docs/latest/testing-framework/migrating-from-woke-3/ if you ever need to migrate the configuration files manually.