diff --git a/src/evm_transition_tool/__init__.py b/src/evm_transition_tool/__init__.py index 0fd9cf5bec..60e4d34e89 100644 --- a/src/evm_transition_tool/__init__.py +++ b/src/evm_transition_tool/__init__.py @@ -149,6 +149,7 @@ class EvmTransitionTool(TransitionTool): binary: Path cached_version: Optional[str] = None trace: bool + require_t8n: bool = True def __init__( self, @@ -174,6 +175,10 @@ def __init__( raise Exception("evm process unexpectedly returned a non-zero status code: " f"{e}.") except Exception as e: raise Exception(f"Unexpected exception calling evm tool: {e}.") + if not result.stdout.strip(): + args = [str(self.binary), "--help"] + result = subprocess.run(args, capture_output=True, text=True) + self.require_t8n = False self.help_string = result.stdout def evaluate( @@ -199,7 +204,6 @@ def evaluate( reward = -1 args = [ str(self.binary), - "t8n", "--input.alloc=stdin", "--input.txs=stdin", "--input.env=stdin", @@ -212,6 +216,9 @@ def evaluate( f"--state.reward={reward}", ] + if self.require_t8n: + args.insert(1, "t8n") + if self.trace: args.append("--trace") @@ -264,6 +271,12 @@ def version(self) -> str: stdout=subprocess.PIPE, ) + if result.returncode != 0: + result = subprocess.run( + [str(self.binary), "--version"], + stdout=subprocess.PIPE, + ) + if result.returncode != 0: raise Exception("failed to evaluate: " + result.stderr.decode())