@@ -22,7 +22,7 @@ use tokio::sync::oneshot::{self};
2222
2323use crate :: {
2424 custom_v4:: OpExecutionPayloadEnvelopeV4Patch ,
25- db:: { DBFrag , DBSorting } ,
25+ db:: { DBFrag , DBSorting , sorting :: StateId } ,
2626 order:: { SimulatedBundle , ValidatedBundle , bundle:: BundleValidationError } ,
2727 time:: { Duration , IngestionTime , Instant , Nanos } ,
2828 transaction:: { SimulatedTx , Transaction } ,
@@ -365,39 +365,40 @@ pub enum SequencerToSimulator<Db> {
365365 /// Simulate a bundle Top of frag
366366 SimulateBundleTof ( Arc < ValidatedBundle > , DBFrag < Db > ) ,
367367}
368+
368369impl < Db > SequencerToSimulator < Db > {
369370 /// Returns simulation info.
370- /// TODO(mempirate): return type for bundle?
371- pub fn sim_info ( & self ) -> ( Address , u64 , u64 ) {
371+ pub fn sim_info ( & self ) -> ( StateId , Vec < ( Address , u64 ) > ) {
372372 match self {
373- SequencerToSimulator :: SimulateTx ( t, db) => ( t . sender ( ) , t . nonce ( ) , db . state_id ( ) ) ,
374- SequencerToSimulator :: SimulateTxTof ( t, db) => ( t . sender ( ) , t . nonce ( ) , db . state_id ( ) ) ,
375- SequencerToSimulator :: SimulateBundle ( b, db) => todo ! ( "What to return here?" ) ,
376- SequencerToSimulator :: SimulateBundleTof ( b, db) => todo ! ( "What to return here?" ) ,
373+ SequencerToSimulator :: SimulateTx ( t, db) => ( db . state_id ( ) , vec ! [ ( t . sender ( ) , t . nonce ( ) ) ] ) ,
374+ SequencerToSimulator :: SimulateTxTof ( t, db) => ( db . state_id ( ) , vec ! [ ( t . sender ( ) , t . nonce ( ) ) ] ) ,
375+ SequencerToSimulator :: SimulateBundle ( b, db) => ( db . state_id ( ) , b . sender_nonces ( ) . collect ( ) ) ,
376+ SequencerToSimulator :: SimulateBundleTof ( b, db) => ( db . state_id ( ) , b . sender_nonces ( ) . collect ( ) ) ,
377377 }
378378 }
379379}
380380
381381#[ derive( Debug ) ]
382382pub struct SimulatorToSequencer {
383383 /// Sender address and nonce
384- pub sender_info : ( Address , u64 ) ,
384+ pub sender_nonces : Vec < ( Address , u64 ) > ,
385385 pub state_id : u64 ,
386386 pub simtime : Duration ,
387387 pub msg : SimulatorToSequencerMsg ,
388388}
389389
390390impl SimulatorToSequencer {
391- pub fn new ( sender_info : ( Address , u64 ) , state_id : u64 , simtime : Duration , msg : SimulatorToSequencerMsg ) -> Self {
392- Self { sender_info, state_id, simtime, msg }
393- }
394-
395- pub fn sender ( & self ) -> & Address {
396- & self . sender_info . 0
391+ pub fn new (
392+ sender_nonces : Vec < ( Address , u64 ) > ,
393+ state_id : u64 ,
394+ simtime : Duration ,
395+ msg : SimulatorToSequencerMsg ,
396+ ) -> Self {
397+ Self { sender_nonces, state_id, simtime, msg }
397398 }
398399
399- pub fn nonce ( & self ) -> u64 {
400- self . sender_info . 1
400+ pub fn sender_nonces ( & self ) -> & [ ( Address , u64 ) ] {
401+ & self . sender_nonces
401402 }
402403}
403404
0 commit comments