Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

t8n: write output body to sys.stdout if specified #823

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 12 additions & 9 deletions src/ethereum_spec_tools/evm_tools/t8n/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,17 +404,20 @@ def run(self) -> int:
json_state = self.alloc.to_json()
json_result = self.result.to_json()

json_output = {}

if self.options.output_body:
petertdavies marked this conversation as resolved.
Show resolved Hide resolved
txs_rlp_path = os.path.join(
self.options.output_basedir,
self.options.output_body,
)
txs_rlp = "0x" + rlp.encode(self.txs.all_txs).hex()
with open(txs_rlp_path, "w") as f:
json.dump(txs_rlp, f)
self.logger.info(f"Wrote transaction rlp to {txs_rlp_path}")

json_output = {}
if self.options.output_body == "stdout":
json_output["body"] = txs_rlp
else:
txs_rlp_path = os.path.join(
self.options.output_basedir,
self.options.output_body,
)
with open(txs_rlp_path, "w") as f:
json.dump(txs_rlp, f)
self.logger.info(f"Wrote transaction rlp to {txs_rlp_path}")

if self.options.output_alloc == "stdout":
json_output["alloc"] = json_state
Expand Down