diff --git a/CLAUDE.md b/CLAUDE.md index a0fa338c1..8e8009c08 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -40,6 +40,10 @@ Solidity → Slang (parse, bind) → Sol-dialect MLIR → Sol→Yul→Standard p | [`solx-compiler-downloader`](./solx-compiler-downloader/) | Downloads and verifies compiler binaries | | [`solx-benchmark-converter`](./solx-benchmark-converter/) | Benchmark analysis and comparison | +## Code layout + +A type has one inherent `impl` block, with public items before private ones. + ## Slang Frontend `solx-slang` lowers the Slang AST to Sol-dialect MLIR through `solx-mlir`. The rules below are the design law of that frontend and the conventions a reviewer would otherwise repeat by hand. diff --git a/docs/src/user-guide/02-command-line-interface.md b/docs/src/user-guide/02-command-line-interface.md index f4f57ddc9..f319b76bf 100644 --- a/docs/src/user-guide/02-command-line-interface.md +++ b/docs/src/user-guide/02-command-line-interface.md @@ -465,6 +465,20 @@ The options in this section configure the **solx** compilation pipeline. +### `--solidity-version` + +Sets the Solidity version the sources are compiled as. Slang accepts the syntax and built-ins available in that version, and every `pragma solidity` must allow it. The version is also recorded in the metadata. + +Versions from 0.8.0 up to the latest one Slang supports are accepted, and the latest is the default. + +Usage: + +```bash +solx 'Simple.sol' --bin --solidity-version '0.8.20' +``` + + + ### `--threads` Sets the number of threads used for parallel compilation. Each thread compiles a separate translation unit in a child process. By default, the number of threads equals the number of CPU cores. @@ -637,7 +651,9 @@ Only the following EVM versions are supported: - cancun - prague -- osaka (default) +- osaka + +The default is solc's default for the Solidity version, which is osaka for the latest one. A Solidity version older than 0.8.25 defaults to an EVM version **solx** does not support yet, so it is compiled for cancun with a warning. Usage: diff --git a/docs/src/user-guide/03-standard-json.md b/docs/src/user-guide/03-standard-json.md index 18f364d87..5f042da1c 100644 --- a/docs/src/user-guide/03-standard-json.md +++ b/docs/src/user-guide/03-standard-json.md @@ -105,8 +105,14 @@ Optimizer modes follow the behavior described in [Optimizer and Assembly Semanti // Supported EVM versions: "cancun", "prague", "osaka". // For instance, with version "osaka", solx will be producing `clz` instructions, whereas for older EVM versions it will not. // The oldest supported EVM version is "cancun". - // Default: "osaka". + // Default: solc's default for "solidityVersion", which is "osaka" for the latest one. + // A Solidity version older than "0.8.25" defaults to an EVM version solx does not support yet, so it is compiled for "cancun" with a warning. "evmVersion": "osaka", + // Optional, solx-only: Solidity version the sources are compiled as. + // Slang accepts the syntax and built-ins available in that version, and every `pragma solidity` must allow it. + // Supported versions: from "0.8.0" up to the latest one Slang supports. + // Default: the latest version Slang supports. + "solidityVersion": "0.8.37", // Optional: Select the desired output. // Default: no flags are selected, and no output is generated. "outputSelection": { diff --git a/solx-core/src/arguments.rs b/solx-core/src/arguments.rs index 77a878f38..e681157cf 100644 --- a/solx-core/src/arguments.rs +++ b/solx-core/src/arguments.rs @@ -162,6 +162,11 @@ pub struct Arguments { #[arg(long, help_heading = "Compilation Settings")] pub evm_version: Option, + /// Solidity language version to compile as, from 0.8.0 up. + /// The default is the latest version the frontend supports. + #[arg(long, value_name = "VERSION", help_heading = "Compilation Settings")] + pub solidity_version: Option, + /// Accepted for compatibility and ignored with a warning. #[arg(long, help_heading = "Compilation Settings")] pub via_ir: bool, @@ -316,6 +321,11 @@ impl Arguments { "EVM version is only allowed in Solidity mode.", )); } + if self.solidity_version.is_some() { + messages.push(solx_standard_json::OutputError::new_error( + "Solidity version is only allowed in Solidity mode.", + )); + } if self.via_ir { messages.push(solx_standard_json::OutputError::new_error( @@ -368,6 +378,11 @@ impl Arguments { "EVM version must be passed via standard JSON input.", )); } + if self.solidity_version.is_some() { + messages.push(solx_standard_json::OutputError::new_error( + "Solidity version must be passed via standard JSON input.", + )); + } if self.output_dir.is_some() { messages.push(solx_standard_json::OutputError::new_error( diff --git a/solx-core/src/compiler.rs b/solx-core/src/compiler.rs index 12d2e252c..f1e61fe7e 100644 --- a/solx-core/src/compiler.rs +++ b/solx-core/src/compiler.rs @@ -119,6 +119,7 @@ impl<'arguments> Compiler<'arguments> { &output_selection, messages, self.arguments.evm_version, + self.arguments.solidity_version.clone(), self.arguments.via_ir, metadata_hash_type, self.arguments.metadata_literal, @@ -218,6 +219,7 @@ impl<'arguments> Compiler<'arguments> { output_selection: &solx_standard_json::InputSelection, messages: Arc>>, evm_version: Option, + solidity_version: Option, via_ir: bool, metadata_hash_type: solx_utils::MetadataHashType, metadata_literal: bool, @@ -236,6 +238,7 @@ impl<'arguments> Compiler<'arguments> { remappings, solx_standard_json::InputOptimizer::default(), evm_version, + solidity_version, via_ir, output_selection, solx_standard_json::InputMetadata::new( @@ -257,7 +260,11 @@ impl<'arguments> Compiler<'arguments> { let run_solx_project = profiler.start_pipeline_element("solx_BuildProject"); let project = Project::try_from_solidity_output( - &frontend.version, + input + .settings + .solidity_version + .clone() + .expect("the frontend sets the version it compiled as"), input.settings.libraries.clone(), &mut output, )?; @@ -338,7 +345,11 @@ impl<'arguments> Compiler<'arguments> { let run_solx_project = profiler.start_pipeline_element("solx_BuildProject"); let project = Project::try_from_solidity_output( - &frontend.version, + input + .settings + .solidity_version + .clone() + .expect("the frontend sets the version it compiled as"), input.settings.libraries.clone(), &mut output, )?; diff --git a/solx-core/src/project/contract/metadata.rs b/solx-core/src/project/contract/metadata.rs index 5a723428c..c8d176d71 100644 --- a/solx-core/src/project/contract/metadata.rs +++ b/solx-core/src/project/contract/metadata.rs @@ -24,12 +24,12 @@ impl<'a> Metadata<'a> { /// A shortcut constructor. /// pub fn new( - solc_version: Option<&solx_standard_json::Version>, + solc_version: Option<&semver::Version>, optimizer_settings: solx_codegen_evm::OptimizerSettings, llvm_options: &'a [String], ) -> Self { Self { - solc_version: solc_version.map(|version| version.default.to_owned()), + solc_version: solc_version.cloned(), solx_version: crate::Compiler::version() .parse() .expect("version string is valid semver"), diff --git a/solx-core/src/project/mod.rs b/solx-core/src/project/mod.rs index 01c72cca5..c17a91efc 100644 --- a/solx-core/src/project/mod.rs +++ b/solx-core/src/project/mod.rs @@ -34,7 +34,7 @@ use self::contract::metadata::Metadata as ContractMetadata; #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct Project { /// The `solc` compiler version, absent for LLVM IR projects. - pub solc_version: Option, + pub solc_version: Option, /// The project build results. pub contracts: BTreeMap, /// The Solidity AST JSONs of the source files. @@ -51,7 +51,7 @@ impl Project { /// A shortcut constructor. /// pub fn new( - solc_version: Option, + solc_version: Option, contracts: BTreeMap, ast_jsons: Option>>>, libraries: solx_utils::Libraries, @@ -68,7 +68,7 @@ impl Project { /// Parses the Solidity `sources` and returns a Solidity project. /// pub fn try_from_solidity_output( - solc_version: &solx_standard_json::Version, + solc_version: semver::Version, libraries: solx_utils::Libraries, output: &mut solx_standard_json::Output, ) -> anyhow::Result { @@ -148,7 +148,7 @@ impl Project { } } Ok(Project::new( - Some(solc_version.to_owned()), + Some(solc_version), contracts, Some(ast_jsons), libraries, @@ -425,7 +425,7 @@ impl Project { /// fn cbor_metadata( metadata: Option<&str>, - solc_version: Option<&solx_standard_json::Version>, + solc_version: Option<&semver::Version>, metadata_hash_type: solx_utils::MetadataHashType, append_cbor: bool, ) -> Option> { @@ -450,7 +450,7 @@ impl Project { if let Some(solc_version) = solc_version { cbor_version_parts.push(( crate::r#const::SOLC_METADATA_TAG.to_owned(), - solc_version.default.to_owned(), + solc_version.to_owned(), )); } let cbor_data = ( diff --git a/solx-slang/src/slang/mod.rs b/solx-slang/src/slang/mod.rs index 62cdd68d0..fd2c7138d 100644 --- a/solx-slang/src/slang/mod.rs +++ b/solx-slang/src/slang/mod.rs @@ -11,6 +11,7 @@ use slang_solidity_v2::compilation::Configuration; use slang_solidity_v2::compilation::FileId; use slang_solidity_v2::diagnostics::DiagnosticExtensions; use slang_solidity_v2::diagnostics::DiagnosticSeverity; +use slang_solidity_v2::utils::EvmTarget; use slang_solidity_v2::utils::LanguageVersion; use solx_standard_json::CollectableError; @@ -47,31 +48,14 @@ impl Slang { /// The frontend name the compiler reports and prefixes its pipeline benchmarks with. pub const NAME: &'static str = "Slang"; - /// Builds a Slang compilation unit from the given source files, parsing every source and - /// resolving imports with the given remappings, following solc's semantics. - fn compile( - language_version: LanguageVersion, - evm_version: EVMVersion, - sources: &BTreeMap, - remappings: &[Remapping], - ) -> CompilationUnit { - CompilationUnit::create(Configuration { - language_version, - evm_target: evm_version.into(), - sources: sources - .iter() - .map(|(file_id, content)| (file_id.clone(), *content)), - resolver: SourceImportResolver { remappings }, - }) - } -} - -impl Slang { /// /// The Solidity `--standard-json` mirror. /// /// Metadata is always requested in order to calculate the metadata hash even if not requested in the `output_selection`. /// + /// Sets `settings.solidity_version` to the version the sources are compiled as, which goes into + /// the metadata. + /// pub fn standard_json( &self, input_json: &mut solx_standard_json::Input, @@ -116,12 +100,22 @@ impl Slang { sources.insert(path.as_str().into(), source_code); } - let language_version = LanguageVersion::try_from(self.version.default.clone()) - .expect("the frontend version is a Slang language version"); - let evm_version = input_json.settings.evm_version.unwrap_or_else(|| { - EVMVersion::try_from(language_version.default_evm_target()) - .expect("solx supports the default EVM version of its language version") - }); + let language_version = match Self::language_version( + input_json.settings.solidity_version.as_ref(), + &mut output.errors, + ) { + Ok(language_version) => language_version, + Err(error) => { + output.errors.push(OutputError::new_error(error)); + return Ok(output); + } + }; + input_json.settings.solidity_version = Some(language_version.into()); + let evm_version = Self::evm_version( + input_json.settings.evm_version, + language_version, + &mut output.errors, + ); let run_analysis = profiler.start_pipeline_element(format!("{}_ParseAndBind", Self::NAME).as_str()); @@ -215,4 +209,79 @@ impl Slang { Ok(output) } + + /// Picks the language version to compile as: the requested one, or the latest Slang supports. + /// + /// A prerelease or build suffix is dropped with a warning pushed to `messages`. + /// + /// # Errors + /// + /// Returns an error if Slang does not support the requested version. + fn language_version( + requested: Option<&semver::Version>, + messages: &mut Vec, + ) -> Result { + let Some(requested) = requested else { + return Ok(LanguageVersion::LATEST); + }; + let mut version = requested.clone(); + if !version.pre.is_empty() || !version.build.is_empty() { + version.pre = semver::Prerelease::EMPTY; + version.build = semver::BuildMetadata::EMPTY; + messages.push(OutputError::new_warning(format!( + "Solidity version {requested} is compiled as {version}: the suffix names a solc build, which does not change the language version." + ))); + } + version.clone().try_into().map_err(|_| { + format!( + "Solidity version {version} is not supported. Supported versions are {} to {}.", + semver::Version::from(LanguageVersion::EARLIEST), + semver::Version::from(LanguageVersion::LATEST), + ) + }) + } + + /// Picks the EVM version to analyze at: the requested one, or solc's default for the language + /// version. + /// + /// A default older than Cancun falls back to Cancun with a warning pushed to `messages`. + fn evm_version( + requested: Option, + language_version: LanguageVersion, + messages: &mut Vec, + ) -> EVMVersion { + if let Some(requested) = requested { + return requested; + } + let default = language_version.default_evm_target(); + if default < EvmTarget::Cancun { + // TODO: target the EVM versions older than Cancun that solc defaults to. + messages.push(OutputError::new_warning(format!( + "Solidity version {} defaults to EVM version {}, which solx does not support yet. Compiling for {}, the oldest EVM version solx supports.", + semver::Version::from(language_version), + default.to_string().to_lowercase(), + EVMVersion::Cancun, + ))); + return EVMVersion::Cancun; + } + EVMVersion::try_from(default).expect("solx supports every EVM version from Cancun up") + } + + /// Builds a Slang compilation unit from the given source files, parsing every source and + /// resolving imports with the given remappings, following solc's semantics. + fn compile( + language_version: LanguageVersion, + evm_version: EVMVersion, + sources: &BTreeMap, + remappings: &[Remapping], + ) -> CompilationUnit { + CompilationUnit::create(Configuration { + language_version, + evm_target: evm_version.into(), + sources: sources + .iter() + .map(|(file_id, content)| (file_id.clone(), *content)), + resolver: SourceImportResolver { remappings }, + }) + } } diff --git a/solx-standard-json/src/input/mod.rs b/solx-standard-json/src/input/mod.rs index 26d767073..b613f8007 100644 --- a/solx-standard-json/src/input/mod.rs +++ b/solx-standard-json/src/input/mod.rs @@ -73,6 +73,7 @@ impl Input { remappings: Vec, optimizer: InputSettingsOptimizer, evm_version: Option, + solidity_version: Option, via_ir: bool, output_selection: &InputSettingsSelection, metadata: InputSettingsMetadata, @@ -104,6 +105,7 @@ impl Input { remappings, optimizer, evm_version, + solidity_version, via_ir, output_selection, metadata, @@ -122,6 +124,7 @@ impl Input { remappings: Vec, optimizer: InputSettingsOptimizer, evm_version: Option, + solidity_version: Option, via_ir: bool, output_selection: &InputSettingsSelection, metadata: InputSettingsMetadata, @@ -136,6 +139,7 @@ impl Input { libraries, remappings, evm_version, + solidity_version, via_ir, output_selection.to_owned(), metadata, diff --git a/solx-standard-json/src/input/settings/mod.rs b/solx-standard-json/src/input/settings/mod.rs index 9b37ba14a..7b6046c82 100644 --- a/solx-standard-json/src/input/settings/mod.rs +++ b/solx-standard-json/src/input/settings/mod.rs @@ -32,6 +32,9 @@ pub struct Settings { /// The target EVM version. #[serde(skip_serializing_if = "Option::is_none")] pub evm_version: Option, + /// The Solidity language version to compile as. Defaults to the latest one the frontend supports. + #[serde(skip_serializing_if = "Option::is_none")] + pub solidity_version: Option, /// Whether to compile Solidity via IR. #[serde( default, @@ -67,6 +70,7 @@ impl Settings { remappings: Vec, evm_version: Option, + solidity_version: Option, via_ir: bool, output_selection: Selection, @@ -82,6 +86,7 @@ impl Settings { remappings, evm_version, + solidity_version, via_ir, output_selection, diff --git a/solx-tester/src/compilers/input_ext.rs b/solx-tester/src/compilers/input_ext.rs index c3e9fb701..62f07399b 100644 --- a/solx-tester/src/compilers/input_ext.rs +++ b/solx-tester/src/compilers/input_ext.rs @@ -56,6 +56,7 @@ pub fn new_input_for_solc( libraries, remappings: remappings.unwrap_or_default(), evm_version, + solidity_version: None, via_ir, output_selection, metadata: solx_standard_json::InputMetadata::default(), @@ -84,6 +85,7 @@ pub fn new_input_from_llvm_ir_sources( libraries, Vec::new(), None, + None, false, output_selection.to_owned(), metadata, diff --git a/solx-tester/src/compilers/solidity/mod.rs b/solx-tester/src/compilers/solidity/mod.rs index 2f6fbbfc3..43d2199ea 100644 --- a/solx-tester/src/compilers/solidity/mod.rs +++ b/solx-tester/src/compilers/solidity/mod.rs @@ -242,6 +242,7 @@ impl SolidityCompiler { size_fallback: Some(llvm_settings.is_fallback_to_size_enabled), }, evm_version, + None, mode.via_ir, &solx_standard_json::InputSelection::new(selectors), solx_standard_json::InputMetadata::default(), @@ -296,6 +297,7 @@ impl SolidityCompiler { size_fallback: Some(llvm_settings.is_fallback_to_size_enabled), }, None, + None, false, &solx_standard_json::InputSelection::new(selectors), solx_standard_json::InputMetadata::default(), diff --git a/solx/src/solx.rs b/solx/src/solx.rs index 1248ce5f5..83f7db497 100644 --- a/solx/src/solx.rs +++ b/solx/src/solx.rs @@ -58,6 +58,8 @@ fn main() -> anyhow::Result<()> { .push(solx_standard_json::OutputError::new_error(error)); } } + // Both exits below skip destructors, and LeakSanitizer cannot trace semver's encoded suffix pointers. + drop(arguments); if is_standard_json { let output = solx_standard_json::Output::new_with_messages(messages); diff --git a/solx/tests/cli/mod.rs b/solx/tests/cli/mod.rs index ca43ef478..40192f647 100644 --- a/solx/tests/cli/mod.rs +++ b/solx/tests/cli/mod.rs @@ -42,6 +42,7 @@ mod output_dir; mod overwrite; mod recursive_process; mod remappings; +mod solidity_version; mod stack_too_deep; mod standard_json; mod standard_json_optimizer; diff --git a/solx/tests/cli/solidity_version.rs b/solx/tests/cli/solidity_version.rs new file mode 100644 index 000000000..8ffe233e6 --- /dev/null +++ b/solx/tests/cli/solidity_version.rs @@ -0,0 +1,207 @@ +//! +//! CLI tests for the eponymous option. +//! + +use predicates::prelude::*; +use test_case::test_case; + +/// The hex-encoded `solc:` entry of the CBOR metadata appended to the bytecode. +fn cbor_solc_version_hex(version: &str) -> String { + hex::encode(format!("solc:{version}")) +} + +#[test] +fn pinned_pragma() -> anyhow::Result<()> { + crate::common::setup()?; + + let args = &[ + "--solidity-version", + "0.8.20", + "--bin", + crate::common::contract!("solidity/PinnedPragma.sol"), + ]; + + let result = crate::cli::execute_solx(args)?; + result + .success() + .stdout(predicate::str::contains(cbor_solc_version_hex("0.8.20"))); + + Ok(()) +} + +#[test_case("0.8.20+commit.a1b79de6" ; "build")] +#[test_case("0.8.20-nightly.2023.5.1" ; "prerelease")] +#[test_case("0.8.20-nightly.2023.5.1+commit.a1b79de6" ; "prerelease_and_build")] +fn suffix(version: &str) -> anyhow::Result<()> { + crate::common::setup()?; + + let args = &[ + "--solidity-version", + version, + "--bin", + crate::common::contract!("solidity/PinnedPragma.sol"), + ]; + + let result = crate::cli::execute_solx(args)?; + result + .success() + .stdout(predicate::str::contains(cbor_solc_version_hex("0.8.20"))) + .stderr(predicate::str::contains(format!( + "Solidity version {version} is compiled as 0.8.20" + ))); + + Ok(()) +} + +#[test] +fn syntax_newer_than_version() -> anyhow::Result<()> { + crate::common::setup()?; + + let args = &[ + "--solidity-version", + "0.8.26", + "--bin", + crate::common::contract!("solidity/TransientStorage.sol"), + ]; + + let result = crate::cli::execute_solx(args)?; + result.failure().stderr(predicate::str::contains( + "This syntax was introduced in version '0.8.27'.", + )); + + Ok(()) +} + +#[test] +fn default_evm_version() -> anyhow::Result<()> { + crate::common::setup()?; + + let args = &[ + "--solidity-version", + "0.8.30", + "--emit-mlir=sol", + crate::common::TEST_SOLIDITY_CONTRACT, + ]; + + let result = crate::cli::execute_solx(args)?; + result + .success() + .stdout(predicate::str::contains("sol.evm_version = #Prague")); + + Ok(()) +} + +#[test] +fn default_evm_version_unsupported() -> anyhow::Result<()> { + crate::common::setup()?; + + let args = &[ + "--solidity-version", + "0.8.24", + "--emit-mlir=sol", + crate::common::TEST_SOLIDITY_CONTRACT, + ]; + + let result = crate::cli::execute_solx(args)?; + result + .success() + .stdout(predicate::str::contains("sol.evm_version = #Cancun")) + .stderr(predicate::str::contains( + "Solidity version 0.8.24 defaults to EVM version shanghai, which solx does not support yet. Compiling for cancun", + )); + + Ok(()) +} + +#[test_case("0.7.6")] +#[test_case("0.9.0")] +fn unsupported(version: &str) -> anyhow::Result<()> { + crate::common::setup()?; + + let args = &[ + "--solidity-version", + version, + "--bin", + crate::common::TEST_SOLIDITY_CONTRACT, + ]; + + let result = crate::cli::execute_solx(args)?; + result.failure().stderr(predicate::str::contains(format!( + "Solidity version {version} is not supported." + ))); + + Ok(()) +} + +#[test] +fn yul() -> anyhow::Result<()> { + crate::common::setup()?; + + let args = &[ + "--solidity-version", + "0.8.20", + "--yul", + "--bin", + crate::common::TEST_YUL_CONTRACT, + ]; + + let result = crate::cli::execute_solx(args)?; + result.failure().stderr(predicate::str::contains( + "Solidity version is only allowed in Solidity mode", + )); + + Ok(()) +} + +#[test] +fn standard_json() -> anyhow::Result<()> { + crate::common::setup()?; + + let args = &[ + "--standard-json", + crate::common::standard_json!("solidity_version.json"), + ]; + + let result = crate::cli::execute_solx(args)?; + result + .success() + .stdout(predicate::str::contains(cbor_solc_version_hex("0.8.20"))); + + Ok(()) +} + +#[test] +fn standard_json_unsupported() -> anyhow::Result<()> { + crate::common::setup()?; + + let args = &[ + "--standard-json", + crate::common::standard_json!("solidity_version_unsupported.json"), + ]; + + let result = crate::cli::execute_solx(args)?; + result.success().stdout(predicate::str::contains( + "Solidity version 0.7.6 is not supported.", + )); + + Ok(()) +} + +#[test] +fn standard_json_with_flag() -> anyhow::Result<()> { + crate::common::setup()?; + + let args = &[ + "--standard-json", + crate::common::standard_json!("solidity_version.json"), + "--solidity-version", + "0.8.20", + ]; + + let result = crate::cli::execute_solx(args)?; + result.success().stdout(predicate::str::contains( + "Solidity version must be passed via standard JSON input.", + )); + + Ok(()) +} diff --git a/solx/tests/data/contracts/solidity/PinnedPragma.sol b/solx/tests/data/contracts/solidity/PinnedPragma.sol new file mode 100644 index 000000000..2ba22ce82 --- /dev/null +++ b/solx/tests/data/contracts/solidity/PinnedPragma.sol @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: MIT + +pragma solidity 0.8.20; + +contract PinnedPragma { + function get() public pure returns (uint256) { + return 1; + } +} diff --git a/solx/tests/data/contracts/solidity/TransientStorage.sol b/solx/tests/data/contracts/solidity/TransientStorage.sol new file mode 100644 index 000000000..17c6f1b89 --- /dev/null +++ b/solx/tests/data/contracts/solidity/TransientStorage.sol @@ -0,0 +1,7 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8.0; + +contract TransientStorage { + uint256 transient locked; +} diff --git a/solx/tests/data/standard_json_input/solidity_version.json b/solx/tests/data/standard_json_input/solidity_version.json new file mode 100644 index 000000000..ff0c0a1b9 --- /dev/null +++ b/solx/tests/data/standard_json_input/solidity_version.json @@ -0,0 +1,18 @@ +{ + "language": "Solidity", + "sources": { + "A": { + "content": "// SPDX-License-Identifier: Unlicensed\npragma solidity 0.8.20; contract C {}" + } + }, + "settings": { + "solidityVersion": "0.8.20", + "outputSelection": { + "*": { + "*": [ + "evm.bytecode.object" + ] + } + } + } +} diff --git a/solx/tests/data/standard_json_input/solidity_version_unsupported.json b/solx/tests/data/standard_json_input/solidity_version_unsupported.json new file mode 100644 index 000000000..6d35a1706 --- /dev/null +++ b/solx/tests/data/standard_json_input/solidity_version_unsupported.json @@ -0,0 +1,18 @@ +{ + "language": "Solidity", + "sources": { + "A": { + "content": "// SPDX-License-Identifier: Unlicensed\npragma solidity 0.8.20; contract C {}" + } + }, + "settings": { + "solidityVersion": "0.7.6", + "outputSelection": { + "*": { + "*": [ + "evm.bytecode.object" + ] + } + } + } +}