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

Code before:
            async {
                // No need to send a full effects request if it is already provided.
                if let Some(full_effects) = full_effects {
                    // In this branch, current_target is the authority providing the full effects,
                    // so it is consistent. This is not used though because current_target is
                    // only used with failed full effects query.
                    return (Ok(full_effects), current_target);
                }
                let (name, client) = retrier
                    .next_target()
                    .expect("there should be at least 1 target");
                current_target = name;
                full_effects_start_time = Some(Instant::now());
                let result = self
                    .get_full_effects_with_fallback(
                        authority_aggregator,
                        client,
                        current_target,
                        tx_digest,
                        tx_type,
                        consensus_position,
                        options,
                        acked_validators_rx,
                    )
                    .await;
                (result.0, result.1)
            },
        );
        current_target = returned_target;

        // If the consensus position got rejected, effects certification will see the failure and gather
        // error messages to explain the rejection.
        let certified_digest = acknowledgments_result?;

        // Retry until there is a valid full effects that matches the certified digest, or all targets
        // have been attempted.
        loop {
            let display_name = authority_aggregator.get_display_name(&current_target);
            match full_effects_result {
                Ok((effects_digest, executed_data, _fast_path)) => {
                    if effects_digest != certified_digest {
                        tracing::warn!(
                            ?current_target,
                            "Full effects digest mismatch ({} vs certified {})",
                            effects_digest,
                            certified_digest
                        );
                        // This validator is byzantine, record the error.
                        client_monitor.record_interaction_result(OperationFeedback {
                            authority_name: current_target,
                            display_name,

Review comment (security):
Does this work?
```suggestion
                self
                    .get_full_effects_with_fallback(
                        authority_aggregator,
                        client,
                        current_target,
                        tx_digest,
                        tx_type,
                        consensus_position,
                        options,
                        acked_validators_rx,
                    )
                    .await
```

Code after:
                current_target,
                acked_validators_tx,
            ),
            async {
                // No need to send a full effects request if it is already provided.
                if let Some(full_effects) = full_effects {
                    // In this branch, current_target is the authority providing the full effects,
                    // so it is consistent. This is not used though because current_target is
                    // only used with failed full effects query.
                    return (Ok(full_effects), current_target);
                }
                let (name, client) = retrier
                    .next_target()
                    .expect("there should be at least 1 target");
                full_effects_start_time = Some(Instant::now());
                self.get_full_effects_with_fallback(
                    authority_aggregator,
                    client,
                    name,
                    tx_digest,
                    tx_type,
                    consensus_position,
                    options,
                    acked_validators_rx,
                )
                .await
            },
        );
        current_target = returned_target;

        // If the consensus position got rejected, effects certification will see the failure and gather
        // error messages to explain the rejection.
        let certified_digest = acknowledgments_result?;

        // Retry until there is a valid full effects that matches the certified digest, or all targets
        // have been attempted.
        loop {
            let display_name = authority_aggregator.get_display_name(&current_target);
            match full_effects_result {
                Ok((effects_digest, executed_data, _fast_path)) => {
                    if effects_digest != certified_digest {
                        tracing::warn!(
                            ?current_target,
                            "Full effects digest mismatch ({} vs certified {})",
                            effects_digest,
                            certified_digest
                        );
                        // This validator is byzantine, record the error.
                        client_monitor.record_interaction_result(OperationFeedback {
                            authority_name: current_target,
                            display_name,