-
Notifications
You must be signed in to change notification settings - Fork 32
GH-605: Teach the PayableScanner on tx retries #663
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
Conversation
… FailedPayable Table
…h_same_hash_are_present_in_the_input intermittently passes or fails
…_their_fingerprints_exist
…rprints_exist passes
…txs_were_found_in_db
| let sent_payable_dao_factory = Box::new(Accountant::dao_factory(data_directory)); | ||
| let failed_payable_dao_factory = Box::new(Accountant::dao_factory(data_directory)); | ||
| let failed_payable_dao_factory = Box::new(Accountant::dao_factory(data_directory)); | ||
| let sent_payable_dao_factory = Box::new(Accountant::dao_factory(data_directory)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| fn cmp(&self, other: &Self) -> Ordering { | ||
| todo!() | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| let sent_payable_dao_factory = Box::new(Accountant::dao_factory(data_directory)); | ||
| let failed_payable_dao_factory = Box::new(Accountant::dao_factory(data_directory)); | ||
| let failed_payable_dao_factory = Box::new(Accountant::dao_factory(data_directory)); | ||
| let sent_payable_dao_factory = Box::new(Accountant::dao_factory(data_directory)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: DAO Factory Overwriting Causes Memory Leak
The failed_payable_dao_factory and sent_payable_dao_factory are each declared twice. The first failed_payable_dao_factory instance is immediately overwritten and leaked, while the second sent_payable_dao_factory declaration overwrites the initial one. This duplication suggests a copy-paste error, resulting in unused resources and a memory leak.
| } | ||
| if failed > 0 { | ||
| self.insert_records_in_failed_payables(&batch_results.failed_txs); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Duplicate Transaction Records in Sent Payables
The PayableScanner is redundantly inserting successful transaction records into the sent_payable table during SentPayables message processing. This occurs in both new and retry scan handlers, even though these records are already handled by the BlockchainBridge.
Additional Locations (1)
| let sent_payable_dao_factory = Box::new(Accountant::dao_factory(data_directory)); | ||
| let failed_payable_dao_factory = Box::new(Accountant::dao_factory(data_directory)); | ||
| let failed_payable_dao_factory = Box::new(Accountant::dao_factory(data_directory)); | ||
| let sent_payable_dao_factory = Box::new(Accountant::dao_factory(data_directory)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| let sent_payable_dao_factory = Box::new(Accountant::dao_factory(data_directory)); | ||
| let failed_payable_dao_factory = Box::new(Accountant::dao_factory(data_directory)); | ||
| let failed_payable_dao_factory = Box::new(Accountant::dao_factory(data_directory)); | ||
| let sent_payable_dao_factory = Box::new(Accountant::dao_factory(data_directory)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Duplicate Factory Declarations Overwrite Instances
The failed_payable_dao_factory and sent_payable_dao_factory variables are declared twice consecutively. The second declaration for each immediately shadows and overwrites the first, causing the initially created factory instances to be dropped unused. This wastes resources and appears to be a copy-paste error.
| let sent_payable_dao_factory = Box::new(Accountant::dao_factory(data_directory)); | ||
| let failed_payable_dao_factory = Box::new(Accountant::dao_factory(data_directory)); | ||
| let failed_payable_dao_factory = Box::new(Accountant::dao_factory(data_directory)); | ||
| let sent_payable_dao_factory = Box::new(Accountant::dao_factory(data_directory)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| .map(|signable_tx_template| signable_tx_template.amount_in_wei) | ||
| .max() | ||
| .expect("there aren't any templates") | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| let sent_payable_dao_factory = Box::new(Accountant::dao_factory(data_directory)); | ||
| let failed_payable_dao_factory = Box::new(Accountant::dao_factory(data_directory)); | ||
| let failed_payable_dao_factory = Box::new(Accountant::dao_factory(data_directory)); | ||
| let sent_payable_dao_factory = Box::new(Accountant::dao_factory(data_directory)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| let pending_tx_hashes_opt = self.harvest_pending_payables(); | ||
| let failure_hashes_opt = self.harvest_unproven_failures(); | ||
| eprintln!("ph: {:?}", pending_tx_hashes_opt); | ||
| eprintln!("fail: {:?}", failure_hashes_opt); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Sensitive Data Exposure in Debug Statements
Debug eprintln! statements were accidentally committed, printing potentially sensitive transaction hash information to stderr in production.
Additional Locations (1)
…r PartialOrd and Ord
| match self.sent_payable_dao.insert_new_records(&msg.new_sent_txs) { | ||
| let sent_txs: BTreeSet<SentTx> = msg.new_sent_txs.iter().cloned().collect(); | ||
|
|
||
| match self.sent_payable_dao.insert_new_records(&sent_txs) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Silent Deduplication Causes Data Loss
Converting Vec<SentTx> to BTreeSet<SentTx> before insertion silently deduplicates transactions. This can lead to data loss if legitimate duplicate entries need individual processing, or mask error conditions where duplicates should be explicitly flagged by insert_new_records.
Note
Implement a new templated New/Retry payable pipeline with batch submission and BTreeSet-backed DAOs, refactoring scanners, bridge/interfaces, and error/typing across the stack.
BatchResults(sent/failed txs); add detailed error typing (LocalPayableError,AppRpcErrorKind, etc.).Eitherpriced templates; add gas-price ceiling handling and transmission logging.BTreeSet, addOrd/PartialOrdimpls and deterministic ordering for tx/status types.FailedTxconversions and new retrieval/update helpers (e.g., by receiver addresses); enhancePayableDaoretrieval with conditions.join_with_commas/join_with_separatorandbtreeset!macro; remove old scanner utils.Written by Cursor Bugbot for commit 02d98fb. This will update automatically on new commits. Configure here.