You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the same directory, create a file called prepare-env.sh.
Add the following into prepare-env.sh.
#!/bin/bash
# Update and upgrade packages.
apt-get update -y
apt-get upgrade -y
# Install dependencies
apt-get install apt-utils -y
apt-get install curl -y
apt-get install git-all -y
# Clean up
apt autoremove
# Install Starkli
curl https://get.starkli.sh | sh
PATH=$PATH:$HOME/.starkli/bin
starkliup -v v0.3.4
echo starkli --version
# Install rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
echo "export PATH=\"$HOME/.cargo/bin:$PATH\"" >> ~/.bashrc
source $HOME/.cargo/env
cargo test
# Install Scarb
curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | sh
echo "export PATH=\"$HOME/.local/bin:$PATH\"" >> ~/.bashrc
# Install Starknet Foundry
curl -L https://raw.githubusercontent.com/foundry-rs/starknet-foundry/master/scripts/install.sh | sh
echo "export PATH=\"$HOME/.local/bin:$PATH\"" >> ~/.bashrc
snfoundryup
source ~/.bashrc
# Ensure the installation path is in /root/.local/bin, since it's installed for root
if ! command -v scarb &> /dev/null
then
echo "scarb installation failed or PATH is not correctly set."
echo "Current PATH: $PATH"
exit 1
fi
# Verify Scarb installation
scarb --version
# Install Cairo-VM
git clone https://github.com/lambdaclass/cairo-vm.git
cd cairo-vm
make build-cairo-1-compiler
# Return to original directory.
cd /
# Compile Cairo to Sierra to CASM
cairo-compile a.cairo a.sierra
sierra-compile a.sierra a.casm
# Execute the main container command.
exec "$@"
source ~/.bashrc
In the same directory, run docker build -t proof-generator:latest .
In the same directory, run docker run proof-generator:latest
Expected behavior
I expect the output of the program to be shown, which is 5 in this case.
What version/commit are you on?
I am using cairo-vm-cli v1.0.1, cairo-lang-compiler v1.1.1, and cairo-lang-sierra-to-casm v1.1.1.
Additional context
I have tried different compiler versions, the different make commands, different Cairo codes and none of them have worked yet. Also, a.casm matches what I expected given the code on the hosted cairo-vm.
The text was updated successfully, but these errors were encountered:
Update: I have managed to get a JSON in a similar format to the one shown in cairo_programs/manually_compiled, however it still does not return a trace and memory proof using cairo-vm-cli.
Create a file called starknet_sample.cairo
Copy the following into the newly created file.
#[contract]
mod Ownable {
use starknet::ContractAddress;
use starknet::get_caller_address;
#[event]
fn OwnershipTransferred(previous_owner: ContractAddress, new_owner: ContractAddress) {}
struct Storage {
owner: ContractAddress,
}
#[constructor]
fn constructor(init_owner: ContractAddress) {
owner::write(init_owner);
}
#[view]
fn get_owner() -> ContractAddress {
owner::read()
}
#[external]
fn transfer_ownership(new_owner: ContractAddress) {
only_owner();
let previous_owner = owner::read();
owner::write(new_owner);
OwnershipTransferred(previous_owner, new_owner);
}
fn only_owner() {
let caller = get_caller_address();
assert(caller == owner::read(), 'Caller is not the owner');
}
}
Run starknet-compile starknet_sample.cairo starknet_sample.sierra
Run starknet-sierra-compile starknet_sample.sierra starknet_sample.json
Run cairo-vm-cli starknet_sample.json
Running step 5 gives the following error:
root@8a59b77272b2:/# cairo-vm-cli starknet_sample.json
invalid type: sequence, expected a map at line 1067 column 11
Error: Runner(Program(Parse(Error("invalid type: sequence, expected a map", line: 1067, column: 11))))
Describe the bug
When attempting to run the following commands, I get the respective errors.
Command 1:
cairo-vm-cli a.cairo
Error 1:
Command 2:
cairo-vm-cli a.sierra
Error 2:
Command 3:
cairo-vm-cli a.casm
Error 3:
To Reproduce
a.cairo
.a.cairo
.prepare-env.sh
.prepare-env.sh
.docker build -t proof-generator:latest .
docker run proof-generator:latest
Expected behavior
I expect the output of the program to be shown, which is
5
in this case.What version/commit are you on?
I am using cairo-vm-cli v1.0.1, cairo-lang-compiler v1.1.1, and cairo-lang-sierra-to-casm v1.1.1.
Additional context
I have tried different compiler versions, the different make commands, different Cairo codes and none of them have worked yet. Also, a.casm matches what I expected given the code on the hosted cairo-vm.
The text was updated successfully, but these errors were encountered: