@@ -93,15 +93,12 @@ impl EventMonitor {
9393 let mut votes_per_pool: BTreeMap < NodeId , f64 > =
9494 self . pool_ids . into_iter ( ) . map ( |id| ( id, 0.0 ) ) . collect ( ) ;
9595 let mut eb_votes: BTreeMap < EndorserBlockId , f64 > = BTreeMap :: new ( ) ;
96- let mut leios_tx_bytes: BTreeMap < TransactionId , u64 > = BTreeMap :: new ( ) ;
9796
9897 let mut last_timestamp = Timestamp :: zero ( ) ;
9998 let mut total_slots = 0u64 ;
100- let mut praos_txs = 0u64 ;
101- let mut published_bytes = 0u64 ;
10299 let mut total_votes = 0u64 ;
103100 let mut leios_blocks_with_endorsements = 0u64 ;
104- let mut leios_txs = 0u64 ;
101+ let mut total_leios_txs = 0u64 ;
105102 let mut total_leios_bytes = 0u64 ;
106103 let mut tx_messages = MessageStats :: default ( ) ;
107104 let mut ib_messages = MessageStats :: default ( ) ;
@@ -196,13 +193,11 @@ impl EventMonitor {
196193 transactions,
197194 ..
198195 } => {
199- let mut all_txs = transactions;
200196 info ! (
201197 "Pool {} produced a praos block in slot {slot} with {} tx(s)." ,
202198 producer,
203- all_txs . len( )
199+ transactions . len( )
204200 ) ;
205- praos_txs += all_txs. len ( ) as u64 ;
206201 if let Some ( endorsement) = endorsement {
207202 total_leios_bytes += endorsement. size_bytes ;
208203 leios_blocks_with_endorsements += 1 ;
@@ -228,6 +223,7 @@ impl EventMonitor {
228223 let tx = txs. get_mut ( tx_id) . unwrap ( ) ;
229224 if tx. included_in_block . is_none ( ) {
230225 tx. included_in_block = Some ( time) ;
226+ tx. tx_type = Some ( TransactionType :: Leios ) ;
231227 }
232228 }
233229 }
@@ -236,23 +232,26 @@ impl EventMonitor {
236232 let tx = txs. get_mut ( tx_id) . unwrap ( ) ;
237233 if tx. included_in_block . is_none ( ) {
238234 tx. included_in_block = Some ( time) ;
235+ tx. tx_type = Some ( TransactionType :: Leios ) ;
239236 }
240237 }
241238 }
242239
243- let mut unique_block_leios_txs: Vec < _ > =
244- block_leios_txs. iter ( ) . copied ( ) . sorted ( ) . dedup ( ) . collect ( ) ;
240+ total_leios_txs += block_leios_txs. len ( ) as u64 ;
241+ let unique_block_leios_txs =
242+ block_leios_txs. iter ( ) . copied ( ) . sorted ( ) . dedup ( ) . count ( ) ;
245243 info ! (
246244 "This block had an additional {} leios tx(s) ({} unique)." ,
247245 block_leios_txs. len( ) ,
248- unique_block_leios_txs. len ( )
246+ unique_block_leios_txs,
249247 ) ;
250- for tx_id in & unique_block_leios_txs {
251- let bytes = txs. get ( tx_id) . unwrap ( ) . bytes ;
252- leios_tx_bytes. insert ( * tx_id, bytes) ;
248+ }
249+ for tx_id in & transactions {
250+ let tx = txs. get_mut ( tx_id) . unwrap ( ) ;
251+ if tx. included_in_block . is_none ( ) {
252+ tx. included_in_block = Some ( time) ;
253+ tx. tx_type = Some ( TransactionType :: Praos ) ;
253254 }
254- leios_txs += block_leios_txs. len ( ) as u64 ;
255- all_txs. append ( & mut unique_block_leios_txs) ;
256255 }
257256 if let Some ( ( old_producer, old_vrf) ) = blocks. get ( & slot) {
258257 if * old_vrf > vrf {
@@ -267,13 +266,6 @@ impl EventMonitor {
267266 * blocks_published. entry ( producer. id ) . or_default ( ) += 1 ;
268267 blocks. insert ( slot, ( producer. id , vrf) ) ;
269268 }
270- for published_tx in all_txs {
271- let tx = txs. get_mut ( & published_tx) . unwrap ( ) ;
272- if tx. included_in_block . is_none ( ) {
273- tx. included_in_block = Some ( time) ;
274- }
275- published_bytes += tx. bytes ;
276- }
277269 }
278270 Event :: RBSent { .. } => { }
279271 Event :: RBReceived { .. } => { }
@@ -393,12 +385,33 @@ impl EventMonitor {
393385
394386 output. flush ( ) . await ?;
395387
396- let pending_txs: Vec < Transaction > = txs
397- . values ( )
398- . filter ( |tx| tx. included_in_block . is_some ( ) )
399- . cloned ( )
400- . collect ( ) ;
401- let unique_leios_txs = leios_tx_bytes. len ( ) as u64 ;
388+ let mut finalized_txs = 0 ;
389+ let mut finalized_tx_bytes = 0 ;
390+ let mut pending_txs = 0 ;
391+ let mut pending_tx_bytes = 0 ;
392+ let mut praos_txs = 0 ;
393+ let mut praos_tx_bytes = 0 ;
394+ let mut leios_txs = 0 ;
395+ let mut leios_tx_bytes = 0 ;
396+ for tx in txs. values ( ) {
397+ if let Some ( tx_type) = tx. tx_type {
398+ finalized_txs += 1 ;
399+ finalized_tx_bytes += tx. bytes ;
400+ match tx_type {
401+ TransactionType :: Praos => {
402+ praos_txs += 1 ;
403+ praos_tx_bytes += tx. bytes ;
404+ }
405+ TransactionType :: Leios => {
406+ leios_txs += 1 ;
407+ leios_tx_bytes += tx. bytes ;
408+ }
409+ }
410+ } else {
411+ pending_txs += 1 ;
412+ pending_tx_bytes += tx. bytes ;
413+ }
414+ }
402415
403416 info_span ! ( "praos" ) . in_scope ( || {
404417 info ! ( "{} transactions(s) were generated in total." , txs. len( ) ) ;
@@ -407,15 +420,12 @@ impl EventMonitor {
407420 "{} slot(s) had no naive praos blocks." ,
408421 total_slots - blocks. len( ) as u64
409422 ) ;
410- info ! ( "{} transaction(s) ({}) finalized in a naive praos block." , praos_txs + unique_leios_txs , pretty_bytes( published_bytes , pbo. clone( ) ) ) ;
423+ info ! ( "{} transaction(s) ({}) finalized in a naive praos block." , finalized_txs , pretty_bytes( finalized_tx_bytes , pbo. clone( ) ) ) ;
411424 info ! (
412425 "{} transaction(s) ({}) did not reach a naive praos block." ,
413- pending_txs. len ( ) ,
426+ pending_txs,
414427 pretty_bytes(
415- pending_txs
416- . iter( )
417- . map( |tx| tx. bytes)
418- . sum:: <u64 >( ) ,
428+ pending_tx_bytes,
419429 pbo. clone( ) ,
420430 ) ,
421431 ) ;
@@ -474,8 +484,7 @@ impl EventMonitor {
474484 let votes_per_pool = compute_stats ( votes_per_pool. into_values ( ) ) ;
475485 let votes_per_eb = compute_stats ( eb_votes. into_values ( ) ) ;
476486 let votes_per_bundle = compute_stats ( votes_per_bundle. into_values ( ) ) ;
477- let total_leios_tx_bytes: u64 = leios_tx_bytes. values ( ) . copied ( ) . sum ( ) ;
478- let space_efficiency = total_leios_tx_bytes as f64 / total_leios_bytes as f64 ;
487+ let space_efficiency = leios_tx_bytes as f64 / total_leios_bytes as f64 ;
479488
480489 info ! (
481490 "{} IB(s) were generated, on average {:.3} IB(s) per slot." ,
@@ -487,8 +496,12 @@ impl EventMonitor {
487496 times_to_reach_ib. len( ) ,
488497 txs. len( ) ,
489498 ) ;
490- let avg_age = pending_txs. iter ( ) . map ( |tx| {
491- ( last_timestamp - tx. generated ) . as_secs_f64 ( )
499+ let avg_age = txs. values ( ) . filter_map ( |tx| {
500+ if tx. tx_type . is_none ( ) {
501+ Some ( ( last_timestamp - tx. generated ) . as_secs_f64 ( ) )
502+ } else {
503+ None
504+ }
492505 } ) ;
493506 let avg_age_stats = compute_stats ( avg_age) ;
494507 info ! (
@@ -546,12 +559,12 @@ impl EventMonitor {
546559 info ! ( "There were {bundle_count} bundle(s) of votes. Each bundle contained {:.3} vote(s) (stddev {:.3})." ,
547560 votes_per_bundle. mean, votes_per_bundle. std_dev) ;
548561 info ! ( "{} L1 block(s) had a Leios endorsement." , leios_blocks_with_endorsements) ;
549- info ! ( "{} tx(s) were referenced by a Leios endorsement." , unique_leios_txs ) ;
550- info ! ( "{} tx(s) were included directly in a Praos block." , praos_txs) ;
562+ info ! ( "{} tx(s) ({}) were referenced by a Leios endorsement." , leios_txs , pretty_bytes ( leios_tx_bytes , pbo . clone ( ) ) ) ;
563+ info ! ( "{} tx(s) ({}) were included directly in a Praos block." , praos_txs, pretty_bytes ( praos_tx_bytes , pbo . clone ( ) ) ) ;
551564 if self . variant != LeiosVariant :: FullWithoutIbs {
552- info ! ( "Spatial efficiency: {}/{} ({:.3}%) of Leios bytes were transactions." , pretty_bytes( total_leios_tx_bytes , pbo. clone( ) ) , pretty_bytes( total_leios_bytes, pbo. clone( ) ) , space_efficiency * 100. ) ;
565+ info ! ( "Spatial efficiency: {}/{} ({:.3}%) of Leios bytes were unique transactions." , pretty_bytes( leios_tx_bytes , pbo. clone( ) ) , pretty_bytes( total_leios_bytes, pbo. clone( ) ) , space_efficiency * 100. ) ;
553566 }
554- info ! ( "{} tx(s) ({:.3}%) referenced by a Leios endorsement were redundant." , leios_txs - unique_leios_txs , ( leios_txs - unique_leios_txs ) as f64 / leios_txs as f64 * 100. ) ;
567+ info ! ( "{} tx(s) ({:.3}%) referenced by a Leios endorsement were redundant." , total_leios_txs - leios_txs , ( total_leios_txs - leios_txs ) as f64 / total_leios_txs as f64 * 100. ) ;
555568 info ! (
556569 "Each transaction took an average of {:.3}s (stddev {:.3}) to be included in an IB." ,
557570 ib_time_stats. mean, ib_time_stats. std_dev,
@@ -584,6 +597,7 @@ struct Transaction {
584597 included_in_ib : Option < Timestamp > ,
585598 included_in_eb : Option < Timestamp > ,
586599 included_in_block : Option < Timestamp > ,
600+ tx_type : Option < TransactionType > ,
587601}
588602impl Transaction {
589603 fn new ( bytes : u64 , generated : Timestamp ) -> Self {
@@ -593,9 +607,17 @@ impl Transaction {
593607 included_in_ib : None ,
594608 included_in_eb : None ,
595609 included_in_block : None ,
610+ tx_type : None ,
596611 }
597612 }
598613}
614+
615+ #[ derive( Clone , Copy ) ]
616+ enum TransactionType {
617+ Leios ,
618+ Praos ,
619+ }
620+
599621struct InputBlock {
600622 bytes : u64 ,
601623 generated : Timestamp ,
0 commit comments