Skip to content

Commit

Permalink
feat: add eofVersion config option (#174)
Browse files Browse the repository at this point in the history
adds key for enabling eof which is supported by
https://github.com/ipsilon/solidity/tree/eof-functions-rebased

solc allows unknown keys in settings, so setting this wouldn't break
default solc. though I think it might make sense to be under a feature
flag. wdyt @mattsse
  • Loading branch information
klkvr authored Jul 17, 2024
1 parent db66310 commit 3242f6e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions crates/artifacts/solc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ tokio = { workspace = true, optional = true }
tracing.workspace = true
walkdir.workspace = true
yansi.workspace = true
serde_repr = "0.1"

[target.'cfg(windows)'.dependencies]
path-slash.workspace = true
Expand Down
12 changes: 12 additions & 0 deletions crates/artifacts/solc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ extern crate tracing;

use semver::Version;
use serde::{de::Visitor, Deserialize, Deserializer, Serialize, Serializer};
use serde_repr::{Deserialize_repr, Serialize_repr};
use std::{
borrow::Cow,
collections::{BTreeMap, HashSet},
Expand Down Expand Up @@ -271,6 +272,16 @@ pub struct Settings {
/// If this key is an empty string, that refers to a global level.
#[serde(default)]
pub libraries: Libraries,
/// Specify EOF version to produce.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub eof_version: Option<EofVersion>,
}

/// Available EOF versions.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize_repr, Deserialize_repr)]
#[repr(u8)]
pub enum EofVersion {
V1 = 1,
}

impl Settings {
Expand Down Expand Up @@ -546,6 +557,7 @@ impl Default for Settings {
libraries: Default::default(),
remappings: Default::default(),
model_checker: None,
eof_version: None,
}
.with_ast()
}
Expand Down
2 changes: 2 additions & 0 deletions crates/compilers/src/compilers/solc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ impl CompilerSettings for SolcSettings {
via_ir,
debug,
libraries,
eof_version,
},
..
} = self;
Expand All @@ -222,6 +223,7 @@ impl CompilerSettings for SolcSettings {
&& *via_ir == other.settings.via_ir
&& *debug == other.settings.debug
&& *libraries == other.settings.libraries
&& *eof_version == other.settings.eof_version
&& output_selection.is_subset_of(&other.settings.output_selection)
}

Expand Down

0 comments on commit 3242f6e

Please sign in to comment.