Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doppio benchmarking merge #1520

Merged
merged 70 commits into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from 69 commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
26427fa
Update error logging for num tx decided
elliedavidson Jul 21, 2023
bb8c423
update example tx accounting
elliedavidson Jul 21, 2023
0ab6cea
Update finish run logging
elliedavidson Jul 21, 2023
7a6e0d2
More error logging in network task
elliedavidson Jul 21, 2023
a34bb6c
logging
elliedavidson Jul 21, 2023
b1dd921
fewer ws transactions in memory
elliedavidson Jul 21, 2023
faecedd
make nodes submit tx each round in example
elliedavidson Jul 22, 2023
607dc2e
gen more transactions
elliedavidson Jul 22, 2023
d1da23e
gen more transactions
elliedavidson Jul 22, 2023
d0409f7
Move where tx are submitted
elliedavidson Jul 22, 2023
b0dabea
Make DA committee configurable
elliedavidson Jul 23, 2023
7c90cb7
update modDA.rs to handle different committee sizes
elliedavidson Jul 23, 2023
df9ed32
Updated web server and node web server, need to update network event …
elliedavidson Jul 24, 2023
c7eb212
Update examples to use 2 web servers instead of 3
elliedavidson Jul 25, 2023
4aa7a97
Transaction polling only for previous views, endpoint to remove txns …
bfish713 Jul 25, 2023
722e961
Merge
elliedavidson Jul 25, 2023
3b43b77
Blocks now have txs in them, still need to update with batch size
elliedavidson Jul 25, 2023
c118d7f
Merge pull request #1431 from EspressoSystems/ed/batch_transactions
bfish713 Jul 25, 2023
cf6deae
Merge remote-tracking branch 'origin/bf/transaction-polling' into dop…
elliedavidson Jul 25, 2023
e4f6c7e
Use batch size
elliedavidson Jul 25, 2023
ec7f181
Update inject event for transactions
elliedavidson Jul 25, 2023
1e0a3a1
Batch size is 1
elliedavidson Jul 25, 2023
c24f3dd
more error logging
elliedavidson Jul 25, 2023
9c793fc
change where we cancel pollfortransactions
elliedavidson Jul 25, 2023
4fd960d
update example for how often to submit txs
elliedavidson Jul 25, 2023
2415331
merge with run view refactor
elliedavidson Jul 25, 2023
12c8ff1
Update num_block to block_size
elliedavidson Jul 25, 2023
23fa9af
update infra.rs
elliedavidson Jul 25, 2023
70ffa80
Fix div by zero
elliedavidson Jul 25, 2023
979b031
Fix div by zero
elliedavidson Jul 25, 2023
7b53d28
Log
elliedavidson Jul 25, 2023
6240c8b
Log
elliedavidson Jul 25, 2023
9769611
Fix bug
elliedavidson Jul 25, 2023
255d5b3
Fix bug
elliedavidson Jul 25, 2023
e25b93a
merge in transactions recv update
elliedavidson Jul 25, 2023
d21cd23
Update batch size
elliedavidson Jul 25, 2023
d6c7e7c
Update batch size
elliedavidson Jul 25, 2023
6b3ada0
Update batch size
elliedavidson Jul 26, 2023
24afcb5
Attempt to update tx index
elliedavidson Jul 26, 2023
94006e4
Trying not deduping txs
elliedavidson Jul 26, 2023
ba176f3
update example tx submission
elliedavidson Jul 26, 2023
5a29123
only da members poll for da proposals
elliedavidson Jul 26, 2023
416f68a
Update end example logging
elliedavidson Jul 26, 2023
36d754a
Update batch size to 2
elliedavidson Jul 27, 2023
b8d512a
Update so only 1 node submits txs each round
elliedavidson Jul 27, 2023
0ee067a
revert previous updates
elliedavidson Jul 27, 2023
f1240c7
Change tx submission formula
elliedavidson Aug 1, 2023
fc91c02
Change tx submission formula
elliedavidson Aug 1, 2023
684f625
update tx submissions
elliedavidson Aug 1, 2023
d1ac805
Updating so only 10 nodes are leaders
elliedavidson Aug 2, 2023
8312a6a
update tx in mem size
elliedavidson Aug 2, 2023
063f5a6
update tx in mem size
elliedavidson Aug 2, 2023
dbe5243
Test with low tx in mem
elliedavidson Aug 2, 2023
78303e0
update new index
elliedavidson Aug 2, 2023
bc92cbb
Fix transaction polling to remember tx index
elliedavidson Aug 2, 2023
29a17e2
update max txns
elliedavidson Aug 2, 2023
47100e0
more ws updates
elliedavidson Aug 2, 2023
b789642
Fix several bugs in tx polling
elliedavidson Aug 2, 2023
be3ed63
Back to regular leader function
elliedavidson Aug 2, 2023
3c3b8a6
update tx submission
elliedavidson Aug 2, 2023
2a2f419
Reduce logging levels
elliedavidson Aug 7, 2023
d628581
Reduce logging levels
elliedavidson Aug 7, 2023
c050d0f
Reduce logging levels
elliedavidson Aug 7, 2023
48b6e5e
Merge with main
elliedavidson Aug 7, 2023
7b675a7
Clean up compile errors from merge
elliedavidson Aug 7, 2023
d1db810
fmt
elliedavidson Aug 7, 2023
5491217
Fix warnings
elliedavidson Aug 7, 2023
065fbe6
Clippy and fmt fixes
elliedavidson Aug 7, 2023
27d65c6
Updates
elliedavidson Aug 7, 2023
c23eb15
Address comments
elliedavidson Aug 7, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion examples/infra/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,11 @@ pub trait Run<
error!("Error in consensus: {:?}", error);
// TODO what to do here
}
EventType::Decide { leaf_chain, .. } => {
EventType::Decide {
leaf_chain,
qc: _,
block_size: _,
} => {
// this might be a obob
if let Some(leaf) = leaf_chain.get(0) {
let new_anchor = leaf.view_number;
Expand Down
136 changes: 39 additions & 97 deletions examples/infra/modDA.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ use hotshot_types::{
vote::{DAVote, QuorumVote, ViewSyncVote},
HotShotConfig,
};
use hotshot_web_server::config::DEFAULT_WEB_SERVER_VIEW_SYNC_PORT;
// use libp2p::{
// identity::{
// ed25519::{Keypair as EdKeypair, SecretKey},
Expand All @@ -63,7 +62,6 @@ use rand::SeedableRng;
use std::fmt::Debug;
use std::net::Ipv4Addr;
use std::{
cmp,
//collections::{BTreeSet, VecDeque},
collections::VecDeque,
//fs,
Expand All @@ -79,6 +77,7 @@ use std::{
//use surf_disco::Client;
#[allow(deprecated)]
use tracing::error;
use tracing::warn;

/// Runs the orchestrator
pub async fn run_orchestrator_da<
Expand Down Expand Up @@ -245,16 +244,16 @@ pub trait RunDA<
>>::Membership::default_election_config(config.config.total_nodes.get() as u64)
});

let _committee_election_config = <CommitteeEx<TYPES, NODE> as ConsensusExchange<
let committee_election_config = <CommitteeEx<TYPES, NODE> as ConsensusExchange<
TYPES,
Message<TYPES, NODE>,
>>::Membership::default_election_config(
config.config.total_nodes.get() as u64
config.config.da_committee_size.try_into().unwrap(),
);

let exchanges = NODE::Exchanges::create(
known_nodes.clone(),
(quorum_election_config, _committee_election_config),
(quorum_election_config, committee_election_config),
(
quorum_network.clone(),
view_sync_network.clone(),
Expand Down Expand Up @@ -294,10 +293,8 @@ pub trait RunDA<
let adjusted_padding = if padding < size { 0 } else { padding - size };
let mut txns: VecDeque<TYPES::Transaction> = VecDeque::new();

// This assumes that no node will be a leader more than 5x the expected number of times they should be the leader
// FIXME is this a reasonable assumption when we start doing DA?
// TODO ED: In the future we should have each node generate transactions every round to simulate a more realistic network
let tx_to_gen = transactions_per_round * (cmp::max(rounds / total_nodes, 1) + 5);
let tx_to_gen = transactions_per_round * rounds * 3;
{
let mut txn_rng = rand::thread_rng();
for _ in 0..tx_to_gen {
Expand Down Expand Up @@ -325,33 +322,13 @@ pub trait RunDA<

let total_nodes_u64 = total_nodes.get() as u64;

let mut should_submit_txns = node_index == (round % total_nodes_u64);

let api = HotShotSequencingConsensusApi {
inner: context.hotshot.inner.clone(),
};

context.hotshot.start_consensus().await;

loop {
if should_submit_txns {
for _ in 0..transactions_per_round {
let txn = txns.pop_front().unwrap();
tracing::error!("Submitting txn on round {}", round);

api.send_transaction(DataMessage::SubmitTransaction(
txn.clone(),
TYPES::Time::new(0),
))
.await
.expect("Could not send transaction");
// return (None, state);
// context.submit_transaction(txn).await.unwrap();
total_transactions += 1;
}
should_submit_txns = false;
}

match event_stream.next().await {
None => {
panic!("Error! Event stream completed before consensus ended.");
Expand All @@ -369,7 +346,7 @@ pub trait RunDA<
} => {
// this might be a obob
if let Some(leaf) = leaf_chain.get(0) {
error!("Decide event for leaf: {}", *leaf.view_number);
warn!("Decide event for leaf: {}", *leaf.view_number);

let new_anchor = leaf.view_number;
if new_anchor >= anchor_view {
Expand Down Expand Up @@ -404,8 +381,26 @@ pub trait RunDA<
if *view_number > round {
round = *view_number;
tracing::error!("view finished: {:?}", view_number);
if (round % total_nodes_u64) == node_index {
should_submit_txns = true;
for _ in 0..transactions_per_round {
if node_index >= total_nodes_u64 - 10 {
let txn = txns.pop_front().unwrap();

tracing::warn!("Submitting txn on round {}", round);

let result = api
.send_transaction(DataMessage::SubmitTransaction(
txn.clone(),
TYPES::Time::new(0),
))
.await;

if result.is_err() {
error! (
"Could not send transaction to web server on round {}",
round
)
}
}
}
}
}
Expand All @@ -416,54 +411,10 @@ pub trait RunDA<

round += 1;
}
// while round <= rounds {
// error!("Round {}:", round);

// let num_submitted = if node_index == ((round % total_nodes) as u64) {
// for _ in 0..transactions_per_round {
// let txn = txns.pop_front().unwrap();
// tracing::info!("Submitting txn on round {}", round);
// hotshot.submit_transaction(txn).await.unwrap();
// }
// transactions_per_round
// } else {
// 0
// };
// error!("Submitting {} transactions", num_submitted);

// // Start consensus
// let view_results = hotshot.collect_round_events().await;

// match view_results {
// Ok((leaf_chain, _qc)) => {
// let blocks: Vec<Either<TYPES::BlockType, Commitment<TYPES::BlockType>>> =
// leaf_chain
// .into_iter()
// .map(|leaf| leaf.get_deltas())
// .collect();
// for b in blocks.into_iter() {
// b.either(
// |block| total_transactions += block.txn_count(),
// |_| total_commitments += 1,
// );
// }
// }
// Err(e) => {
// timed_out_views += 1;
// error!("View: {:?}, failed with : {:?}", round, e);
// }
// }

// round += 1;
// }

// Output run results
let total_time_elapsed = start.elapsed();
let total_size = total_transactions * (padding as u64);

// This assumes all transactions that were submitted made it through consensus, and does not account for the genesis block
error!("All {rounds} rounds completed in {total_time_elapsed:?}. {total_size} total bytes submitted");
error!("Total commitments: {num_successful_commits}");
error!("Total transactions committed: {total_transactions}");
error!("{rounds} rounds completed in {total_time_elapsed:?} - Total transactions committed: {total_transactions} - Total commitments: {num_successful_commits}");
}

/// Returns the da network for this run
Expand Down Expand Up @@ -590,47 +541,38 @@ where
wait_between_polls,
}: WebServerConfig = config.clone().web_server_config.unwrap();

let underlying_quorum_network = WebServerNetwork::create(
&host.to_string(),
port,
wait_between_polls,
pub_key.clone(),
false,
);

// Create the network
let quorum_network: WebCommChannel<
TYPES,
NODE,
QuorumProposal<TYPES, SequencingLeaf<TYPES>>,
QuorumVote<TYPES, SequencingLeaf<TYPES>>,
MEMBERSHIP,
> = WebCommChannel::new(
WebServerNetwork::create(
&host.to_string(),
port,
wait_between_polls,
pub_key.clone(),
false,
)
.into(),
);
> = WebCommChannel::new(underlying_quorum_network.clone().into());

let view_sync_network: WebCommChannel<
TYPES,
NODE,
ViewSyncCertificate<TYPES>,
ViewSyncVote<TYPES>,
MEMBERSHIP,
> = WebCommChannel::new(
WebServerNetwork::create(
&host.to_string(),
DEFAULT_WEB_SERVER_VIEW_SYNC_PORT,
wait_between_polls,
pub_key.clone(),
false,
)
.into(),
);
> = WebCommChannel::new(underlying_quorum_network.into());

let WebServerConfig {
host,
port,
wait_between_polls,
}: WebServerConfig = config.clone().da_web_server_config.unwrap();

// Each node runs the DA network so that leaders have access to transactions and DA votes
let da_network: WebCommChannel<TYPES, NODE, DAProposal<TYPES>, DAVote<TYPES>, MEMBERSHIP> =
WebCommChannel::new(
WebServerNetwork::create(
Expand Down
1 change: 1 addition & 0 deletions orchestrator/default-web-server-run-config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ start_delay_seconds = 30

[config]
total_nodes = 10
committee_nodes = 5
max_transactions = 100
min_transactions = 0
next_view_timeout = 30000
Expand Down
5 changes: 4 additions & 1 deletion orchestrator/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ impl<K, E> From<NetworkConfigFile> for NetworkConfig<K, E> {
pub struct HotShotConfigFile {
/// Total number of nodes in the network
pub total_nodes: NonZeroUsize,
/// Number of committee nodes
pub committee_nodes: usize,
/// Maximum transactions per block
pub max_transactions: NonZeroUsize,
/// Minimum transactions per block
Expand Down Expand Up @@ -187,7 +189,7 @@ impl<K, E> From<HotShotConfigFile> for HotShotConfig<K, E> {
max_transactions: val.max_transactions,
min_transactions: val.min_transactions,
known_nodes: Vec::new(),
da_committee_size: val.total_nodes.into(),
da_committee_size: val.committee_nodes,
next_view_timeout: val.next_view_timeout,
timeout_ratio: val.timeout_ratio,
round_start_delay: val.round_start_delay,
Expand All @@ -213,6 +215,7 @@ fn default_padding() -> usize {
fn default_config() -> HotShotConfigFile {
HotShotConfigFile {
total_nodes: NonZeroUsize::new(10).unwrap(),
committee_nodes: 5,
max_transactions: NonZeroUsize::new(100).unwrap(),
min_transactions: 0,
next_view_timeout: 10000,
Expand Down
2 changes: 2 additions & 0 deletions src/traits/election/static_committee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use jf_primitives::signatures::BLSSignatureScheme;
use serde::{Deserialize, Serialize};
use std::marker::PhantomData;
use std::num::NonZeroU64;
use tracing::error;

/// Dummy implementation of [`Membership`]

Expand Down Expand Up @@ -153,6 +154,7 @@ where
fn create_election(keys: Vec<PUBKEY>, config: TYPES::ElectionConfigType) -> Self {
let mut committee_nodes = keys.clone();
committee_nodes.truncate(config.num_nodes.try_into().unwrap());
error!("DA Committee Size: {}", config.num_nodes);
Self {
nodes: keys,
committee_nodes,
Expand Down
Loading
Loading