fn check_txn_results(
        &mut self,
        senders: &mut [AccountData],
        sync_sequence_numbers: &HashMap<AccountAddress, u64>,
    ) -> (usize, usize) {
        let mut committed_txns = 0;
        let mut uncommitted_txns = 0;
        // Invariant for any account X in Benchmarker:
        // 1) X's current persisted sequence number (X.sequence_number) >=
        //    X's synchronized sequence number (sync_sequence_number[X])
        // 2) X's current persisted sequence number (X.sequence_number) >=
        //    X's previous persisted sequence number (self.prev_sequence_numbers[X])
        for sender in senders.iter_mut() {
            let prev_sequence_number = self
                .prev_sequence_numbers
                .get_mut(&sender.address)
                .expect("Sender doesn't exist in Benchmark environment");
            let sync_sequence_number = sync_sequence_numbers
                .get(&sender.address)
                .expect("Sender doesn't exist in validators");
            assert!(sender.sequence_number >= *sync_sequence_number);
            assert!(*sync_sequence_number >= *prev_sequence_number);
            if sender.sequence_number > *sync_sequence_number {
                error!("Account {:?} has uncommitted TXNs", sender.address);
            }
            committed_txns += *sync_sequence_number - *prev_sequence_number;
            uncommitted_txns += sender.sequence_number - *sync_sequence_number;
            *prev_sequence_number = *sync_sequence_number;
            sender.sequence_number = *sync_sequence_number;
        }
        info!(
            "#committed TXNs = {}, #uncommitted TXNs = {}",
            committed_txns, uncommitted_txns
        );
        let committed_txns_usize = committed_txns
            .try_into()
            .expect("Unable to convert u64 to usize");
        let uncommitted_txns_usize = uncommitted_txns
            .try_into()
            .expect("Unable to convert u64 to usize");
        OP_COUNTER.inc_by("committed_txns", committed_txns_usize);
        OP_COUNTER.inc_by("timedout_txns", uncommitted_txns_usize);
        (committed_txns_usize, uncommitted_txns_usize)
    }
