remove exported output file on error#119
Merged
louisliu2048 merged 1 commit intomainfrom Jan 26, 2026
Merged
Conversation
JimmyShi22
approved these changes
Jan 26, 2026
Contributor
JimmyShi22
left a comment
There was a problem hiding this comment.
LGTM, this code will delete the file when error or ctr-c
Vui-Chee
added a commit
that referenced
this pull request
Jan 30, 2026
* dev: fix: upgrade reth v1.10.2 version with bug fixes (#134) Update dependencies, use reth v1.10.2 and builder v0.3.0 (#133) chore: fix rust formatter (#132) chore: better rename, fix unused variable warning (#99) (#131) Fix comments (#127) Add trace log on tx cache hits (#126) replace magic error code number to INTERNAL_ERROR_CODE (#125) feat(legacy): remove eth_transactionPreExec (#124) fix tools readme (#123) fix(rpc): improve parameter validation in get_logs and service methods (#121) remove output file on error (#119) feat(legacy): support legacy routing for batch requests (#117) fix(legacy): avoid possible panic on malformed block params (#111) fallback to legacy if res is empty (#118) refactor(rpc): remove transaction_pre_exec API (#120) use XLayerPayloadServiceBuilder to simplify main() codes, merge to main branch (#112) fix(tools): check end block >= start block (#116) forward req to legacy on err (#110) fix: resolve audit issues related to flashblocks subscription (#113) fix(rpc): add trace_address for delegatecall and fix address format c… (#104)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Issue
The export command creates the output file before executing any export work, then returns early on errors, e.g., failed block reads, interrupts, or invalid ranges, without removing or rolling back the newly created file. When the export loop is skipped or aborted, it leaves behind an empty or partial file. At the same time, the command still appears to have produced an artifact, increasing the likelihood that operators will treat incomplete exports as valid backups.Consider ensuring that any early-return path removes the partially created file so that failed exports do not leave behind misleading artifacts.
Fix
We modified the execute() function to remove the output file if an error occurs. We wrap the main logic in a closure block and add cleanup logic on error (file bin/toolsexport.rs).
Type of Change
Code Guidelines
Before submitting your PR, please review the relevant code guidelines in the
docs/folder:Specific Guidelines by Component:
Checklist
docs/folderTesting
Previously:
exported.rlp 0 bytes
After fix: