Skip to content

Commit

Permalink
modify compile_solidity (#49)
Browse files Browse the repository at this point in the history
* modify compile_yul

* modified format

* deleted unneccesary comments

* fix error
  • Loading branch information
mhh001 authored Sep 28, 2023
1 parent 0e7ff92 commit 37b99a3
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions snark-verifier/src/loader/evm/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::{
util::{arithmetic::PrimeField, Itertools},
};
use std::{
io::Write,
io::{self, Write},
iter,
process::{Command, Stdio},
};
Expand Down Expand Up @@ -103,13 +103,22 @@ pub fn estimate_gas(cost: Cost) -> usize {

/// Compile given Solidity `code` into deployment bytecode.
pub fn compile_solidity(code: &str) -> Vec<u8> {
let mut cmd = Command::new("solc")
let mut cmd = match Command::new("solc")
.stdin(Stdio::piped())
.stdout(Stdio::piped())
.arg("--bin")
.arg("-")
.spawn()
.unwrap();
{
Ok(cmd) => cmd,
Err(err) if err.kind() == io::ErrorKind::NotFound => {
panic!("Command 'solc' not found");
}
Err(err) => {
panic!("Failed to spawn cmd with command 'solc':\n{err}");
}
};

cmd.stdin
.take()
.unwrap()
Expand Down

0 comments on commit 37b99a3

Please sign in to comment.