Skip to content

Commit

Permalink
rem rust stable tag
Browse files Browse the repository at this point in the history
  • Loading branch information
rauljordan committed Jul 23, 2024
1 parent 474cdc6 commit 6fbb593
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 13 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions check/src/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

use crate::{
check::ArbWasm::ArbWasmErrors,
constants::{ARB_WASM_H160, ONE_ETH},
constants::{ARB_WASM_H160, ONE_ETH, TOOLCHAIN_FILE_NAME},
macros::*,
project::{self, BuildConfig},
project::{self, extract_toolchain_channel, BuildConfig},
CheckConfig,
};
use alloy_primitives::{Address, B256, U256};
Expand Down Expand Up @@ -122,7 +122,10 @@ impl CheckConfig {
if let Some(wasm) = self.wasm_file.clone() {
return Ok((wasm, [0u8; 32]));
}
let cfg = BuildConfig::new(self.common_cfg.rust_stable);
let toolchain_file_path = PathBuf::from(".").as_path().join(TOOLCHAIN_FILE_NAME);
let toolchain_channel = extract_toolchain_channel(&toolchain_file_path)?;
let rust_stable = !toolchain_channel.contains("nightly");
let cfg = BuildConfig::new(rust_stable);
let wasm = project::build_dylib(cfg.clone())?;
let project_hash =
project::hash_files(self.common_cfg.source_files_for_project_hash.clone(), cfg)?;
Expand Down
4 changes: 3 additions & 1 deletion check/src/docker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use std::process::{Command, Stdio};
use eyre::{bail, eyre, Result};

use crate::constants::TOOLCHAIN_FILE_NAME;
use crate::macros::greyln;
use crate::project::extract_toolchain_channel;

fn version_to_image_name(version: &str) -> String {
Expand Down Expand Up @@ -87,8 +88,9 @@ 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
.chars()
.filter(|c| c.is_alphanumeric() || *c == '.')
.filter(|c| c.is_alphanumeric() || *c == '.' || *c == ':' || *c == '-')
.collect();
greyln!("Running reproducible build with Rust Docker image tag {version}");
let mut command = vec!["cargo", "stylus"];
for s in command_line.iter() {
command.push(s);
Expand Down
3 changes: 0 additions & 3 deletions check/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@ struct CommonConfig {
/// Arbitrum RPC endpoint.
#[arg(short, long, default_value = "https://sepolia-rollup.arbitrum.io/rpc")]
endpoint: String,
/// Whether to use stable Rust.
#[arg(long)]
rust_stable: bool,
/// Whether to print debug info.
#[arg(long)]
verbose: bool,
Expand Down
9 changes: 7 additions & 2 deletions check/src/verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ use serde::{Deserialize, Serialize};

use crate::{
check,
constants::TOOLCHAIN_FILE_NAME,
deploy::{self, extract_compressed_wasm, extract_program_evm_deployment_prelude},
project, CheckConfig, VerifyConfig,
project::{self, extract_toolchain_channel},
CheckConfig, VerifyConfig,
};
use cargo_stylus_util::{color::Color, sys};

Expand All @@ -30,6 +32,9 @@ pub async fn verify(cfg: VerifyConfig) -> eyre::Result<()> {
if hash.len() != 32 {
bail!("Invalid hash");
}
let toolchain_file_path = PathBuf::from(".").as_path().join(TOOLCHAIN_FILE_NAME);
let toolchain_channel = extract_toolchain_channel(&toolchain_file_path)?;
let rust_stable = !toolchain_channel.contains("nightly");
let Some(result) = provider
.get_transaction(H256::from_slice(&hash))
.await
Expand All @@ -55,7 +60,7 @@ pub async fn verify(cfg: VerifyConfig) -> eyre::Result<()> {
.map_err(|e| eyre!("Stylus checks failed: {e}"))?;
let build_cfg = project::BuildConfig {
opt_level: project::OptLevel::default(),
stable: cfg.common_cfg.rust_stable,
stable: rust_stable,
};
let wasm_file: PathBuf = project::build_dylib(build_cfg.clone())
.map_err(|e| eyre!("could not build project to WASM: {e}"))?;
Expand Down

0 comments on commit 6fbb593

Please sign in to comment.