Skip to content
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.

No such file or directory: 'artifacts/Account.json' when querying transaction #309

Closed
ericglau opened this issue Nov 25, 2022 · 1 comment · Fixed by #315
Closed

No such file or directory: 'artifacts/Account.json' when querying transaction #309

ericglau opened this issue Nov 25, 2022 · 1 comment · Fixed by #315
Assignees
Labels
bug Something isn't working
Milestone

Comments

@ericglau
Copy link
Member

From a new project generated by nile init, run nile node then nile declare PRIVATE_KEY contract. This fails with the below which is the same as step 6 of #308.

🚀 Deploying Account
⏳ ️Deployment of Account successfully sent at 0x02e2adf85e7439821a4f15e61558a116ac89a82f28dcf98fc9d74aab740c59ec
🧾 Transaction hash: 0x6e12304cf4b97cfc0530637a4c563180a84d4a109307574967490013205c4be
📦 Registering 0x02e2adf85e7439821a4f15e61558a116ac89a82f28dcf98fc9d74aab740c59ec in localhost.deployments.txt
Traceback (most recent call last):
  File "/Users/eric/git/nileproj3/env/bin/nile", line 8, in <module>
    sys.exit(cli())
  File "/Users/eric/git/nileproj3/env/lib/python3.9/site-packages/asyncclick/core.py", line 1157, in __call__
    return anyio.run(self._main, main, args, kwargs, **opts)
  File "/Users/eric/git/nileproj3/env/lib/python3.9/site-packages/anyio/_core/_eventloop.py", line 70, in run
    return asynclib.run(func, *args, **backend_options)
  File "/Users/eric/git/nileproj3/env/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 292, in run
    return native_run(wrapper(), debug=debug)
  File "/opt/homebrew/Cellar/python@3.9/3.9.15/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/opt/homebrew/Cellar/python@3.9/3.9.15/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete
    return future.result()
  File "/Users/eric/git/nileproj3/env/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 287, in wrapper
    return await func(*args)
  File "/Users/eric/git/nileproj3/env/lib/python3.9/site-packages/asyncclick/core.py", line 1160, in _main
    return await main(*args, **kwargs)
  File "/Users/eric/git/nileproj3/env/lib/python3.9/site-packages/asyncclick/core.py", line 1076, in main
    rv = await self.invoke(ctx)
  File "/Users/eric/git/nileproj3/env/lib/python3.9/site-packages/asyncclick/core.py", line 1687, in invoke
    return await _process_result(await sub_ctx.command.invoke(sub_ctx))
  File "/Users/eric/git/nileproj3/env/lib/python3.9/site-packages/asyncclick/core.py", line 1434, in invoke
    return await ctx.invoke(self.callback, **ctx.params)
  File "/Users/eric/git/nileproj3/env/lib/python3.9/site-packages/asyncclick/core.py", line 780, in invoke
    rv = await rv
  File "/Users/eric/git/nileproj3/env/lib/python3.9/site-packages/nile/cli.py", line 176, in declare
    account = await Account(signer, network)
  File "/Users/eric/git/nileproj3/env/lib/python3.9/site-packages/nile/core/account.py", line 40, in __new__
    await instance.__init__(*a, **kw)
  File "/Users/eric/git/nileproj3/env/lib/python3.9/site-packages/nile/core/account.py", line 104, in __init__
    assert type(self.address) == int
AssertionError

Then run nile declare PRIVATE_KEY contract again. This causes an error with No such file or directory: 'artifacts/Account.json' which occurs when the command is querying the transaction. (This also occurs when you run nile status 0x072757b6b4922caeb0d478481635494d88d4be03386f3cffbe1858f00974145)

