|
| 1 | +#!/bin/bash |
| 2 | +# Shadow-EVM Setup Script |
| 3 | +# Run this script to set up the complete development environment |
| 4 | + |
| 5 | +set -e |
| 6 | + |
| 7 | +echo " Shadow-EVM Setup Script" |
| 8 | +echo "==========================" |
| 9 | +echo "" |
| 10 | + |
| 11 | +# Check Rust |
| 12 | +echo "Checking Rust..." |
| 13 | +if ! command -v cargo &> /dev/null; then |
| 14 | + echo " Rust not found. Installing..." |
| 15 | + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y |
| 16 | + source $HOME/.cargo/env |
| 17 | +else |
| 18 | + echo " Rust found: $(rustc --version)" |
| 19 | +fi |
| 20 | + |
| 21 | +# Check Foundry |
| 22 | +echo "" |
| 23 | +echo "Checking Foundry..." |
| 24 | +if ! command -v forge &> /dev/null; then |
| 25 | + echo " Foundry not found. Installing..." |
| 26 | + curl -L https://foundry.paradigm.xyz | bash |
| 27 | + source $HOME/.bashrc 2>/dev/null || source $HOME/.zshrc 2>/dev/null || true |
| 28 | + foundryup |
| 29 | +else |
| 30 | + echo " Foundry found: $(forge --version)" |
| 31 | +fi |
| 32 | + |
| 33 | +# Check RISC Zero |
| 34 | +echo "" |
| 35 | +echo "Checking RISC Zero..." |
| 36 | +if ! command -v cargo-risczero &> /dev/null; then |
| 37 | + echo " RISC Zero not found." |
| 38 | + echo "To install RISC Zero, run:" |
| 39 | + echo " curl -L https://risczero.com/install | bash" |
| 40 | + echo " rzup install" |
| 41 | + echo "" |
| 42 | + echo "Skipping RISC Zero for now (host build will fail without it)" |
| 43 | +else |
| 44 | + echo " RISC Zero found" |
| 45 | +fi |
| 46 | + |
| 47 | +# Build core library |
| 48 | +echo "" |
| 49 | +echo "Building core library..." |
| 50 | +cargo build -p shadow-evm-core |
| 51 | + |
| 52 | +# Run core tests |
| 53 | +echo "" |
| 54 | +echo "Running core tests..." |
| 55 | +cargo test -p shadow-evm-core |
| 56 | + |
| 57 | +# Build and test Solidity contracts |
| 58 | +echo "" |
| 59 | +echo "Building Solidity contracts..." |
| 60 | +cd contracts |
| 61 | +forge build |
| 62 | + |
| 63 | +echo "" |
| 64 | +echo "Running Solidity tests..." |
| 65 | +forge test |
| 66 | +cd .. |
| 67 | + |
| 68 | +echo "" |
| 69 | +echo "================================" |
| 70 | +echo " Setup complete!" |
| 71 | +echo "" |
| 72 | +echo "Next steps:" |
| 73 | +echo " 1. Install RISC Zero if not already installed:" |
| 74 | +echo " curl -L https://risczero.com/install | bash && rzup install" |
| 75 | +echo "" |
| 76 | +echo " 2. Build the host CLI:" |
| 77 | +echo " cargo build -p shadow-evm-host --release" |
| 78 | +echo "" |
| 79 | +echo " 3. Run examples:" |
| 80 | +echo " cd examples/simple-call && cargo run" |
| 81 | +echo "" |
| 82 | +echo " 4. Generate a proof:" |
| 83 | +echo " ./target/release/shadow-evm sample --output tx.json" |
| 84 | +echo " ./target/release/shadow-evm prove --input tx.json --output proof.bin --dev" |
| 85 | +echo "" |
0 commit comments