Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: initial succinct vendor target #1

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,478 changes: 739 additions & 739 deletions .github/workflows/ci.yml

Large diffs are not rendered by default.

254 changes: 127 additions & 127 deletions .github/workflows/dependencies.yml
Original file line number Diff line number Diff line change
@@ -1,142 +1,142 @@
# Automatically run `cargo update` periodically
# # Automatically run `cargo update` periodically

---
name: Bump dependencies in Cargo.lock
on:
schedule:
# Run weekly
- cron: '0 0 * * Sun'
workflow_dispatch:
# Needed so we can run it manually
permissions:
contents: read
defaults:
run:
shell: bash
env:
# So cargo doesn't complain about unstable features
RUSTC_BOOTSTRAP: 1
PR_TITLE: Weekly `cargo update`
PR_MESSAGE: |
Automation to keep dependencies in `Cargo.lock` current.
# ---
# name: Bump dependencies in Cargo.lock
# on:
# schedule:
# # Run weekly
# - cron: '0 0 * * Sun'
# workflow_dispatch:
# # Needed so we can run it manually
# permissions:
# contents: read
# defaults:
# run:
# shell: bash
# env:
# # So cargo doesn't complain about unstable features
# RUSTC_BOOTSTRAP: 1
# PR_TITLE: Weekly `cargo update`
# PR_MESSAGE: |
# Automation to keep dependencies in `Cargo.lock` current.

The following is the output from `cargo update`:
COMMIT_MESSAGE: "cargo update \n\n"
# The following is the output from `cargo update`:
# COMMIT_MESSAGE: "cargo update \n\n"

jobs:
not-waiting-on-bors:
if: github.repository_owner == 'rust-lang'
name: skip if S-waiting-on-bors
runs-on: ubuntu-latest
steps:
- env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Fetch state and labels of PR
# Or exit successfully if PR does not exist
JSON=$(gh pr view cargo_update --repo $GITHUB_REPOSITORY --json labels,state || exit 0)
STATE=$(echo "$JSON" | jq -r '.state')
WAITING_ON_BORS=$(echo "$JSON" | jq '.labels[] | any(.name == "S-waiting-on-bors"; .)')
# jobs:
# not-waiting-on-bors:
# if: github.repository_owner == 'rust-lang'
# name: skip if S-waiting-on-bors
# runs-on: ubuntu-latest
# steps:
# - env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# # Fetch state and labels of PR
# # Or exit successfully if PR does not exist
# JSON=$(gh pr view cargo_update --repo $GITHUB_REPOSITORY --json labels,state || exit 0)
# STATE=$(echo "$JSON" | jq -r '.state')
# WAITING_ON_BORS=$(echo "$JSON" | jq '.labels[] | any(.name == "S-waiting-on-bors"; .)')

# Exit with error if open and S-waiting-on-bors
if [[ "$STATE" == "OPEN" && "$WAITING_ON_BORS" == "true" ]]; then
exit 1
fi
# # Exit with error if open and S-waiting-on-bors
# if [[ "$STATE" == "OPEN" && "$WAITING_ON_BORS" == "true" ]]; then
# exit 1
# fi

update:
if: github.repository_owner == 'rust-lang'
name: update dependencies
needs: not-waiting-on-bors
runs-on: ubuntu-latest
steps:
- name: checkout the source code
uses: actions/checkout@v4
with:
submodules: recursive
- name: install the bootstrap toolchain
run: |
# Extract the stage0 version
TOOLCHAIN=$(jq -r '.compiler | {version,date} | join("-")' -- src/stage0.json)
# Install and set as default
rustup toolchain install --no-self-update --profile minimal $TOOLCHAIN
rustup default $TOOLCHAIN
# update:
# if: github.repository_owner == 'rust-lang'
# name: update dependencies
# needs: not-waiting-on-bors
# runs-on: ubuntu-latest
# steps:
# - name: checkout the source code
# uses: actions/checkout@v4
# with:
# submodules: recursive
# - name: install the bootstrap toolchain
# run: |
# # Extract the stage0 version
# TOOLCHAIN=$(jq -r '.compiler | {version,date} | join("-")' -- src/stage0.json)
# # Install and set as default
# rustup toolchain install --no-self-update --profile minimal $TOOLCHAIN
# rustup default $TOOLCHAIN

