mirror of
https://github.com/privacy-scaling-explorations/snark-verifier.git
synced 2026-01-10 06:47:54 -05:00
modify compile_solidity (#49)
* modify compile_yul * modified format * deleted unneccesary comments * fix error
This commit is contained in:
@@ -3,7 +3,7 @@ use crate::{
|
||||
util::{arithmetic::PrimeField, Itertools},
|
||||
};
|
||||
use std::{
|
||||
io::Write,
|
||||
io::{self, Write},
|
||||
iter,
|
||||
process::{Command, Stdio},
|
||||
};
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user