Skip to content

Commit

Permalink
update sui yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
lanvidr committed Apr 18, 2022
1 parent 6fd2dd7 commit bcb18e7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 22 deletions.
4 changes: 2 additions & 2 deletions sui/src/benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use futures::{join, StreamExt};
use rayon::iter::{IntoParallelRefIterator, ParallelIterator};
use std::thread;
use std::{thread::sleep, time::Duration};
use sui_core::authority_client::AuthorityClient;
use sui_core::authority_client::{AuthorityAPI, AuthorityClient};
use sui_network::network::{NetworkClient, NetworkServer};
use sui_types::batch::UpdateItem;
use sui_types::messages::{BatchInfoRequest, BatchInfoResponseItem};
Expand Down Expand Up @@ -223,7 +223,7 @@ async fn run_follower(network_client: NetworkClient) {

loop {
let receiver = authority_client
.handle_batch_streaming_as_stream(BatchInfoRequest {
.handle_batch_stream(BatchInfoRequest {
start,
end: start + FOLLOWER_BATCH_SIZE,
})
Expand Down
31 changes: 11 additions & 20 deletions sui_core/src/unit_tests/batch_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use std::{env, io};
use sui_types::messages::{
AccountInfoRequest, AccountInfoResponse, BatchInfoRequest, BatchInfoResponseItem,
ConfirmationTransaction, ObjectInfoRequest, ObjectInfoResponse, Transaction,
TransactionInfoRequest,
TransactionInfoRequest, TransactionInfoResponse,
};
use sui_types::object::Object;

Expand Down Expand Up @@ -479,7 +479,7 @@ impl AuthorityAPI for TrustworthyAuthorityClient {
if seq <= request.end {
let mut transactions = Vec::new();
for i in 0..batch_size {
transactions.push((seq + i, TransactionDigest::random(), None));
transactions.push((seq + i, TransactionDigest::random()));
}
let next = AuthorityBatch::make_next_with_previous_digest(
Some(last_batch.digest()),
Expand Down Expand Up @@ -580,11 +580,11 @@ impl AuthorityAPI for ByzantineAuthorityClient {
move |(seq, last_batch)| {
let auth_secret = secret.clone();
async move {
if request.include_tx_info {
if request.end % 2 == 0 {
if seq <= request.end {
let mut transactions = Vec::new();
for i in 0..batch_size {
transactions.push((seq + i, TransactionDigest::random(), None));
transactions.push((seq + i, TransactionDigest::random()));
}
let next = AuthorityBatch::make_next_with_previous_digest(
Some(last_batch.digest()),
Expand All @@ -595,11 +595,10 @@ impl AuthorityAPI for ByzantineAuthorityClient {
// Remove a transaction after creating the batch
item.batch.transaction_batch.0.pop();
// And then add in a fake transaction
item.batch.transaction_batch.0.push((
seq + batch_size,
TransactionDigest::random(),
None,
));
item.batch
.transaction_batch
.0
.push((seq + batch_size, TransactionDigest::random()));
let response = BatchInfoResponseItem(UpdateItem::Batch(item));
Some((Ok(response), (seq + batch_size, next)))
} else {
Expand All @@ -610,7 +609,7 @@ impl AuthorityAPI for ByzantineAuthorityClient {
if seq <= request.end * 100 {
let mut transactions = Vec::new();
for i in 0..batch_size {
transactions.push((seq + i, TransactionDigest::random(), None));
transactions.push((seq + i, TransactionDigest::random()));
}
let next = AuthorityBatch::make_next_with_previous_digest(
Some(last_batch.digest()),
Expand Down Expand Up @@ -669,11 +668,7 @@ async fn test_safe_batch_stream() {
let auth_client = TrustworthyAuthorityClient::new(state);
let safe_client = SafeClient::new(auth_client, committee.clone(), public_key_bytes);

let request = BatchInfoRequest {
start: 0,
end: 15,
include_tx_info: false,
};
let request = BatchInfoRequest { start: 0, end: 15 };
let batch_stream = safe_client.handle_batch_stream(request.clone()).await;

// No errors expected
Expand Down Expand Up @@ -730,11 +725,7 @@ async fn test_safe_batch_stream() {
// Length should be within sequenced range, despite authority that never stop sending
assert!(items.len() <= (request.end - request.start) as usize && !items.is_empty());

let request_b = BatchInfoRequest {
start: 0,
end: 10,
include_tx_info: true,
};
let request_b = BatchInfoRequest { start: 0, end: 10 };
batch_stream = safe_client_from_byzantine
.handle_batch_stream(request_b.clone())
.await;
Expand Down
8 changes: 8 additions & 0 deletions sui_core/tests/staged/sui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ AuthorityBatch:
TUPLEARRAY:
CONTENT: U8
SIZE: 32
- transaction_batch:
TYPENAME: TransactionBatch
AuthoritySignInfo:
STRUCT:
- authority:
Expand Down Expand Up @@ -760,6 +762,12 @@ SuiError:
- error: STR
93:
OnlyOneConsensusClientPermitted: UNIT
TransactionBatch:
NEWTYPESTRUCT:
SEQ:
TUPLE:
- U64
- TYPENAME: TransactionDigest
TransactionData:
STRUCT:
- kind:
Expand Down

0 comments on commit bcb18e7

Please sign in to comment.