Skip to content

Commit 861db83

Browse files
authored
fix: TODOs and disabled tests (#13)
1 parent 9b99546 commit 861db83

18 files changed

Lines changed: 92 additions & 290 deletions

File tree

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ for guidance how to work with PRs created from a fork.
2323

2424
## Licenses
2525

26-
If you contribute to this project, your contributions will be made to the project under TODO: license.
26+
If you contribute to this project, your contributions will be made to the project under the GPL-3.0 license.
2727

2828
## Code of Conduct
2929

era-solidity

solx/src/build_evm/contract.rs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,9 @@ impl Contract {
6767
self,
6868
path: String,
6969
output_metadata: bool,
70-
output_assembly: bool,
7170
output_binary: bool,
7271
) -> anyhow::Result<()> {
7372
writeln!(std::io::stdout(), "\n======= {path} =======")?;
74-
if output_assembly {
75-
writeln!(std::io::stdout(), "Assembly:\nTODO")?;
76-
}
7773
if output_metadata {
7874
writeln!(std::io::stdout(), "Metadata:\n{}", self.metadata_json)?;
7975
}
@@ -96,7 +92,6 @@ impl Contract {
9692
self,
9793
output_path: &Path,
9894
output_metadata: bool,
99-
output_assembly: bool,
10095
output_binary: bool,
10196
overwrite: bool,
10297
) -> anyhow::Result<()> {
@@ -133,25 +128,6 @@ impl Contract {
133128
}
134129
}
135130

136-
if output_assembly {
137-
let output_name = format!(
138-
"{}.{}",
139-
self.name.name.as_deref().unwrap_or(file_name),
140-
"asm"
141-
);
142-
let mut output_path = output_path.clone();
143-
output_path.push(output_name.as_str());
144-
145-
if output_path.exists() && !overwrite {
146-
anyhow::bail!(
147-
"Refusing to overwrite an existing file {output_path:?} (use --overwrite to force)."
148-
);
149-
} else {
150-
std::fs::write(output_path.as_path(), "TODO".as_bytes())
151-
.map_err(|error| anyhow::anyhow!("File {output_path:?} writing: {error}"))?;
152-
}
153-
}
154-
155131
if output_binary {
156132
let output_name = format!(
157133
"{}.{}",

solx/src/build_evm/mod.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -94,27 +94,23 @@ impl Build {
9494
pub fn write_to_terminal(
9595
mut self,
9696
output_metadata: bool,
97-
output_assembly: bool,
9897
output_binary: bool,
9998
) -> anyhow::Result<()> {
10099
self.take_and_write_warnings();
101100
self.exit_on_error();
102101

103-
if !output_metadata && !output_assembly && !output_binary {
102+
if !output_metadata && !output_binary {
104103
writeln!(
105104
std::io::stderr(),
106-
"Compiler run successful. No output requested. Use flags --metadata, --asm, --bin."
105+
"Compiler run successful. No output requested. Use flags `--bin` and `--metadata`."
107106
)?;
108107
return Ok(());
109108
}
110109

111110
for (path, build) in self.results.into_iter() {
112-
build.expect("Always valid").write_to_terminal(
113-
path,
114-
output_metadata,
115-
output_assembly,
116-
output_binary,
117-
)?;
111+
build
112+
.expect("Always valid")
113+
.write_to_terminal(path, output_metadata, output_binary)?;
118114
}
119115

120116
Ok(())
@@ -127,7 +123,6 @@ impl Build {
127123
mut self,
128124
output_directory: &Path,
129125
output_metadata: bool,
130-
output_assembly: bool,
131126
output_binary: bool,
132127
overwrite: bool,
133128
) -> anyhow::Result<()> {
@@ -140,7 +135,6 @@ impl Build {
140135
build.expect("Always valid").write_to_directory(
141136
output_directory,
142137
output_metadata,
143-
output_assembly,
144138
output_binary,
145139
overwrite,
146140
)?;

solx/src/solx/arguments.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ pub struct Arguments {
6363

6464
/// Pass arbitrary space-separated options to LLVM.
6565
/// The argument must be a single-quoted string following a `=` separator.
66-
/// Example: `--llvm-options='-eravm-jump-table-density-threshold=10'`. TODO: update
66+
/// Example: `--llvm-options='arg1 arg2 arg3 ... argN'`.
6767
#[arg(long)]
6868
pub llvm_options: Option<String>,
6969

@@ -120,10 +120,6 @@ pub struct Arguments {
120120
#[arg(long)]
121121
pub metadata_literal: bool,
122122

123-
/// Output assembly of the compiled contracts.
124-
#[arg(long = "asm")]
125-
pub output_assembly: bool,
126-
127123
/// Output metadata of the compiled project.
128124
#[arg(long = "metadata")]
129125
pub output_metadata: bool,
@@ -253,7 +249,7 @@ impl Arguments {
253249
}
254250

255251
if self.standard_json.is_some() {
256-
if self.output_assembly || self.output_metadata || self.output_binary {
252+
if self.output_metadata || self.output_binary {
257253
messages.push(solx_solc::StandardJsonOutputError::new_error(
258254
"Cannot output data outside of JSON in standard JSON mode.",
259255
None,

solx/src/solx/main.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -202,16 +202,11 @@ fn main_inner(
202202
build.write_to_directory(
203203
&output_directory,
204204
arguments.output_metadata,
205-
arguments.output_assembly,
206205
arguments.output_binary,
207206
arguments.overwrite,
208207
)?;
209208
} else {
210-
build.write_to_terminal(
211-
arguments.output_metadata,
212-
arguments.output_assembly,
213-
arguments.output_binary,
214-
)?;
209+
build.write_to_terminal(arguments.output_metadata, arguments.output_binary)?;
215210
}
216211

217212
Ok(())

solx/src/yul/parser/statement/expression/function_call.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,6 @@ impl FunctionCall {
256256
}
257257
Name::Pop => {
258258
let _arguments = self.pop_arguments_llvm::<1>(context)?;
259-
// TODO
260259
Ok(None)
261260
}
262261

solx/tests/cli/asm.rs

Lines changed: 0 additions & 38 deletions
This file was deleted.

solx/tests/cli/general.rs

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,14 @@ fn no_arguments() -> anyhow::Result<()> {
2121
Ok(())
2222
}
2323

24-
#[test_case(
25-
crate::common::SOLIDITY_BIN_OUTPUT_NAME,
26-
crate::common::SOLIDITY_ASM_OUTPUT_NAME
27-
)]
28-
fn multiple_output_options(
29-
bin_output_file_name: &str,
30-
asm_output_file_name: &str,
31-
) -> anyhow::Result<()> {
24+
#[test_case(crate::common::SOLIDITY_BIN_OUTPUT_NAME)]
25+
fn multiple_output_options(bin_output_file_name: &str) -> anyhow::Result<()> {
3226
crate::common::setup()?;
3327
let tmp_dir = TempDir::new()?;
3428
let args = &[
3529
crate::common::TEST_SOLIDITY_CONTRACT_PATH,
3630
"-O3",
3731
"--bin",
38-
"--asm",
3932
"--output-dir",
4033
tmp_dir.path().to_str().unwrap(),
4134
];
@@ -51,19 +44,11 @@ fn multiple_output_options(
5144
.path()
5245
.join(crate::common::TEST_SOLIDITY_CONTRACT_NAME)
5346
.join(bin_output_file_name);
54-
let asm_output_file = tmp_dir
55-
.path()
56-
.join(crate::common::TEST_SOLIDITY_CONTRACT_NAME)
57-
.join(asm_output_file_name);
5847

5948
assert!(bin_output_file.exists());
60-
assert!(asm_output_file.exists());
6149
assert!(!crate::cli::is_file_empty(
6250
bin_output_file.to_str().unwrap()
6351
)?);
64-
assert!(!crate::cli::is_file_empty(
65-
asm_output_file.to_str().unwrap()
66-
)?);
6752

6853
Ok(())
6954
}

solx/tests/cli/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use assert_cmd::assert::OutputAssertExt;
88
use assert_cmd::cargo::CommandCargoExt;
99

1010
mod allow_paths;
11-
mod asm;
1211
mod base_path;
1312
mod bin;
1413
mod debug_output_dir;

0 commit comments

Comments
 (0)