Skip to content

Commit

Permalink
Merge pull request #114 from 0xPolygonHermez/edu/remove_private_token
Browse files Browse the repository at this point in the history
Update the documentation links in the README.md and remove the requir…
  • Loading branch information
eduadiez authored Oct 15, 2024
2 parents d79f55c + 85423e8 commit aabcdd0
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 68 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Polygon ZisK

You can find the documentation here: [docs](https://silver-guide-wgvmnpk.pages.github.io/)
You can find the documentation here: [docs](https://0xpolygonhermez.github.io/zisk/)

# Licenses
All crates of this monorepo are licensed under either of
Expand Down
14 changes: 5 additions & 9 deletions book/getting_started/install.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Install



## Requirements
⚠️ Currently, macOS is not supported for proof generation. A Linux x86_64 machine is required at this time. ⚠️

* [Rust (Nightly)](https://www.rust-lang.org/tools/install)
* [xz]()
* [jq]()
Expand Down Expand Up @@ -32,18 +36,10 @@ nvm use 19

## Option 1: Prebuilt Binaries (Recommended)

<div class="warning">

this is temporary until we make the repositories publics, if you need an installation token, write to the Zisk team
```bash
export ZISK_TOKEN=...
curl https://raw.githubusercontent.com/0xPolygonHermez/zisk/develop/ziskup/install.sh | bash
```
```bash
curl -H "Authorization: token ${ZISK_TOKEN}" \
https://raw.githubusercontent.com/0xPolygonHermez/zisk/develop/ziskup/install.sh | bash
```
</div>


This will enable the ziskup command in your CLI. You need to restart your terminal to use it or run this command:

Expand Down
9 changes: 1 addition & 8 deletions book/getting_started/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,13 @@ In this section, we will show you how to create a simple program using ZisK.

## Create Project

<div class="warning">

this is temporary until we make the repositories publics, if you need an installation token, write to the Zisk team
```bash
export ZISK_TOKEN=...
```
```bash
git clone https://${ZISK_TOKEN}@github.com/0xPolygonHermez/zisk
git clone https://github.com/0xPolygonHermez/zisk
git clone -b develop https://github.com/0xPolygonHermez/pil2-compiler.git
git clone -b develop https://github.com/0xPolygonHermez/pil2-proofman.git
git clone --recursive -b develop https://github.com/0xPolygonHermez/pil2-stark.git
git clone -b feature/setup https://github.com/0xPolygonHermez/pil2-proofman-js
```
</div>

The first step is to create a new project using the `cargo-zisk sdk new <name>` command. This command will create a new folder in your current directory.

Expand Down
10 changes: 1 addition & 9 deletions book/getting_started/quickstart_dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Run the following commands to clone the necessary repositories:

```bash
git clone -b develop https://github.com/0xPolygonHermez/pil2-compiler.git
git clone -b develop https://${ZISK_TOKEN}@github.com/0xPolygonHermez/zisk.git
git clone -b develop https://github.com/0xPolygonHermez/zisk.git
git clone -b develop https://github.com/0xPolygonHermez/pil2-proofman.git
git clone --recursive -b develop https://github.com/0xPolygonHermez/pil2-stark.git
git clone -b feature/setup https://github.com/0xPolygonHermez/pil2-proofman-js
Expand All @@ -29,14 +29,6 @@ git clone -b feature/setup https://github.com/0xPolygonHermez/pil2-proofman-js
Install qemu:
`sudo apt-get install qemu-system`


Set up tokens to access repositories:

```
export GITHUB_ACCESS_TOKEN=....
export ZISK_TOKEN=....
```

### Create New Hello World Project
Create a new project using the Zisk toolchain:

Expand Down
2 changes: 2 additions & 0 deletions book/introduction.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# Introduction

WIP
15 changes: 3 additions & 12 deletions cli/src/commands/build_toolchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ impl BuildToolchainCmd {
pub fn run(&self) -> Result<()> {
println!("Building toolchain...");
// Get enviroment variables.
let zisk_token = std::env::var("ZISK_TOKEN");
let build_dir = std::env::var("ZISK_BUILD_DIR");
let rust_dir = match build_dir {
Ok(build_dir) => {
Expand All @@ -26,20 +25,12 @@ impl BuildToolchainCmd {
}

println!("No ZISK_BUILD_DIR detected, cloning rust.");
let repo_url = match zisk_token {
Ok(zisk_token) => {
println!("Detected ZISK_TOKEN, using it to clone rust.");
format!("https://{}@github.com/0xPolygonHermez/rust", zisk_token)
}
Err(_) => {
println!("No ZISK_TOKEN detected. If you get throttled by Github, set it to bypass the rate limit.");
"ssh://[email protected]/0xPolygonHermez/rust".to_string()
}
};
let repo_url = "https://{}@github.com/0xPolygonHermez/rust";

Command::new("git")
.args([
"clone",
&repo_url,
repo_url,
"--depth=1",
"--single-branch",
"--branch=zisk",
Expand Down
12 changes: 1 addition & 11 deletions cli/src/commands/new.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,7 @@ pub struct NewCmd {
impl NewCmd {
pub fn run(&self) -> Result<()> {
let root = Path::new(&self.name);
let zisk_token = std::env::var("ZISK_TOKEN");
let repo_url = match zisk_token {
Ok(zisk_token) => {
println!("Detected ZISK_TOKEN, using it to clone zisk_template");
format!("https://{}@github.com/0xPolygonHermez/zisk_template", zisk_token)
}
Err(_) => {
println!("No ZISK_TOKEN detected. If you get throttled by Github, set it to bypass the rate limit.");
"ssh://[email protected]/0xPolygonHermez/zisk_template".to_string()
}
};
let repo_url = "https://{}@github.com/0xPolygonHermez/zisk_template";
// Create the root directory if it doesn't exist.
if !root.exists() {
fs::create_dir(&self.name)?;
Expand Down
10 changes: 1 addition & 9 deletions cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,7 @@ pub fn is_supported_target() -> bool {
pub async fn get_toolchain_download_url(client: &Client, target: String) -> String {
// Get latest tag from https://api.github.com/repos/0xPolygonHermez/rust/releases/latest
// and use it to construct the download URL.
let url = format!(
"https://{}@api.github.com/repos/0xPolygonHermez/rust/releases/latest",
std::env::var("ZISK_TOKEN").unwrap()
);
let url = "https://api.github.com/repos/0xPolygonHermez/rust/releases/latest";
let json = client.get(url).send().await.unwrap().json::<serde_json::Value>().await.unwrap();

let name: String = format!("rust-toolchain-{}.tar.gz", target);
Expand All @@ -97,11 +94,6 @@ pub async fn download_file(
) -> std::result::Result<(), String> {
let mut headers = HeaderMap::new();

headers.insert(
"Authorization",
HeaderValue::from_str(format!("Bearer {}", std::env::var("ZISK_TOKEN").unwrap()).as_str())
.unwrap(),
);
headers.insert("Accept", HeaderValue::from_static("application/octet-stream"));
let res = client
.get(url)
Expand Down
2 changes: 1 addition & 1 deletion ziskup/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ BIN_PATH="$ZISK_BIN_DIR/ziskup"

# Create the .zisk bin directory and ziskup binary if it doesn't exist.
mkdir -p $ZISK_BIN_DIR
curl -H "Authorization: token ${ZISK_TOKEN}" -# -L $BIN_URL -o $BIN_PATH
curl -# -L $BIN_URL -o $BIN_PATH
chmod +x $BIN_PATH

# Store the correct profile file (i.e. .profile for bash or .zshenv for ZSH).
Expand Down
16 changes: 8 additions & 8 deletions ziskup/ziskup
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,9 @@ download() {

# Fetch the URL from the GitHub API
if check_cmd curl; then
API_RESPONSE=$(curl -H "Authorization: token ${ZISK_TOKEN}" https://api.github.com/repos/0xPolygonHermez/zisk/releases)
API_RESPONSE=$(curl https://api.github.com/repos/0xPolygonHermez/zisk/releases)
else
API_RESPONSE=$(wget -qO- --header="Authorization: token ${ZISK_TOKEN}" https://api.github.com/repos/0xPolygonHermez/zisk/releases)
API_RESPONSE=$(wget -qO- https://api.github.com/repos/0xPolygonHermez/zisk/releases)
fi

# Extract the browser_download_url for the given file name ($1)
Expand All @@ -311,16 +311,16 @@ download() {

# output into $2
if check_cmd curl; then
curl -H "Accept: application/octet-stream" -H "Authorization: Bearer ${ZISK_TOKEN}" -#o "$2" -L "$URL"
curl -H "Accept: application/octet-stream" -#o "$2" -L "$URL"
else
wget --header="Accept: application/octet-stream" --header="Authorization: Bearer ${ZISK_TOKEN}" --show-progress -qO "$2" "$URL"
wget --header="Accept: application/octet-stream" --show-progress -qO "$2" "$URL"
fi
else
# Fetch the URL from the GitHub API
if check_cmd curl; then
API_RESPONSE=$(curl -H "Authorization: token ${ZISK_TOKEN}" https://api.github.com/repos/0xPolygonHermez/zisk/releases)
API_RESPONSE=$(curl https://api.github.com/repos/0xPolygonHermez/zisk/releases)
else
API_RESPONSE=$(wget -qO- --header="Authorization: token ${ZISK_TOKEN}" https://api.github.com/repos/0xPolygonHermez/zisk/releases)
API_RESPONSE=$(wget -qO- https://api.github.com/repos/0xPolygonHermez/zisk/releases)
fi
# Extract the browser_download_url for the given file name ($1)
URL=$(echo "$API_RESPONSE" | jq -r --arg FILENAME "$1" '.[] | .assets[] | select(.browser_download_url == $FILENAME) | .url')
Expand All @@ -332,9 +332,9 @@ download() {

# output into $2
if check_cmd curl; then
curl -H "Accept: application/octet-stream" -H "Authorization: Bearer ${ZISK_TOKEN}" -L "$URL"
curl -H "Accept: application/octet-stream" -L "$URL"
else
wget --header="Accept: application/octet-stream" --header="Authorization: Bearer ${ZISK_TOKEN}" --show-progress -qO- "$URL"
wget --header="Accept: application/octet-stream" --show-progress -qO- "$URL"
fi
fi
}
Expand Down

0 comments on commit aabcdd0

Please sign in to comment.