Skip to content

Commit cd8a7bc

Browse files
feat: add install aligned from release (#362)
1 parent 9c53c87 commit cd8a7bc

4 files changed

Lines changed: 142 additions & 12 deletions

File tree

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,12 @@ install_batcher:
138138
@cargo +nightly-2024-04-17 install --path batcher/aligned-batcher
139139

140140
install_aligned:
141+
@./batcher/aligned/install_aligned.sh
142+
143+
uninstall_aligned:
144+
@rm -rf ~/.aligned && echo "Aligned uninstalled"
145+
146+
install_aligned_compiling:
141147
@cargo +nightly-2024-04-17 install --path batcher/aligned
142148

143149
build_batcher_client:

README.md

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,30 @@ Aligned works with EigenLayer to leverage ethereum consensus mechanism for ZK pr
2424

2525
## How to use the testnet
2626

27-
### Requirements
27+
Download and install Aligned to send proofs in the testnet:
2828

29-
- [Rust](https://www.rust-lang.org/tools/install)
29+
```bash
30+
curl -L https://raw.githubusercontent.com/yetanotherco/aligned_layer/main/batcher/aligned/install_aligned.sh | bash
31+
```
32+
33+
If you are experiencing issues, upgrade by running the same command.
34+
35+
### Try it!
36+
37+
Download an example SP1 proof file with it's ELF file using:
38+
39+
```bash
40+
curl -L https://raw.githubusercontent.com/yetanotherco/aligned_layer/main/batcher/aligned/get_proof_test_files.sh | bash
41+
```
3042

31-
To install the batcher client to send proofs in the testnet, run:
43+
Send the proof with:
3244

3345
```bash
34-
make install_aligned
46+
aligned \
47+
--proving_system SP1 \
48+
--proof ~/.aligned/test_files/sp1_fibonacci.proof \
49+
--vm_program ~/.aligned/test_files/sp1_fibonacci-elf \
50+
--conn wss://batcher.alignedlayer.com
3551
```
3652

3753
### Run
@@ -51,8 +67,6 @@ aligned \
5167

5268
**Example**
5369

54-
55-
5670
```bash
5771
aligned \
5872
--proving_system SP1 \
@@ -389,7 +403,7 @@ To run the batcher, you will need to set environment variables in a `.env` file
389403
The necessary environment variables are:
390404

391405
| Variable Name | Description |
392-
|-----------------------|--------------------------------------------------------------------------------------------------------------------------------|
406+
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
393407
| AWS_SECRET_ACCESS_KEY | Secret key to authenticate and authorize API requests to the AWS S3 Bucket. |
394408
| AWS_REGION | Geographical region where the AWS S3 Bucket will be accessed. |
395409
| AWS_ACCESS_KEY_ID | Access key used in combination with the AWS_SECRET_ACCESS_KEY to authenticate and authorize API requests to the AWS S3 Bucket. |
@@ -615,7 +629,7 @@ To deploy the contracts to Testnet/Mainnet, you will need to set environment var
615629
The necessary environment variables are:
616630

617631
| Variable Name | Description |
618-
|---------------------------------|-----------------------------------------------------------------------|
632+
| ------------------------------- | --------------------------------------------------------------------- |
619633
| `RPC_URL` | The RPC URL of the network you want to deploy to. |
620634
| `PRIVATE_KEY` | The private key of the account you want to deploy the contracts with. |
621635
| `EXISTING_DEPLOYMENT_INFO_PATH` | The path to the file containing the deployment info about EigenLayer. |
@@ -713,11 +727,11 @@ You can access to a tasks information by visiting `localhost:4000/batches/:merkl
713727

714728
Create a `.env` file in the `/explorer` directory of the project. The `.env` file needs to contain the following variables:
715729

716-
| Variable | Description |
717-
| -------- | ----------- |
718-
| `RPC_URL` | The RPC URL of the network you want to connect to. |
730+
| Variable | Description |
731+
| ------------- | ----------------------------------------------------------------------------------------------- |
732+
| `RPC_URL` | The RPC URL of the network you want to connect to. |
719733
| `ENVIRONMENT` | The environment you want to run the application in. It can be `devnet`, `holesky` or `mainnet`. |
720-
| `PHX_HOST` | The host URL where the Phoenix server will be running. |
734+
| `PHX_HOST` | The host URL where the Phoenix server will be running. |
721735

722736
```make run_explorer```
723737

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
3+
SP1_ELF_URL="https://raw.githubusercontent.com/yetanotherco/aligned_layer/main/batcher/aligned/test_files/sp1/sp1_fibonacci-elf"
4+
SP1_PROOF_URL="https://raw.githubusercontent.com/yetanotherco/aligned_layer/main/batcher/aligned/test_files/sp1/sp1_fibonacci.proof"
5+
6+
SP1_ELF_NAME="sp1_fibonacci-elf"
7+
SP1_PROOF_NAME="sp1_fibonacci.proof"
8+
9+
BASE_DIR=$HOME
10+
ALIGNED_DIR="${ALIGNED_DIR-"$BASE_DIR/.aligned"}"
11+
ALIGNED_TEST_FILES_DIR="$ALIGNED_DIR/test_files"
12+
13+
mkdir -p "$ALIGNED_TEST_FILES_DIR"
14+
15+
echo "Downloading SP1 ELF file..."
16+
17+
if curl -sSf -L "$SP1_ELF_URL" -o "$ALIGNED_TEST_FILES_DIR/$SP1_ELF_NAME"; then
18+
echo "SP1 ELF download successful"
19+
else
20+
echo "Error: Failed to download $SP1_ELF_URL"
21+
exit 1
22+
fi
23+
24+
echo "Downloading SP1 proof file..."
25+
26+
if curl -sSf -L "$SP1_PROOF_URL" -o "$ALIGNED_TEST_FILES_DIR/$SP1_PROOF_NAME"; then
27+
echo "SP1 proof downloaded successful"
28+
else
29+
echo "Error: Failed to downloaded $SP1_PROOF_URL"
30+
exit 1
31+
fi
32+
33+
chmod +x "$ALIGNED_TEST_FILES_DIR/$SP1_ELF_NAME"
34+
chmod +x "$ALIGNED_TEST_FILES_DIR/$SP1_PROOF_NAME"
35+
36+
echo "SP1 ELF and proof files downloaded successfully in $ALIGNED_TEST_FILES_DIR"

batcher/aligned/install_aligned.sh

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
#!/bin/bash
2+
3+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
4+
5+
echo "Installing Aligned..."
6+
7+
BASE_DIR=$HOME
8+
ALIGNED_DIR="${ALIGNED_DIR-"$BASE_DIR/.aligned"}"
9+
ALIGNED_BIN_DIR="$ALIGNED_DIR/bin"
10+
ALIGNED_BIN_PATH="$ALIGNED_BIN_DIR/aligned"
11+
CURRENT_TAG=$(curl -s -L \
12+
-H "Accept: application/vnd.github+json" \
13+
-H "X-GitHub-Api-Version: 2022-11-28" \
14+
https://api.github.com/repos/yetanotherco/aligned_layer/releases/latest \
15+
| grep '"tag_name":' | awk -F'"' '{print $4}')
16+
RELEASE_URL="https://github.com/yetanotherco/aligned_layer/releases/download/$CURRENT_TAG/"
17+
18+
ARCH=$(uname -m)
19+
20+
if [ "$ARCH" == "x86_64" ]; then
21+
FILE="aligned-x86"
22+
elif [ "$ARCH" == "arm64" ]; then
23+
FILE="aligned-arm64"
24+
else
25+
echo "Unsupported architecture: $ARCH"
26+
exit 1
27+
fi
28+
29+
mkdir -p "$ALIGNED_BIN_DIR"
30+
if curl -sSf -L "$RELEASE_URL$FILE" -o "$ALIGNED_BIN_PATH"; then
31+
echo "Aligned download successful, installing..."
32+
else
33+
echo "Error: Failed to download $RELEASE_URL$FILE"
34+
exit 1
35+
fi
36+
chmod +x "$ALIGNED_BIN_PATH"
37+
38+
# Store the correct profile file (i.e. .profile for bash or .zshenv for ZSH).
39+
case $SHELL in
40+
*/zsh)
41+
PROFILE="${ZDOTDIR-"$HOME"}/.zshenv"
42+
PREF_SHELL=zsh
43+
;;
44+
*/bash)
45+
PROFILE=$HOME/.bashrc
46+
PREF_SHELL=bash
47+
;;
48+
*/fish)
49+
PROFILE=$HOME/.config/fish/config.fish
50+
PREF_SHELL=fish
51+
;;
52+
*/ash)
53+
PROFILE=$HOME/.profile
54+
PREF_SHELL=ash
55+
;;
56+
*)
57+
echo "aligned: could not detect shell, manually add ${ALIGNED_BIN_DIR} to your PATH."
58+
exit 1
59+
esac
60+
61+
# Only add aligned if it isn't already in PATH.
62+
if [[ ":$PATH:" != *":${ALIGNED_BIN_DIR}:"* ]]; then
63+
# Add the aligned directory to the path and ensure the old PATH variables remain.
64+
# If the shell is fish, echo fish_add_path instead of export.
65+
if [[ "$PREF_SHELL" == "fish" ]]; then
66+
echo >> "$PROFILE" && echo "fish_add_path -a $ALIGNED_BIN_DIR" >> "$PROFILE"
67+
else
68+
echo >> "$PROFILE" && echo "export PATH=\"\$PATH:$ALIGNED_BIN_DIR\"" >> "$PROFILE"
69+
fi
70+
fi
71+
72+
echo "Aligned installed successfully in $ALIGNED_BIN_PATH."
73+
echo "Detected your preferred shell is $PREF_SHELL and added aligned to PATH."
74+
echo "Run 'source $PROFILE' or start a new terminal session to use aligned."

0 commit comments

Comments
 (0)