Fix issue #2070. Don't fail context update when there is a - #2098
Conversation
send_mn_transaction record of a transaction that wasn't included in Midnight Ledger. Signed-off-by: Lech Głowiak <lech.glowiak@shielded.io>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 263d604ec6
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| "Failing result {err:?} of validating tx 0x{hash} \nto update Local Ledger State" | ||
| ); | ||
| (new_ledger_state, offers, vec![], SyntheticCost::ZERO) | ||
| (tx_context.ref_state.clone(), vec![], vec![], SyntheticCost::ZERO) |
There was a problem hiding this comment.
Keep malformed locally generated transactions as errors
This fallback also applies to the public update_from_tx path, not only historical replay. The ledger-8 batch generator calls that method at util/toolkit/src/tx_generator/builder/builders/ledger_8/batches.rs:321-323 and 480-483, then unconditionally appends the transaction; if a generated transaction fails well_formed, this branch now returns Ok without updating state, so subsequent batches can reuse the same inputs and the command can emit an invalid transaction chain instead of failing. Restrict this tolerance to block replay, while preserving InvalidTransaction for local updates.
Useful? React with 👍 / 👎.
| tx.erase_proofs().well_formed(ref_state, strictness, tblock) | ||
| }; | ||
|
|
||
| match valid_tx { |
There was a problem hiding this comment.
Mirror the fallback in the ledger-9 replay path
The new handling exists only in the ledger-8 context, while LedgerVersion::from_spec_version routes every 2.0.0+ block to ledger 9 and apply_block_9 invokes the unchanged ledger_9::LedgerContext::update_from_block. Consequently, any failed send_mn_transaction whose ledger-9 well_formed check returns Err still aborts replay at ledger/helpers/src/ledger_9/context.rs:412-417, reproducing the same outage for current ledger-9 history. Apply the same replay-only fallback to the ledger-9 implementation.
Useful? React with 👍 / 👎.
Overview
Fixed #2070 by not crashing replay when there is a
send_mn_transactionrecord of a transaction that wasn't included in Midnight Ledger because it was not well formed.🗹 TODO before merging
📌 Submission Checklist
git commit -s) for the DCO🧪 Testing Evidence
Please describe any additional testing aside from CI:
🔱 Fork Strategy
Links