-
Notifications
You must be signed in to change notification settings - Fork 18
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
Feature/immediately handle subintent nullification #1016
Feature/immediately handle subintent nullification #1016
Conversation
Docker tags |
Quality Gate passedIssues Measures |
MempoolRejectionReason::TransactionIntentAlreadyCommitted(_) => false, | ||
MempoolRejectionReason::SubintentAlreadyFinalized(_) => false, | ||
MempoolRejectionReason::FromExecution(_) => true, | ||
MempoolRejectionReason::ValidationError(_) => false, |
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.
Per cuttlefish update, transaction validation is stateful. Is the permanent rejection logic below still correct?
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.
Not quite - if a Cuttlefish-only transaction is evaluated against Bottlenose it will be permanently rejected at validation time, but then become acceptable in Cuttlefish.
I think this is unlikely to cause any critical issues -- and have some ideas for tweaking this in future, as discussed in the task list document -- but it's quite a hard subject to resolve satisfactorily without a lot of work. Happy to discuss later in the week.
Vec<SubintentHash>, | ||
), | ||
>, | ||
// INVARIANT: The `intent_lookup` and `subintent_lookup` are kept exactly in sync with |
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.
Is mempool transaction adding single-threaded? The "sync" logic doesn't look thread-safe - there is a race condition where the reverse lookup goes out-of-sync with pending transaction records.
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.
Inside the pending_transaction_result_cache.rs
, we have a &mut self
so know we have locally exclusive access - the locking and co-ordination is controlled in the mempool_manager.rs
parent -- but please do verify it for correctness :)
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.
You're right. The &mut
references are obtained from write()
on the RW Lock, not some unsafe transmutation, which prevents unsynchronized modification to the cache data structure.
Summary
The main intention was to ensure subintent handling is fixed/immediate in the pending result cache and the mempool.
As part of this ticket, I worked through a few refactors:
MempoolManager
where it can (A) safely handle atomicity of operations and avoid deadlocks, and (B) enable us to eventually safely refactor and possibly merge the cache and mempool. That was the intended direction ~18 months ago, I'm not quite sure why it ended up not being finished - but I've pushed through with the merger anyway. I think it works nicely.add_if_committable_internal
I expect this to have a non-trivial impact on throughput.AtState
so we can't use the wrong thing by mistake; and commonise the code.Testing
Might add some more unit tests tomorrow.