- name: cargo update
# Remove first line that always just says "Updating crates.io index"
run: cargo update 2>&1 | sed '/crates.io index/d' | tee -a cargo_update.log
- name: upload Cargo.lock artifact for use in PR
uses: actions/upload-artifact@v3
with:
name: Cargo-lock
path: Cargo.lock
retention-days: 1
- name: upload cargo-update log artifact for use in PR
uses: actions/upload-artifact@v3
with:
name: cargo-updates
path: cargo_update.log
retention-days: 1
# - name: cargo update
# # Remove first line that always just says "Updating crates.io index"
# run: cargo update 2>&1 | sed '/crates.io index/d' | tee -a cargo_update.log
# - name: upload Cargo.lock artifact for use in PR
# uses: actions/upload-artifact@v3
# with:
# name: Cargo-lock
# path: Cargo.lock
# retention-days: 1
# - name: upload cargo-update log artifact for use in PR
# uses: actions/upload-artifact@v3
# with:
# name: cargo-updates
# path: cargo_update.log
# retention-days: 1

pr:
if: github.repository_owner == 'rust-lang'
name: amend PR
needs: update
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: checkout the source code
uses: actions/checkout@v4
# pr:
# if: github.repository_owner == 'rust-lang'
# name: amend PR
# needs: update
# runs-on: ubuntu-latest
# permissions:
# contents: write
# pull-requests: write
# steps:
# - name: checkout the source code
# uses: actions/checkout@v4

- name: download Cargo.lock from update job
uses: actions/download-artifact@v3
with:
name: Cargo-lock
- name: download cargo-update log from update job
uses: actions/download-artifact@v3
with:
name: cargo-updates
# - name: download Cargo.lock from update job
# uses: actions/download-artifact@v3
# with:
# name: Cargo-lock
# - name: download cargo-update log from update job
# uses: actions/download-artifact@v3
# with:
# name: cargo-updates

- name: craft PR body and commit message
run: |
echo "${COMMIT_MESSAGE}" > commit.txt
cat cargo_update.log >> commit.txt
# - name: craft PR body and commit message
# run: |
# echo "${COMMIT_MESSAGE}" > commit.txt
# cat cargo_update.log >> commit.txt

echo "${PR_MESSAGE}" > body.md
echo '```txt' >> body.md
cat cargo_update.log >> body.md
echo '```' >> body.md
# echo "${PR_MESSAGE}" > body.md
# echo '```txt' >> body.md
# cat cargo_update.log >> body.md
# echo '```' >> body.md

- name: commit
run: |
git config user.name github-actions
git config user.email [email protected]
git switch --force-create cargo_update
git add ./Cargo.lock
git commit --no-verify --file=commit.txt
# - name: commit
# run: |
# git config user.name github-actions
# git config user.email [email protected]
# git switch --force-create cargo_update
# git add ./Cargo.lock
# git commit --no-verify --file=commit.txt

- name: push
run: git push --no-verify --force --set-upstream origin cargo_update
# - name: push
# run: git push --no-verify --force --set-upstream origin cargo_update

- name: edit existing open pull request
id: edit
# Don't fail job if we need to open new PR
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Exit with error if PR is closed
STATE=$(gh pr view cargo_update --repo $GITHUB_REPOSITORY --json state --jq '.state')
if [[ "$STATE" != "OPEN" ]]; then
exit 1
fi
# - name: edit existing open pull request
# id: edit
# # Don't fail job if we need to open new PR
# continue-on-error: true
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# # Exit with error if PR is closed
# STATE=$(gh pr view cargo_update --repo $GITHUB_REPOSITORY --json state --jq '.state')
# if [[ "$STATE" != "OPEN" ]]; then
# exit 1
# fi

gh pr edit cargo_update --title "${PR_TITLE}" --body-file body.md --repo $GITHUB_REPOSITORY
# gh pr edit cargo_update --title "${PR_TITLE}" --body-file body.md --repo $GITHUB_REPOSITORY

