Skip to content
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

feat: zksolc v1.5.7 support #35

Merged
merged 2 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions crates/artifacts/zksolc/src/output_selection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ use std::collections::HashSet;
#[derive(Debug, Default, Serialize, Deserialize, Eq, PartialEq, Clone)]
pub struct OutputSelection {
/// Only the 'all' wildcard is available for robustness reasons.
#[serde(rename = "*", skip_serializing_if = "Option::is_none")]
pub all: Option<FileOutputSelection>,
#[serde(rename = "*")]
pub all: FileOutputSelection,
}

#[derive(Clone, Debug, Default, Serialize, Deserialize, PartialEq, Eq)]
pub struct FileOutputSelection {
/// The per-file output selections.
#[serde(rename = "", skip_serializing_if = "Option::is_none")]
pub per_file: Option<HashSet<OutputSelectionFlag>>,
#[serde(rename = "")]
pub per_file: HashSet<OutputSelectionFlag>,
/// The per-contract output selections.
#[serde(rename = "*", skip_serializing_if = "Option::is_none")]
pub per_contract: Option<HashSet<OutputSelectionFlag>>,
#[serde(rename = "*")]
pub per_contract: HashSet<OutputSelectionFlag>,
}

///
Expand Down
4 changes: 2 additions & 2 deletions crates/compilers/src/compilers/zksolc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub use settings::ZkSolcSettings;

pub const ZKSOLC: &str = "zksolc";
pub const ZKSYNC_SOLC_RELEASE: Version = Version::new(1, 0, 1);
pub const ZKSOLC_VERSION: Version = Version::new(1, 5, 4);
pub const ZKSOLC_VERSION: Version = Version::new(1, 5, 7);

#[derive(Debug, Clone, Serialize)]
enum ZkSolcOS {
Expand Down Expand Up @@ -336,7 +336,7 @@ impl ZkSolc {
pub fn solc_available_versions() -> Vec<Version> {
let mut ret = vec![];
let min_max_patch_by_minor_versions =
vec![(4, 12, 26), (5, 0, 17), (6, 0, 12), (7, 0, 6), (8, 0, 27)];
vec![(4, 12, 26), (5, 0, 17), (6, 0, 12), (7, 0, 6), (8, 0, 28)];
for (minor, min_patch, max_patch) in min_max_patch_by_minor_versions {
for i in min_patch..=max_patch {
ret.push(Version::new(0, minor, i));
Expand Down
19 changes: 19 additions & 0 deletions crates/compilers/src/compilers/zksolc/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,19 @@ use std::{
str::FromStr,
};

///
/// The Solidity compiler codegen.
///
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum Codegen {
/// The Yul IR.
#[default]
Yul,
/// The EVM legacy assembly IR.
EVMLA,
}

/// zksolc standard json input settings. See:
/// https://docs.zksync.io/zk-stack/components/compiler/toolchain/solidity.html#standard-json for differences
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
Expand All @@ -25,6 +38,9 @@ pub struct ZkSettings {
/// false by default.
#[serde(rename = "viaIR", default, skip_serializing_if = "Option::is_none")]
pub via_ir: Option<bool>,
/// The Solidity codegen.
#[serde(default)]
pub codegen: Codegen,
// TODO: era-compiler-solidity uses a BTreeSet of strings. In theory the serialization
// should be the same but maybe we should double check
#[serde(default, skip_serializing_if = "Vec::is_empty")]
Expand Down Expand Up @@ -143,6 +159,7 @@ impl Default for ZkSettings {
enable_eravm_extensions: false,
llvm_options: Default::default(),
force_evmla: false,
codegen: Default::default(),
}
}
}
Expand All @@ -168,6 +185,7 @@ impl CompilerSettings for ZkSolcSettings {
enable_eravm_extensions,
llvm_options,
force_evmla,
codegen,
},
..
} = self;
Expand All @@ -183,6 +201,7 @@ impl CompilerSettings for ZkSolcSettings {
&& *enable_eravm_extensions == other.settings.enable_eravm_extensions
&& *llvm_options == other.settings.llvm_options
&& *force_evmla == other.settings.force_evmla
&& *codegen == other.settings.codegen
}

fn with_remappings(mut self, remappings: &[Remapping]) -> Self {
Expand Down