Skip to content

Commit

Permalink
edits
Browse files Browse the repository at this point in the history
  • Loading branch information
rauljordan committed Aug 12, 2024
1 parent 2959eff commit 570e7af
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 34 deletions.
19 changes: 1 addition & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,24 +156,7 @@ See `--help` for all available flags and default values.

## Verifying Stylus Contracts

**cargo stylus verify**

Verifies that a deployed smart contract is identical to that produced by the
current project. Since Stylus smart contracts include a hash of all project
files, this additionally verifies that code comments and other files are
identical. To ensure build reproducibility, if a contract is to be verified,
it should be both deployed and verified using `cargo stylus reproducible`.

See `--help` for all available flags and default values.

## Reproducibly Deploying and Verifying

**cargo stylus reproducible**

Runs a `cargo stylus` command in a Docker container to ensure build
reproducibility.

See `--help` for all available flags and default values.
See [here](https://hackmd.io/bpeMnrzbSvO4mohhvkrKqw)

## Deploying Non-Rust WASM Projects

Expand Down
23 changes: 7 additions & 16 deletions check/src/docker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,7 @@ fn create_image(version: &str) -> Result<()> {
if image_exists(&name)? {
return Ok(());
}
let cargo_stylus_version = env!("CARGO_PKG_VERSION");
let cargo_stylus_version: String = cargo_stylus_version
.chars()
.filter(|c| c.is_alphanumeric() || *c == '-' || *c == '.')
.collect();
println!(
"Building Docker image for cargo-stylus version {} and Rust toolchain {}",
cargo_stylus_version, version,
);
println!("Building Docker image for Rust toolchain {}", version,);
let mut child = Command::new("docker")
.arg("build")
.arg("-t")
Expand All @@ -62,24 +54,23 @@ fn create_image(version: &str) -> Result<()> {
.arg("-f-")
.stdin(Stdio::piped())
.spawn()
.map_err(|e| eyre!("failed to execure Docker command: {e}"))?;
.map_err(|e| eyre!("failed to execute Docker command: {e}"))?;
write!(
child.stdin.as_mut().unwrap(),
"\
FROM --platform=linux/amd64 rust:{} as builder\n\
RUN rustup toolchain install {}-x86_64-unknown-linux-gnu
RUN rustup default {}-x86_64-unknown-linux-gnu
RUN rustup target add wasm32-unknown-unknown
RUN rustup target add wasm32-wasi
RUN rustup target add x86_64-unknown-linux-gnu
RUN cargo install cargo-stylus-check --version {} --force
RUN cargo install cargo-stylus --version {} --force
RUN cargo install cargo-stylus-check --force
RUN cargo install cargo-stylus --force
RUN rustup toolchain install {}-x86_64-unknown-linux-gnu
RUN rustup default {}-x86_64-unknown-linux-gnu
",
RUST_BASE_IMAGE_VERSION,
version,
version,
cargo_stylus_version,
cargo_stylus_version,
)?;
child.wait().map_err(|e| eyre!("wait failed: {e}"))?;
Ok(())
Expand Down

0 comments on commit 570e7af

Please sign in to comment.