Skip to content

Commit

Permalink
Don't sync in Authority Aggregator (MystenLabs#3599)
Browse files Browse the repository at this point in the history
  • Loading branch information
lxfind authored Jul 29, 2022
1 parent ee2834e commit f0f71b6
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 60 deletions.
15 changes: 1 addition & 14 deletions crates/sui-core/src/authority_aggregator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1182,24 +1182,11 @@ where
.await
}

/// Takes a transaction, brings all authorities up to date with the versions of the
/// objects needed, and then submits the transaction to make a certificate.
/// Submits the transaction to a quorum of validators to make a certificate.
pub async fn process_transaction(
&self,
transaction: Transaction,
) -> Result<CertifiedTransaction, SuiError> {
// Find out which objects are required by this transaction and
// ensure they are synced on authorities.
let required_ids: Vec<ObjectID> = transaction
.data
.input_objects()?
.iter()
.map(|o| o.object_id())
.collect();

let (_active_objects, _deleted_objects) =
self.sync_all_given_objects(&required_ids).await?;

// Now broadcast the transaction to all authorities.
let threshold = self.committee.quorum_threshold();
let validity = self.committee.validity_threshold();
Expand Down
46 changes: 0 additions & 46 deletions crates/sui-core/src/unit_tests/authority_aggregator_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -696,52 +696,6 @@ async fn test_sync_all_owned_objects() {
);
}

#[tokio::test]
async fn test_process_transaction1() {
let (addr1, key1): (_, AccountKeyPair) = get_key_pair();
let gas_object1 = Object::with_owner_for_testing(addr1);
let gas_object2 = Object::with_owner_for_testing(addr1);
let (authorities, _) =
init_local_authorities(4, vec![gas_object1.clone(), gas_object2.clone()]).await;
let authority_clients: Vec<_> = authorities.authority_clients.values().collect();

let framework_obj_ref = genesis::get_framework_object_ref();

// Make a schedule of transactions
let gas_ref_1 = get_latest_ref(authority_clients[0], gas_object1.id()).await;
let create1 =
crate_object_move_transaction(addr1, &key1, addr1, 100, framework_obj_ref, gas_ref_1);

do_transaction(authority_clients[0], &create1).await;
do_transaction(authority_clients[1], &create1).await;
do_transaction(authority_clients[2], &create1).await;

// Get a cert
let cert1 = extract_cert(&authority_clients, &authorities.committee, create1.digest()).await;

// Submit the cert to 1 authority.
let new_ref_1 = do_cert(authority_clients[0], &cert1).await.created[0].0;

// Make a schedule of transactions
let gas_ref_set = get_latest_ref(authority_clients[0], gas_object1.id()).await;
let create2 =
set_object_move_transaction(addr1, &key1, new_ref_1, 100, framework_obj_ref, gas_ref_set);

// Test 1: When we call process transaction on the second transaction, the process_transaction
// updates all authorities with latest objects, and then the transaction goes through
// on all of them. Note that one authority has processed cert 1, and none cert2,
// and auth 3 has no seen either.
authorities
.process_transaction(create2.clone())
.await
.unwrap();

// Check which authorities has successfully processed the cert.
// (NOTE: this method gets the TxInfoResponse from each authority, then reconstructs the cert)
let cert2 = extract_cert(&authority_clients, &authorities.committee, create2.digest()).await;
assert_eq!(3, cert2.auth_sign_info.len());
}

async fn get_owned_objects(
authorities: &AuthorityAggregator<LocalAuthorityClient>,
addr: SuiAddress,
Expand Down

0 comments on commit f0f71b6

Please sign in to comment.