Soft Bundle authority API implementation#17868
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
@shio-coder is attempting to deploy a commit to the Mysten Labs Team on Vercel. A member of the Team first needs to authorize it. |
29e3e14 to
f1887d5
Compare
| // For owned objects this will return without waiting for certificate to be sequenced | ||
| // First do quick dirty non-async check | ||
| if !epoch_store.is_tx_cert_consensus_message_processed(&certificate)? { | ||
| if !epoch_store.is_all_tx_certs_consensus_message_processed(&verified_certificates)? { |
There was a problem hiding this comment.
iiuc, this means that if a single transaction in the bundle is unprocessed, we will re-submit the entire bundle. That's okay from the protocol perspective, but is that what is desired for the submitter of the soft bundle? Or would they rather fail in this case, since it is known their bundle will not be sequenced in the order they expect?
There was a problem hiding this comment.
The intention here is to wait for all txs to be sequenced before proceeding. In a Soft Bundle context, the check was done previously (by using self.state.is_tx_already_executed()).
However this check cannot be enforced as another thread or another validator may be submitting a subset of the bundle and/or the entire bundle.
This falls into the case where Soft Bundle cannot guarantee specified ordering.
| }) | ||
| .collect::<Vec<_>>(); | ||
| self.consensus_adapter.submit_batch( | ||
| &transactions, |
There was a problem hiding this comment.
This seems like a potential bug, since we may be submitting already sequenced transactions, which would then be inserted into process_consensus_transactions. But it may be benign since insertions into that table are already racing with consensus handler. @mwtian any thoughts?
There was a problem hiding this comment.
My reading of the code is that this change does not seem to introduce new behavior. Transactions inflight or already sequenced in consensus can be submitted to consensus adapter, as mentioned by the "quick dirty non-async check" above. This behavior should be tolerated right now. I think only unique transactions by digests are or can be used for epoch change and revert.
There was a problem hiding this comment.
I agree - any extra checkpointed transactions in that table are ignored and not reverted
f1887d5 to
2f698d0
Compare
| .contains_key(key)?) | ||
| } | ||
|
|
||
| pub fn check_consensus_messages_processed<'a>( |
There was a problem hiding this comment.
Do we have to remove the lifetime and pass-by-reference? I think we should be able to call this from is_any_tx_certs_consensus_message_processed and also pass by reference?
There was a problem hiding this comment.
I have updated this a bit so that there is no copy involved. Now is_any_tx_certs_consensus_message_processed would have lifetime and pass-by-reference, then it owns keys until it is passed to and consumed by this function.
| /// Soft Bundle request. See [SIP-19](https://github.com/sui-foundation/sips/blob/main/sips/sip-19.md). | ||
| #[derive(Clone, Debug, Serialize, Deserialize)] | ||
| pub struct HandleSoftBundleCertificatesRequestV3 { | ||
| pub certificates: Vec<CertifiedTransaction>, |
There was a problem hiding this comment.
I think we should use the NonEmpty type here so that we don't have to worry about whether it is empty.
There was a problem hiding this comment.
This is part of gRPC protocol definition and it seems Serialize is not implemented for NonEmpty
| let should_submit = if is_soft_bundle { | ||
| fp_ensure!( | ||
| !epoch_store | ||
| .is_any_tx_certs_consensus_message_processed(&verified_certificates)?, |
There was a problem hiding this comment.
If you move this check to be together with all the other soft bundle specific checks, here you can simply submit if any cert is not already submitted. Once you do so, we could then even remove the is_soft_bundle argument from this function.
There was a problem hiding this comment.
I have moved the check to soft_bundle_validity_check, which is closer to its RPC handler.
Now the only place that relies on is_soft_bundle is where we determine whether it is necessary to check if the first certificate has been executed.
2f698d0 to
133df46
Compare
133df46 to
98bf253
Compare
127e2ff to
e8882b2
Compare
185f18c to
8fbc7d2
Compare
## Description This is a follow up change after PR #17508 and #17868 , for SIP-19. The change adds a unit test for soft bundle failure modes, as well as enable soft bundle feature flag in devnet and testnet. ## Test plan The feature is not exactly user-facing and do not break anything. --- ## Release notes - [x] Protocol: Enable soft bundle on Protocol Version 50 in devnet and testnet. - [ ] Nodes (Validators and Full nodes): - [ ] Indexer: - [ ] JSON-RPC: - [ ] GraphQL: - [ ] CLI: - [ ] Rust SDK: --------- Co-authored-by: Mark Logan <103447440+mystenmark@users.noreply.github.com>
## Description This is a follow up change after PR MystenLabs#17508 , for [SIP-19](https://github.com/sui-foundation/sips/blob/main/sips/sip-19.md). The changeset focuses on sui-core, particularly authority server, to add a new API `SoftBundleCertifiedTransactionsV3` that allows submission of a Soft Bundle through gRPC. The API accepts a list of `CertifiedTransaction` for input, then returns either nothing (should `wait_for_effects` be `false`) or a list of `HandleCertificateResponseV3` containing the execution result. The API is named `_v3` because it reuses `HandleCertificateResponseV3`. Besides introducing a new feature flag and a protocol config field, a local node config field `enable_soft_bundle` is also added, to allow a validator node to turn off soft bundle support without having to upgrade the entire network. This can be useful should the feature causes undesired effect. ## Test plan The feature is not exactly user-facing and do not break anything. --- ## Release notes - [x] Protocol: New feature flag and protocol config fields will be introduced. - [x] Nodes (Validators and Full nodes): A new API `SoftBundleCertifiedTransactionsV3` will be added. - [ ] Indexer: - [ ] JSON-RPC: - [ ] GraphQL: - [ ] CLI: - [ ] Rust SDK: --------- Co-authored-by: Mark Logan <mark@mystenlabs.com>
## Description This is a follow up change after PR MystenLabs#17508 and MystenLabs#17868 , for SIP-19. The change adds a unit test for soft bundle failure modes, as well as enable soft bundle feature flag in devnet and testnet. ## Test plan The feature is not exactly user-facing and do not break anything. --- ## Release notes - [x] Protocol: Enable soft bundle on Protocol Version 50 in devnet and testnet. - [ ] Nodes (Validators and Full nodes): - [ ] Indexer: - [ ] JSON-RPC: - [ ] GraphQL: - [ ] CLI: - [ ] Rust SDK: --------- Co-authored-by: Mark Logan <103447440+mystenmark@users.noreply.github.com>
Description
This is a follow up change after PR #17508 , for SIP-19.
The changeset focuses on sui-core, particularly authority server, to add a new API
SoftBundleCertifiedTransactionsV3that allows submission of a Soft Bundle through gRPC.The API accepts a list of
CertifiedTransactionfor input, then returns either nothing (shouldwait_for_effectsbefalse) or a list ofHandleCertificateResponseV3containing the execution result.The API is named
_v3because it reusesHandleCertificateResponseV3.Besides introducing a new feature flag and a protocol config field, a local node config field
enable_soft_bundleis also added, to allow a validator node to turn off soft bundle support without having to upgrade the entire network. This can be useful should the feature causes undesired effect.Test plan
The feature is not exactly user-facing and do not break anything.
Release notes
SoftBundleCertifiedTransactionsV3will be added.