🚀 Declaring contract
⏳ Successfully sent declaration of contract as 0x072757b6b4922caeb0d478481635494d88d4be03386f3cffbe1858f00974145
🧾 Transaction hash: 0x2f9325203a92187e342565810d368c164a2790e9e51c73e469bc6a8625a28cf
📦 Registering 0x072757b6b4922caeb0d478481635494d88d4be03386f3cffbe1858f00974145 in localhost.declarations.txt
⏳ Querying the network for transaction status...
❌ Transaction status: REJECTED
🧾 Found contracts: ['0x02e2adf85e7439821a4f15e61558a116ac89a82f28dcf98fc9d74aab740c59ec:artifacts/Account.json']
⏳ Querying the network with identified contracts...
Traceback (most recent call last):
  File "/Users/eric/git/nileproj3/env/bin/nile", line 8, in <module>
    sys.exit(cli())
  File "/Users/eric/git/nileproj3/env/lib/python3.9/site-packages/asyncclick/core.py", line 1157, in __call__
    return anyio.run(self._main, main, args, kwargs, **opts)
  File "/Users/eric/git/nileproj3/env/lib/python3.9/site-packages/anyio/_core/_eventloop.py", line 70, in run
    return asynclib.run(func, *args, **backend_options)
  File "/Users/eric/git/nileproj3/env/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 292, in run
    return native_run(wrapper(), debug=debug)
  File "/opt/homebrew/Cellar/python@3.9/3.9.15/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/opt/homebrew/Cellar/python@3.9/3.9.15/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete
    return future.result()
  File "/Users/eric/git/nileproj3/env/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 287, in wrapper
    return await func(*args)
  File "/Users/eric/git/nileproj3/env/lib/python3.9/site-packages/asyncclick/core.py", line 1160, in _main
    return await main(*args, **kwargs)
  File "/Users/eric/git/nileproj3/env/lib/python3.9/site-packages/asyncclick/core.py", line 1076, in main
    rv = await self.invoke(ctx)
  File "/Users/eric/git/nileproj3/env/lib/python3.9/site-packages/asyncclick/core.py", line 1687, in invoke
    return await _process_result(await sub_ctx.command.invoke(sub_ctx))
  File "/Users/eric/git/nileproj3/env/lib/python3.9/site-packages/asyncclick/core.py", line 1434, in invoke
    return await ctx.invoke(self.callback, **ctx.params)
  File "/Users/eric/git/nileproj3/env/lib/python3.9/site-packages/asyncclick/core.py", line 780, in invoke
    rv = await rv
  File "/Users/eric/git/nileproj3/env/lib/python3.9/site-packages/nile/cli.py", line 177, in declare
    await account.declare(
  File "/Users/eric/git/nileproj3/env/lib/python3.9/site-packages/nile/core/account.py", line 170, in declare
    return await declare(
  File "/Users/eric/git/nileproj3/env/lib/python3.9/site-packages/nile/core/declare.py", line 50, in declare
    tx_status = await status(tx_hash, network, watch_mode)
  File "/Users/eric/git/nileproj3/env/lib/python3.9/site-packages/nile/utils/status.py", line 43, in status
    error_message = await debug_message(
  File "/Users/eric/git/nileproj3/env/lib/python3.9/site-packages/nile/utils/debug.py", line 42, in debug_message
    return await execute_call(
  File "/Users/eric/git/nileproj3/env/lib/python3.9/site-packages/nile/starknet_cli.py", line 30, in execute_call
    return await capture_stdout(cmd(args=args, command_args=command_args))
  File "/Users/eric/git/nileproj3/env/lib/python3.9/site-packages/nile/starknet_cli.py", line 47, in capture_stdout
    await func
  File "/Users/eric/git/nileproj3/env/lib/python3.9/site-packages/starkware/starknet/cli/starknet_cli.py", line 441, in tx_status
    contracts[addr] = Program.load(data=json.load(open(path.strip()))["program"])
FileNotFoundError: [Errno 2] No such file or directory: 'artifacts/Account.json'
@ericnordelo
Copy link
Member

These lines in starknet_cli.py don't consider that we have precompiled artifacts, like Account.json, and this should be treated separately.

# The rest of the arguments require unique handling
if kwargs.get("contract_name"):
base_path = (
kwargs.get("overriding_path")
if kwargs.get("overriding_path")
else (BUILD_DIRECTORY, ABIS_DIRECTORY)
)
contract = f"{base_path[0]}/{kwargs.get('contract_name')}.json"
command_args.append("--contract")
command_args.append(contract)

This is a bug in the current implementation. Status command for transactions going through accounts won't work because it won't find the precompiled Account artifact..

@ericnordelo ericnordelo added the bug Something isn't working label Nov 28, 2022
@ericnordelo ericnordelo added this to the current milestone Nov 28, 2022
@ericnordelo ericnordelo moved this to 📋 Backlog in Cairo team Nov 28, 2022
@martriay martriay moved this from 📋 Backlog to 👀 In review in Cairo team Dec 5, 2022
Repository owner moved this from 👀 In review to ✅ Resolved in Cairo team Dec 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
No open projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants