Repository: MystenLabs/sui
File: crates/sui-core/src/transaction_driver/effects_certifier.rs (Rust)

Code before:
                // After delay, try to start a fallback request to an acked validator
                _ = fallback_delay.tick() => {
                    // Drain all available acked validators and pick one we haven't tried
                    while let Ok(acked_validator) = acked_validators_rx.try_recv() {
                        // We send ack requests to all validators, so skip if the acked validator was the initial target
                        if acked_validator == initial_target {
                            continue;
                        }

                        let Some(client) = authority_aggregator.authority_clients.get(&acked_validator) else {
                            continue;
                        };

                        tracing::debug!(
                            ?acked_validator,
                            "Starting fallback get_full_effects request"
                        );

                        let client = client.clone();
                        let fut = self.get_full_effects(
                            client,
                            tx_digest,
                            tx_type,
                            consensus_position,
                            options,
                        );

                        pending_requests.push(Box::pin(async move {
                            (acked_validator, fut.await)
                        }));

                        // Only start one fallback per interval
                        break;
                    }
                }
            }
        }
    }

    #[instrument(level = "debug", skip_all, err(level = "debug"), ret, fields(consensus_position = ?consensus_position))]
    async fn wait_for_acknowledgments<A>(
        &self,
        authority_aggregator: &Arc<AuthorityAggregator<A>>,
        client_monitor: &Arc<ValidatorClientMonitor<A>>,
        tx_digest: Option<TransactionDigest>,
        tx_type: TxType,
        consensus_position: Option<ConsensusPosition>,
        options: &SubmitTransactionOptions,
        submitted_tx_to_validator: AuthorityName,
        acked_validators_tx: Sender<AuthorityName>,
    ) -> Result<TransactionEffectsDigest, TransactionDriverError>

Review comment (suggestion):
```suggestion
                        let fut = self.get_full_effects(
                            client.clone(),
                            tx_digest,
                            tx_type,
                            consensus_position,
                            options,
                        );
```

Code after:
                        }

                        let Some(client) = authority_aggregator.authority_clients.get(&acked_validator) else {
                            continue;
                        };

                        tracing::debug!(
                            ?acked_validator,
                            "Starting fallback get_full_effects request"
                        );

                        let fut = self.get_full_effects(
                            client.clone(),
                            tx_digest,
                            tx_type,
                            consensus_position,
                            options,
                        );

                        pending_requests.push(Box::pin(async move {
                            (acked_validator, fut.await)
                        }));

                        // Only start one fallback per interval
                        break;
                    }
                }
            }
        }
    }

    #[instrument(level = "debug", skip_all, err(level = "debug"), ret, fields(consensus_position = ?consensus_position))]
    async fn wait_for_acknowledgments<A>(
        &self,
        authority_aggregator: &Arc<AuthorityAggregator<A>>,
        client_monitor: &Arc<ValidatorClientMonitor<A>>,
        tx_digest: Option<TransactionDigest>,
        tx_type: TxType,
        consensus_position: Option<ConsensusPosition>,
        options: &SubmitTransactionOptions,
        submitted_tx_to_validator: AuthorityName,
        acked_validators_tx: Sender<AuthorityName>,
    ) -> Result<TransactionEffectsDigest, TransactionDriverError>
    where
        A: AuthorityAPI + Send + Sync + 'static + Clone,
    {
        let ping_type = get_ping_type(&tx_digest, tx_type);
        let ping_label = if tx_digest.is_none() { "true" } else { "false" };
        self.metrics
            .certified_effects_ack_attempts
            .with_label_values(&[tx_type.as_str(), ping_label])