-
Notifications
You must be signed in to change notification settings - Fork 37
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
Major Changes to Reproducible Builds #53
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
f0838f7
include project hash as custom section in wasm
rauljordan ba1258b
proper project hash inclusion in wasm
rauljordan 34ad2ea
add more details about what went wrong
rauljordan 0dac6cc
co
rauljordan 2c5ce69
edits
rauljordan d8884e6
edit
rauljordan a9bd9bc
verification and include toolchain
rauljordan f19f368
edit
rauljordan fa7bfcd
edit
rauljordan 6179620
toolchain
rauljordan 88c8df5
patch up
rauljordan e2963a2
update version
rauljordan afbb9f0
sanitize version
rauljordan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,10 +2,14 @@ | |
// For licensing, see https://github.com/OffchainLabs/cargo-stylus/blob/main/licenses/COPYRIGHT.md | ||
|
||
use std::io::Write; | ||
use std::path::PathBuf; | ||
use std::process::{Command, Stdio}; | ||
|
||
use eyre::{bail, eyre, Result}; | ||
|
||
use crate::constants::TOOLCHAIN_FILE_NAME; | ||
use crate::project::extract_toolchain_channel; | ||
|
||
fn version_to_image_name(version: &str) -> String { | ||
format!("cargo-stylus-{}", version) | ||
} | ||
|
@@ -24,6 +28,8 @@ fn create_image(version: &str) -> Result<()> { | |
if image_exists(&name)? { | ||
return Ok(()); | ||
} | ||
let toolchain_file_path = PathBuf::from(".").as_path().join(TOOLCHAIN_FILE_NAME); | ||
let toolchain_channel = extract_toolchain_channel(&toolchain_file_path)?; | ||
let mut child = Command::new("docker") | ||
.arg("build") | ||
.arg("-t") | ||
|
@@ -37,15 +43,19 @@ fn create_image(version: &str) -> Result<()> { | |
child.stdin.as_mut().unwrap(), | ||
"\ | ||
FROM rust:{} as builder\n\ | ||
RUN rustup toolchain install {} && rustup default {} | ||
RUN rustup target add wasm32-unknown-unknown | ||
RUN rustup target add wasm32-wasi | ||
RUN rustup target add aarch64-unknown-linux-gnu | ||
RUN rustup target add x86_64-unknown-linux-gnu | ||
RUN cargo install cargo-stylus | ||
RUN cargo install --force cargo-stylus-check | ||
RUN cargo install --force cargo-stylus-replay | ||
RUN cargo install --force cargo-stylus-cgen | ||
", | ||
version | ||
version, | ||
toolchain_channel, | ||
toolchain_channel, | ||
)?; | ||
child.wait().map_err(|e| eyre!("wait failed: {e}"))?; | ||
Ok(()) | ||
|
@@ -76,10 +86,14 @@ fn run_in_docker_container(version: &str, command_line: &[&str]) -> Result<()> { | |
} | ||
|
||
pub fn run_reproducible(version: &str, command_line: &[String]) -> Result<()> { | ||
let version: String = version | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added here @rory-ocl |
||
.chars() | ||
.filter(|c| c.is_alphanumeric() || *c == '.') | ||
.collect(); | ||
let mut command = vec!["cargo", "stylus"]; | ||
for s in command_line.iter() { | ||
command.push(s); | ||
} | ||
create_image(version)?; | ||
run_in_docker_container(version, &command) | ||
create_image(&version)?; | ||
run_in_docker_container(&version, &command) | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you confirm that this version variable has also been cleaned to prevent injection attacks? @rauljordan
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch! Fixed