Closed clacladev closed 2 years ago
Devnet installed with venv and python 3.9 on macOS on M1.
starknet-devnet -v
0.1.19
cairo-compile -v
cairo-compile 0.8.0
hardhat.config.ts
import { HardhatUserConfig } from 'hardhat/types'
import '@shardlabs/starknet-hardhat-plugin'
/**
* @type import('hardhat/config').HardhatUserConfig
*/
const config: HardhatUserConfig = {
starknet: {
venv: 'active',
network: 'devnet',
wallets: {
Deployer: {
accountName: 'DeployerWallet',
modulePath: 'starkware.starknet.wallets.open_zeppelin.OpenZeppelinAccount',
accountPath: '~/.starknet_accounts',
},
Ringo: {
accountName: 'RingoWallet',
modulePath: 'starkware.starknet.wallets.open_zeppelin.OpenZeppelinAccount',
accountPath: '~/.starknet_accounts',
},
Stella: {
accountName: 'StellaWallet',
modulePath: 'starkware.starknet.wallets.open_zeppelin.OpenZeppelinAccount',
accountPath: '~/.starknet_accounts',
},
},
},
networks: {
devnet: {
url: 'http://127.0.0.1:5000/',
},
},
}
export default config
And this is the devnet log when executing the test (2 unit tests):
starknet-devnet \
--dump-on transaction \
--dump-path ~/.starknet_devnet \
--load-path ~/.starknet_devnet
* Running on http://localhost:5000/ (Press CTRL+C to quit)
[2022-03-31 10:55:33,365] ERROR in app: Exception on /gateway/add_transaction [POST]
Traceback (most recent call last):
File "/Users/claudio/.pyenv/versions/3.9.10/lib/python3.9/site-packages/flask/app.py", line 2073, in wsgi_app
response = self.full_dispatch_request()
File "/Users/claudio/.pyenv/versions/3.9.10/lib/python3.9/site-packages/flask/app.py", line 1518, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/Users/claudio/.pyenv/versions/3.9.10/lib/python3.9/site-packages/flask_cors/extension.py", line 165, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
File "/Users/claudio/.pyenv/versions/3.9.10/lib/python3.9/site-packages/flask/app.py", line 1516, in full_dispatch_request
rv = self.dispatch_request()
File "/Users/claudio/.pyenv/versions/3.9.10/lib/python3.9/site-packages/flask/app.py", line 1502, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
File "/Users/claudio/.pyenv/versions/3.9.10/lib/python3.9/site-packages/asgiref/sync.py", line 204, in __call__
return call_result.result()
File "/Users/claudio/.pyenv/versions/3.9.10/lib/python3.9/concurrent/futures/_base.py", line 439, in result
return self.__get_result()
File "/Users/claudio/.pyenv/versions/3.9.10/lib/python3.9/concurrent/futures/_base.py", line 391, in __get_result
raise self._exception
File "/Users/claudio/.pyenv/versions/3.9.10/lib/python3.9/site-packages/asgiref/sync.py", line 270, in main_wrap
result = await self.awaitable(*args, **kwargs)
File "/Users/claudio/.pyenv/versions/3.9.10/lib/python3.9/site-packages/starknet_devnet/server.py", line 43, in add_transaction
contract_address, transaction_hash = await starknet_wrapper.deploy(transaction)
File "/Users/claudio/.pyenv/versions/3.9.10/lib/python3.9/site-packages/starknet_devnet/starknet_wrapper.py", line 137, in deploy
tx_hash = deploy_transaction.calculate_hash(state.general_config)
File "/Users/claudio/.pyenv/versions/3.9.10/lib/python3.9/site-packages/starkware/starknet/services/api/gateway/transaction.py", line 100, in calculate_hash
contract_address = calculate_contract_address(
File "/Users/claudio/.pyenv/versions/3.9.10/lib/python3.9/site-packages/starkware/starknet/services/api/gateway/contract_address.py", line 27, in calculate_contract_address
contract_hash = compute_contract_hash(
File "/Users/claudio/.pyenv/versions/3.9.10/lib/python3.9/site-packages/starkware/starknet/core/os/contract_hash.py", line 63, in compute_contract_hash
return compute_contract_hash_inner(
File "/Users/claudio/.pyenv/versions/3.9.10/lib/python3.9/site-packages/starkware/starknet/core/os/contract_hash.py", line 93, in compute_contract_hash_inner
runner.run(
File "/Users/claudio/.pyenv/versions/3.9.10/lib/python3.9/site-packages/starkware/cairo/common/cairo_function_runner.py", line 141, in run
self.run_from_entrypoint(
File "/Users/claudio/.pyenv/versions/3.9.10/lib/python3.9/site-packages/starkware/cairo/common/cairo_function_runner.py", line 192, in run_from_entrypoint
real_args = self.segments.gen_typed_args(args=args[0])
File "/Users/claudio/.pyenv/versions/3.9.10/lib/python3.9/site-packages/starkware/cairo/lang/vm/memory_segments.py", line 169, in gen_typed_args
for value, field_type in zip(args, args._field_types.values()):
AttributeError: 'contract_hash_full_args' object has no attribute '_field_types'
127.0.0.1 - - [31/Mar/2022 10:55:33] "POST /gateway/add_transaction HTTP/1.1" 500 -
You should be using Python <=3.8.9, as stated here: https://github.com/Shard-Labs/starknet-devnet#requirements The last version of cairo-lang (0.8.0) introduced some features not supported by 3.9 And I believe 3.7 should work as well.
I retested to install everything with python 3.7, which fails to install cairo-lang:
pip install starknet-devnet
Collecting starknet-devnet
Using cached starknet_devnet-0.1.19-py3-none-any.whl (29 kB)
Collecting dill<0.4.0,>=0.3.4
Using cached dill-0.3.4-py2.py3-none-any.whl (86 kB)
Collecting flask-cors<4.0.0,>=3.0.10
Using cached Flask_Cors-3.0.10-py2.py3-none-any.whl (14 kB)
Collecting cairo-lang==0.8.0
Using cached cairo-lang-0.8.0.zip (882 kB)
ERROR: Command errored out with exit status 1:
command: /Users/claudio/Dev/web3/starknet-video-network-poc/hardhat/.venv/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/k3/2cm7mqwd3nqffkdmf0_36vdh0000gn/T/pip-install-9k9q1bxz/cairo-lang/setup.py'"'"'; __file__='"'"'/private/var/folders/k3/2cm7mqwd3nqffkdmf0_36vdh0000gn/T/pip-install-9k9q1bxz/cairo-lang/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/k3/2cm7mqwd3nqffkdmf0_36vdh0000gn/T/pip-pip-egg-info-y1l3xcul
cwd: /private/var/folders/k3/2cm7mqwd3nqffkdmf0_36vdh0000gn/T/pip-install-9k9q1bxz/cairo-lang/
Complete output (11 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/claudio/Dev/web3/starknet-video-network-poc/hardhat/.venv/lib/python3.7/site-packages/setuptools/__init__.py", line 19, in <module>
from setuptools.dist import Distribution
File "/Users/claudio/Dev/web3/starknet-video-network-poc/hardhat/.venv/lib/python3.7/site-packages/setuptools/dist.py", line 34, in <module>
from setuptools import windows_support
File "/Users/claudio/Dev/web3/starknet-video-network-poc/hardhat/.venv/lib/python3.7/site-packages/setuptools/windows_support.py", line 2, in <module>
import ctypes
File "/Users/claudio/.pyenv/versions/3.7.9/lib/python3.7/ctypes/__init__.py", line 7, in <module>
from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named '_ctypes'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
WARNING: You are using pip version 20.1.1; however, version 22.0.4 is available.
You should consider upgrading via the '/Users/claudio/Dev/web3/starknet-video-network-poc/hardhat/.venv/bin/python -m pip install --upgrade pip' command.
Then I cleaned everything and tried to install python 3.8.9, which is not compatible with Mac with M1:
pyenv install 3.8.9
python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.8.9.tar.xz...
-> https://www.python.org/ftp/python/3.8.9/Python-3.8.9.tar.xz
Installing Python-3.8.9...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
BUILD FAILED (OS X 12.2.1 using python-build 20180424)
Inspect or clean up the working tree at /var/folders/k3/2cm7mqwd3nqffkdmf0_36vdh0000gn/T/python-build.20220331154945.24591
Results logged to /var/folders/k3/2cm7mqwd3nqffkdmf0_36vdh0000gn/T/python-build.20220331154945.24591.log
Last 10 log lines:
checking size of _Bool... 1
checking size of off_t... 8
checking whether to enable large file support... no
checking size of time_t... 8
checking for pthread_t... yes
checking size of pthread_t... 8
checking size of pthread_key_t... 8
checking whether pthread_key_t is compatible with int... no
configure: error: Unexpected output of 'arch' on OSX
make: *** No targets specified and no makefile found. Stop.
And looking around it's because the M1 architecture is supported starting from python 3.9.1 onward. So I am not able to have a working version of python, cairo and devnet due to everything not being compatible together.
Sorry to hear that, is using the dockerized Devnet an option for you?
That is an option (unless issues arise there too), but I have the same issues with cairo-lang since it's compatible with python <= 3.8.9 and that version of python does not really work with M1.
I have to look if it's possible to create a docker dev environment where everything is installed there and I write code inside that docker image and so I don't have issues with Mac or M1 anymore...
Ok I have tried to do use docker VMs to work around the issue:
docker run -p 127.0.0.1:5000:5000 shardlabs/starknet-devnet
(seems successfully)Now I am trying to run yarn hardhat test
, hoping that it uses the devnet in the other docker container. But I don't understand what is happening.
$ yarn hardhat test
yarn run v1.22.15
$ /com.docker.devenvironments.code/hardhat/node_modules/.bin/hardhat test
Starknet plugin using the active environment.
Using network devnet at http://127.0.0.1:5000/
VNChannel
constructor
1) should have stored correctly the name and symbol
0 passing (3s)
1 failing
1) VNChannel
constructor
should have stored correctly the name and symbol:
HardhatPluginError: Could not deploy contract. Check the network url in config. Is it responsive?
at StarknetContractFactory.<anonymous> (node_modules/@shardlabs/starknet-hardhat-plugin/src/types.ts:354:19)
at Generator.next (<anonymous>)
at fulfilled (node_modules/@shardlabs/starknet-hardhat-plugin/dist/types.js:24:58)
Here the usual hardhat.config.ts
import { HardhatUserConfig } from 'hardhat/types'
import '@shardlabs/starknet-hardhat-plugin'
/**
* @type import('hardhat/config').HardhatUserConfig
*/
const config: HardhatUserConfig = {
starknet: {
venv: 'active',
network: 'devnet',
wallets: {
Deployer: {
accountName: 'DeployerWallet',
modulePath: 'starkware.starknet.wallets.open_zeppelin.OpenZeppelinAccount',
accountPath: '~/.starknet_accounts',
}
},
},
networks: {
devnet: {
url: 'http://127.0.0.1:5000/',
},
},
}
export default config
Ideas?
As a test, I've also commented venv: 'active'
line, so it would use the dockerised version of devnet (ok for me), but I get this non-error...
$ yarn hardhat test
yarn run v1.22.15
$ /com.docker.devenvironments.code/hardhat/node_modules/.bin/hardhat test
Starknet plugin using dockerized environment (shardlabs/cairo-cli:0.8.0)
Using network devnet at http://127.0.0.1:5000/
VNChannel
constructor
1) should have stored correctly the name and symbol
0 passing (122ms)
1 failing
1) VNChannel
constructor
should have stored correctly the name and symbol:
Error
at HardhatDocker._withCommonErrors (node_modules/@nomiclabs/hardhat-docker/src/hardhat-docker.ts:210:15)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async HardhatDocker.runContainer (node_modules/@nomiclabs/hardhat-docker/src/hardhat-docker.ts:169:23)
After running the container, can you reach the devnet inside of it with curl http://127.0.0.1:5000
?
Also, can you print the log of the container using docker logs
? It requires the name of the container, so you have to find it out with docker ps
before that. Or if you run the container with docker run ... --name <NAME>
, you can use that name.
Regarding the venv
key of hardhat.config.ts
, it only serves to specify how you want the plugin to run its internal Starknet commands (either using an environment with cairo-lang installed, or using the cairo-cli docker). It is important to distinguish between that cairo-cli docker image/container used by the plugin and the docker image/container that devnet can be packed in.
It seems reachable from the outside
❯ curl http://127.0.0.1:5000
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>404 Not Found</title>
<h1>Not Found</h1>
<p>The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.</p>
❯ docker logs starknet-devnet
* Running on all addresses.
WARNING: This is a development server. Do not use it in a production deployment.
* Running on http://172.17.0.3:5000/ (Press CTRL+C to quit)
172.17.0.1 - - [01/Apr/2022 14:48:01] "GET / HTTP/1.1" 404 -
Sorry, for curl
ing I meant actually curl http://127.0.0.1:5000/is_alive
. Also thinking about it, don't you see the devnet log in the terminal where you ran it even without using docker logs
? And what does the log say after running the test?
It works
❯ curl http://127.0.0.1:5000/is_alive
Alive!!!%
❯ docker logs starknet-devnet
* Running on all addresses.
WARNING: This is a development server. Do not use it in a production deployment.
* Running on http://172.17.0.3:5000/ (Press CTRL+C to quit)
172.17.0.1 - - [01/Apr/2022 14:59:30] "GET /is_alive HTTP/1.1" 200 -
Ok, and what about the docker log after running the test?
It's worth mentioning that I run the devnet docker image from the Mac terminal, not from inside the development environment docker VM.
If I run the curl command from inside the dev VM:
$ curl http://127.0.0.1:5000/is_alive
curl: (7) Failed to connect to 127.0.0.1 port 5000: Connection refused
When I run the tests (inside the dev VM) I get
$ yarn hardhat test
yarn run v1.22.18
$ /com.docker.devenvironments.code/hardhat/node_modules/.bin/hardhat test
Starknet plugin using the active environment.
Using network devnet at http://127.0.0.1:5000/
VNChannel
constructor
1) should have stored correctly the name and symbol
0 passing (3s)
1 failing
1) VNChannel
constructor
should have stored correctly the name and symbol:
HardhatPluginError: Could not deploy contract. Check the network url in config. Is it responsive?
at StarknetContractFactory.<anonymous> (node_modules/@shardlabs/starknet-hardhat-plugin/src/types.ts:354:19)
at Generator.next (<anonymous>)
at fulfilled (node_modules/@shardlabs/starknet-hardhat-plugin/dist/types.js:24:58)
With no new log entry.
That answers your question. Your devnet instance is isolated from the dev VM. If you could somehow have both hardhat and devnet connect to the same network, that would help.
So I was able to connect the two containers.
Now from the hardhat container is able to talk to the devnet:
curl http://127.0.0.1:5000/is_alive
Alive!!!
But if I run the tests, it does not succeed:
yarn hardhat test
yarn run v1.22.18
$ /com.docker.devenvironments.code/hardhat/node_modules/.bin/hardhat test
Starknet plugin using dockerized environment (shardlabs/cairo-cli:0.8.0)
Using network devnet at http://127.0.0.1:5000/
VNChannel
constructor
1) should have stored correctly the name and symbol
0 passing (125ms)
1 failing
1) VNChannel
constructor
should have stored correctly the name and symbol:
Error
at HardhatDocker._withCommonErrors (node_modules/@nomiclabs/hardhat-docker/src/hardhat-docker.ts:210:15)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async HardhatDocker.runContainer (node_modules/@nomiclabs/hardhat-docker/src/hardhat-docker.ts:169:23)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Hardhat.config.ts:
import { HardhatUserConfig } from 'hardhat/types'
import '@shardlabs/starknet-hardhat-plugin'
/**
* @type import('hardhat/config').HardhatUserConfig
*/
const config: HardhatUserConfig = {
starknet: {
// venv: 'active',
network: 'devnet',
wallets: {
Deployer: {
accountName: 'DeployerWallet',
modulePath: 'starkware.starknet.wallets.open_zeppelin.OpenZeppelinAccount',
accountPath: '~/.starknet_accounts',
},
},
},
networks: {
devnet: {
url: 'http://127.0.0.1:5000/',
},
},
}
export default config
Logs of the devnet are empty.
Well the devnet logs ought to be somewhere.
Also, did you consult the solution proposed here: https://discord.com/channels/793094838509764618/959449552027537438/959499063131263057 ?
I mean that when I look inside the devnet logs, there is no new entry when I launch the yarn hardhat test
command.
Also the link is not opening any conversation/message to me. It just sends me to the welcome channel (I am logged in, verified and part of the channel already).
The link (https://discord.com/channels/793094838509764618/959449552027537438) should be redirecting to the archived thread called VM dev machine
on the dev-support channel of Starknet's Discord server. It's the thread were apparently you were active.
I mean that when I look inside the devnet logs, there is no new entry when I launch the
yarn hardhat test
command.
But the log from responding to curl
is present? Also, are you running yarn hardhat test
in the same terminal as curl
?
Yes the curl line gets logged.
~ ❯ docker run --name starknet-devnet --network=container:pedantic_williamson shardlabs/starknet-devnet
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
* Running on all addresses.
WARNING: This is a development server. Do not use it in a production deployment.
* Running on http://172.17.0.2:5000/ (Press CTRL+C to quit)
127.0.0.1 - - [04/Apr/2022 11:00:42] "GET /is_alive HTTP/1.1" 200 -
But there is no entry for the yarn hardhat test
.
And yes in the same terminal I run the curl
and yarn hardhat test
PS: you see in the docker command I --network=container:pedantic_williamson
to connect it to the container pedantic_williamson which is the one with the hardhat env.
Ok, I took a better look at your hardhat.config.ts file and the error log. Since your specification of venv: "active"
is commented out, it is internally running commands using the pulled docker image (shardlabs/cairo-lang:0.8.0
). Looking at the error log (Error: HardhatDocker._withCommonErrors
), looks like there are issues in interacting with the image/container. Are you able to run hardhat starknet-compile
and hardhat starknet-deploy
?
In the hardhat dev container, I checked out the git repo, so I definitely have all the files that need to be compiled there. But there's some docker issue...
$ ls contracts/public/
VNChannel.cairo
$ yarn hardhat starknet-compile contracts/public
yarn run v1.22.18
$ /com.docker.devenvironments.code/hardhat/node_modules/.bin/hardhat starknet-compile contracts/public
Starknet plugin using dockerized environment (shardlabs/cairo-cli:0.8.0)
Compiling /com.docker.devenvironments.code/hardhat/contracts/public/VNChannel.cairo
An unexpected error occurred:
DockerServerError
at HardhatDocker._withCommonErrors (/com.docker.devenvironments.code/hardhat/node_modules/@nomiclabs/hardhat-docker/src/hardhat-docker.ts:210:15)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async HardhatDocker.runContainer (/com.docker.devenvironments.code/hardhat/node_modules/@nomiclabs/hardhat-docker/src/hardhat-docker.ts:169:23) {
parent: Error: (HTTP code 500) server error - Mounts denied:
The path /com.docker.devenvironments.code/hardhat/contracts/public/VNChannel.cairo is not shared from the host and is not known to Docker.
You can configure shared paths from Docker -> Preferences... -> Resources -> File Sharing.
See https://docs.docker.com/desktop/mac for more info.
at /com.docker.devenvironments.code/hardhat/node_modules/docker-modem/lib/modem.js:257:17
at getCause (/com.docker.devenvironments.code/hardhat/node_modules/docker-modem/lib/modem.js:287:7)
at Modem.buildPayload (/com.docker.devenvironments.code/hardhat/node_modules/docker-modem/lib/modem.js:256:5)
at IncomingMessage.<anonymous> (/com.docker.devenvironments.code/hardhat/node_modules/docker-modem/lib/modem.js:232:14)
at IncomingMessage.emit (node:events:406:35)
at IncomingMessage.emit (node:domain:475:12)
at endReadableNT (node:internal/streams/readable:1331:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
reason: 'server error',
statusCode: 500,
json: 'Mounts denied: \n' +
'The path /com.docker.devenvironments.code/hardhat/contracts/public/VNChannel.cairo is not shared from the host and is not known to Docker.\n' +
'You can configure shared paths from Docker -> Preferences... -> Resources -> File Sharing.\n' +
'See https://docs.docker.com/desktop/mac for more info.\n'
}
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Same kind of error when I try to deploy an account:
$ yarn hardhat starknet-deploy-account --starknet-network devnet --wallet Deployer
yarn run v1.22.18
$ /com.docker.devenvironments.code/hardhat/node_modules/.bin/hardhat starknet-deploy-account --starknet-network devnet --wallet Deployer
Starknet plugin using dockerized environment (shardlabs/cairo-cli:0.8.0)
An unexpected error occurred:
DockerServerError
at HardhatDocker._withCommonErrors (/com.docker.devenvironments.code/hardhat/node_modules/@nomiclabs/hardhat-docker/src/hardhat-docker.ts:210:15)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async HardhatDocker.runContainer (/com.docker.devenvironments.code/hardhat/node_modules/@nomiclabs/hardhat-docker/src/hardhat-docker.ts:169:23) {
parent: Error: (HTTP code 500) server error - Mounts denied:
The path /home/node/.starknet_accounts is not shared from the host and is not known to Docker.
You can configure shared paths from Docker -> Preferences... -> Resources -> File Sharing.
See https://docs.docker.com/desktop/mac for more info.
at /com.docker.devenvironments.code/hardhat/node_modules/docker-modem/lib/modem.js:257:17
at getCause (/com.docker.devenvironments.code/hardhat/node_modules/docker-modem/lib/modem.js:287:7)
at Modem.buildPayload (/com.docker.devenvironments.code/hardhat/node_modules/docker-modem/lib/modem.js:256:5)
at IncomingMessage.<anonymous> (/com.docker.devenvironments.code/hardhat/node_modules/docker-modem/lib/modem.js:232:14)
at IncomingMessage.emit (node:events:406:35)
at IncomingMessage.emit (node:domain:475:12)
at endReadableNT (node:internal/streams/readable:1331:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
reason: 'server error',
statusCode: 500,
json: 'Mounts denied: \n' +
'The path /home/node/.starknet_accounts is not shared from the host and is not known to Docker.\n' +
'You can configure shared paths from Docker -> Preferences... -> Resources -> File Sharing.\n' +
'See https://docs.docker.com/desktop/mac for more info.\n'
}
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Deploying a contract also does not work:
$ yarn hardhat starknet-deploy VNChannel --starknet-network devnet --inputs "111 111 123"
yarn run v1.22.18
$ /com.docker.devenvironments.code/hardhat/node_modules/.bin/hardhat starknet-deploy VNChannel --starknet-network devnet --inputs '111 111 123'
Starknet plugin using dockerized environment (shardlabs/cairo-cli:0.8.0)
Done in 1.55s.
I'd check this part of your error log:
The path /com.docker.devenvironments.code/hardhat/contracts/public/VNChannel.cairo is not shared from the host and is not known to Docker.
You can configure shared paths from Docker -> Preferences... -> Resources -> File Sharing.
See https://docs.docker.com/desktop/mac for more info.
The thing is that the docker container that runs the Starknet commands is trying to access the files on your host machine, but can't reach them or doesn't have the permission to do so.
It seems to be a docker issue. It should not go to the host machine. The files are check-out locally inside container. It is throwing the same error also when deploying an OpenZeppelin contract. So docker is also broken on macOS with M1.
I tried to use VirtualBox to also run a VM where to install a devnet and hardhat, but also VirtualBox is not compatible with M1...
So can you clarify, how many docker containers are there? Or virtual machines running?
After a week of battles with docker, with remote VMs and other stuff, it seems that I found a way to make it work with the active environment. the only thing different this time around was that I used the latest latest version of python, the 3.10.3. I also had to downgrade
cd hardhat/
brew install pyenv
# Install specific version of python and set it as local default
pyenv install 3.10.3
pyenv local 3.10.3
# Create a local venv
python -m venv .venv
# Activate it (execute this command for every terminal for the project)
source .venv/bin/activate
# Setup the python venv:
brew install gmp
# macOS with M1
CFLAGS=-I`brew --prefix gmp`/include LDFLAGS=-L`brew --prefix gmp`/lib pip3 install ecdsa fastecdsa sympy
# Install Cairo
pip install cairo-lang
# Install Starknet Devnet
pip install starknet-devnet
# Downgrade faulty package
pip install werkzeug==2.0.3
# Start devnet with persistent state (subsequent)
starknet-devnet \
--dump-on transaction \
--dump-path ~/.starknet_devnet \
--load-path ~/.starknet_devnet
In another terminal:
# Compile
yarn hardhat starknet-compile contracts/public
# Test
yarn hardhat test
# Deploy
yarn hardhat starknet-deploy ExampleContract --starknet-network devnet --inputs "123"
# Deploy an account
yarn hardhat starknet-deploy-account --starknet-network devnet --wallet Deployer
And everything works!!
@ccarnino Well after all the work put in, looks like cairo-lang 0.8.1 will be compatible with Python 3.9: https://github.com/starkware-libs/cairo-lang/releases/tag/v0.8.1
yeah. I saw it earlier... thanks anyway for the support!
Hello team. I updated to the latest 0.5.2 and tried to run the tests.
I have one test passing but one not. I get this error
HardhatPluginError: Could not deploy contract. Check the network url in config. Is it responsive?
My current configuration has been for a while:
This is the output:
This is the test failing:
Ideas why?