- name: open new pull request
# Only run if there wasn't an existing PR
if: steps.edit.outcome != 'success'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh pr create --title "${PR_TITLE}" --body-file body.md --repo $GITHUB_REPOSITORY
# - name: open new pull request
# # Only run if there wasn't an existing PR
# if: steps.edit.outcome != 'success'
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: gh pr create --title "${PR_TITLE}" --body-file body.md --repo $GITHUB_REPOSITORY
79 changes: 79 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Release

on:
push:
branches: [ succinct ]
pull_request:
branches: [ succinct ]
workflow_call:
workflow_dispatch:

jobs:
build:
runs-on: [buildjet-32vcpu-ubuntu-2204]
steps:
- name: Set up git private repo access
run: |
git config --global url."https://${{ secrets.PRIVATE_PULL_TOKEN }}@github.com".insteadOf ssh://[email protected]

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable

- name: Install ninja and cmake
uses: lukka/[email protected]

- name: Check out succinctlabs/vm
uses: actions/checkout@v3
with:
repository: succinctlabs/vm
path: vm
ref: john/cargo-succinct-build-toolchain
token: ${{ secrets.PRIVATE_PULL_TOKEN }}

- name: Install cargo prove
run: cargo install --locked --path .
working-directory: vm/cli

- name: Build toolchain
run: GITHUB_ACTIONS=false GITHUB_ACCESS_TOKEN=${{ secrets.PRIVATE_PULL_TOKEN }} cargo prove build-toolchain

- name: Archive build output
uses: actions/upload-artifact@v3
with:
name: rust-toolchain-x86_64-unknown-linux-gnu
path: |
rust/build/x86_64-unknown-linux-gnu/stage2
!rust/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/src
!rust/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/rustc-src

release:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Compress artifacts
shell: bash
run: |
ls -lha ./artifacts
mkdir assets
for DIR in $(ls ./artifacts); do
tar czf "assets/$DIR.tar.gz" -C "artifacts/$DIR" .
done
ls -lha ./assets
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.PRIVATE_PULL_TOKEN }}
run: |
echo "Installing gh CLI..."
curl -L https://github.com/cli/cli/releases/download/v2.17.0/gh_2.17.0_linux_amd64.tar.gz | \
tar xvz --strip-components=2 --exclude=man
chmod +x ./gh
./gh release create --repo "$GITHUB_REPOSITORY" "$GITHUB_REF_NAME" ./assets/* || \
./gh release upload --repo "$GITHUB_REPOSITORY" "$GITHUB_REF_NAME" ./assets/*
1 change: 1 addition & 0 deletions compiler/rustc_target/src/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1598,6 +1598,7 @@ supported_targets! {

("riscv32i-unknown-none-elf", riscv32i_unknown_none_elf),
("riscv32im-risc0-zkvm-elf", riscv32im_risc0_zkvm_elf),
("riscv32im-succinct-zkvm-elf", riscv32im_succinct_zkvm_elf),
("riscv32im-unknown-none-elf", riscv32im_unknown_none_elf),
("riscv32imc-unknown-none-elf", riscv32imc_unknown_none_elf),
("riscv32imc-esp-espidf", riscv32imc_esp_espidf),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel};
use crate::spec::{Target, TargetOptions};

pub fn target() -> Target {
Target {
data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(),
llvm_target: "riscv32".into(),
pointer_width: 32,
arch: "riscv32".into(),

options: TargetOptions {
os: "zkvm".into(),
vendor: "succinct".into(),
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
linker: Some("rust-lld".into()),
cpu: "generic-rv32".into(),

// Some crates (*cough* crossbeam) assume you have 64 bit
// atomics if the target name is not in a hardcoded list.
// Since zkvm is singlethreaded and all operations are
// atomic, I guess we can just say we support 64-bit
// atomics.
max_atomic_width: Some(64),
atomic_cas: true,

features: "+m".into(),
executables: true,
panic_strategy: PanicStrategy::Abort,
relocation_model: RelocModel::Static,
emit_debug_gdb_scripts: false,
eh_frame_header: false,
singlethread: true,
..Default::default()
},
}
}
Loading
Loading