/// With the previous stored sequence number (e.g. self.prev_sequence_numbers)
/// and the synchronized sequence number from validator, calculate how many TXNs are committed.
/// Update both senders sequence numbers and self.prev_sequence_numbers to the just-queried
/// synchrnized sequence numbers. Return (#committed, #uncommitted) TXNs.
/// Reason to backtrace sender's sequence number:
/// If some of sender's TXNs are not committed because they are rejected by AC,
/// we should use the synchronized sequence number in future TXN generation.
/// On the other hand, if sender's TXNs are accepted but just waiting to be committed,
/// part of the newly generated TXNs will be rejected by AC due to old sequence number,
/// but eventually local account's sequence number will be new enough to get accepted.
With the previous stored sequence number
and the synchronized sequence number from validator, calculate how many TXNs are committed.
Update both senders sequence numbers and self.prev_sequence_numbers to the just-queried
synchrnized sequence numbers. Return (#committed, #uncommitted) TXNs.
Reason to backtrace sender's sequence number:
If some of sender's TXNs are not committed because they are rejected by AC,
we should use the synchronized sequence number in future TXN generation.
On the other hand, if sender's TXNs are accepted but just waiting to be committed,
part of the newly generated TXNs will be rejected by AC due to old sequence number,
but eventually local account's sequence number will be new enough to get accepted.
With the previous stored sequence number and the synchronized sequence number from validator calculate how many TXNs are committed . Update both senders sequence numbers and self . prev_sequence_numbers to the just - queried synchrnized sequence numbers . Return ( #committed #uncommitted ) TXNs . Reason to backtrace sender ' s sequence number : If some of sender ' s TXNs are not committed because they are rejected by AC we should use the synchronized sequence number in future TXN generation . On the other hand if sender ' s TXNs are accepted but just waiting to be committed part of the newly generated TXNs will be rejected by AC due to old sequence number but eventually local account ' s sequence number will be new enough to get accepted .
fn check_txn_results(
        &mut self,
        senders: &mut [AccountData],
        sync_sequence_numbers: &HashMap<AccountAddress, u64>,
    ) -> (usize, usize) {
        let mut committed_txns = 0;
        let mut uncommitted_txns = 0;
        // Invariant for any account X in Benchmarker:
        // 1) X's current persisted sequence number (X.sequence_number) >=
        //    X's synchronized sequence number (sync_sequence_number[X])
        // 2) X's current persisted sequence number (X.sequence_number) >=
        //    X's previous persisted sequence number (self.prev_sequence_numbers[X])
        for sender in senders.iter_mut() {
            let prev_sequence_number = self
                .prev_sequence_numbers
                .get_mut(&sender.address)
                .expect("Sender doesn't exist in Benchmark environment");
            let sync_sequence_number = sync_sequence_numbers
                .get(&sender.address)
                .expect("Sender doesn't exist in validators");
            assert!(sender.sequence_number >= *sync_sequence_number);
            assert!(*sync_sequence_number >= *prev_sequence_number);
            if sender.sequence_number > *sync_sequence_number {
                error!("Account {:?} has uncommitted TXNs", sender.address);
            }
            committed_txns += *sync_sequence_number - *prev_sequence_number;
            uncommitted_txns += sender.sequence_number - *sync_sequence_number;
            *prev_sequence_number = *sync_sequence_number;
            sender.sequence_number = *sync_sequence_number;
        }
        info!(
            "#committed TXNs = {}, #uncommitted TXNs = {}",
            committed_txns, uncommitted_txns
        );
        let committed_txns_usize = committed_txns
            .try_into()
            .expect("Unable to convert u64 to usize");
        let uncommitted_txns_usize = uncommitted_txns
            .try_into()
            .expect("Unable to convert u64 to usize");
        OP_COUNTER.inc_by("committed_txns", committed_txns_usize);
        OP_COUNTER.inc_by("timedout_txns", uncommitted_txns_usize);
        (committed_txns_usize, uncommitted_txns_usize)
    }
fn check_txn_results ( & mut self , senders : & mut [ AccountData ] , sync_sequence_numbers : & HashMap < AccountAddress , u64 > , ) -> ( usize , usize ) { let mut committed_txns = 0 ; let mut uncommitted_txns = 0 ; // Invariant for any account X in Benchmarker: // 1) X's current persisted sequence number (X.sequence_number) >= //    X's synchronized sequence number (sync_sequence_number[X]) // 2) X's current persisted sequence number (X.sequence_number) >= //    X's previous persisted sequence number (self.prev_sequence_numbers[X]) for sender in senders . iter_mut ( ) { let prev_sequence_number = self . prev_sequence_numbers . get_mut ( & sender . address ) . expect ( " " ) ; let sync_sequence_number = sync_sequence_numbers . get ( & sender . address ) . expect ( " " ) ; assert ! ( sender sequence_number sync_sequence_number ) ; assert ! ( sync_sequence_number prev_sequence_number ) ; if sender . sequence_number > * sync_sequence_number { error ! ( " " sender address ) ; } committed_txns += * sync_sequence_number - * prev_sequence_number ; uncommitted_txns += sender . sequence_number - * sync_sequence_number ; * prev_sequence_number = * sync_sequence_number ; sender . sequence_number = * sync_sequence_number ; } info ! ( " " committed_txns uncommitted_txns ) ; let committed_txns_usize = committed_txns . try_into ( ) . expect ( " " ) ; let uncommitted_txns_usize = uncommitted_txns . try_into ( ) . expect ( " " ) ; OP_COUNTER . inc_by ( " " , committed_txns_usize ) ; OP_COUNTER . inc_by ( " " , uncommitted_txns_usize ) ; ( committed_txns_usize , uncommitted_txns_usize ) }
With the previous stored sequence number (e.g.
With the previous stored sequence number ( e . g .
&mut self
senders
&mut [AccountData]
sync_sequence_numbers
&HashMap<AccountAddress, u64>
&mut self
senders
&mut [AccountData]
sync_sequence_numbers
&HashMap<AccountAddress, u64>