-
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
Conversation
Thanks @rory-ocl ! This is ready again |
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, |
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
check/src/project.rs
Outdated
// Next, parse the Rust version from the toolchain project, only allowing alphanumeric chars and dashes. | ||
let channel = channel | ||
.chars() | ||
.filter(|c| c.is_alphanumeric() || *c == '-') |
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.
It looks like .
should also be a valid character according to the docs. <channel> = stable|beta|nightly|<major.minor.patch>
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.
Thanks for confirming ! will add
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
added here @rory-ocl
Description
Add Project Hash as Custom WASM Section
Currently, program verification involves injecting a hash of the contents of all Rust sources of a project in the contract deployment calldata. However, this project hash should actually be part of the WASM file itself. We include it as a custom wasm section, which will cause different project hashes to require unique program activations and make them part of consensus. This also extends the docker.rs of reproducible builds to support nightly.
Tested to show that changing a single comment in a project leads to a different activation, and that hashes match with verification:
We also add more details in case verification fails, such as what part of the verification mismatches: either the EVM prelude or the contract code itself.
Require Toolchain File for Reproducible Stylus Programs
Our next major change is requiring a rust-toolchain.toml file, which is a convention for reproducible Rust programs in the directory of the project being deployed. This allows specifying the exact toolchain channel, such as a specific nightly Rust version, to ensure builds are always made with the expected channel.