Skip to content
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
2 changes: 1 addition & 1 deletion bins/revme/src/cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ impl MainCmd {
Self::Statetest(cmd) | Self::Stest(cmd) => cmd.run()?,
Self::Evm(cmd) => cmd.run()?,
Self::Bytecode(cmd) => {
cmd.run();
cmd.run()?;
}
Self::Bench(cmd) => {
cmd.run();
Expand Down
15 changes: 8 additions & 7 deletions bins/revme/src/cmd/bytecode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ fn trim_decode(input: &str) -> Option<Bytes> {

impl Cmd {
/// Runs bytecode command.
pub fn run(&self) {
pub fn run(&self) -> Result<(), super::Error> {
if let Some(input_bytes) = &self.bytes {
let Some(bytes) = trim_decode(input_bytes) else {
eprintln!("Invalid hex string");
return;
// Fail on invalid hex to propagate a non-zero exit code
return Err(super::Error::Custom("Invalid hex string"));
};

if bytes.starts_with(&[0xEF, 0x00]) {
eprintln!(
"EOF bytecode is not supported - EOF has been removed from ethereum plan."
);
return;
// Fail on EOF bytecode as it's not supported
return Err(super::Error::Custom(
"EOF bytecode is not supported - EOF has been removed from ethereum plan.",
));
}

println!("Legacy bytecode:");
Expand All @@ -55,5 +55,6 @@ impl Cmd {
println!("No bytecode provided. EOF interactive mode has been removed.");
println!("Please provide bytecode as a hex string argument.");
}
Ok(())
}
}
Loading