@@ -378,122 +378,6 @@ pub struct ProofRequest {
378378 pub cached_event_data : Option < raiko_lib:: input:: BlockProposedFork > ,
379379}
380380
381- #[ serde_as]
382- #[ derive( Clone , Debug , Serialize , Deserialize , ToSchema ) ]
383- pub struct BatchMetadata {
384- pub batch_id : u64 ,
385- pub l1_inclusion_block_number : u64 ,
386- }
387-
388- impl std:: str:: FromStr for BatchMetadata {
389- type Err = anyhow:: Error ;
390-
391- fn from_str ( s : & str ) -> Result < Self , Self :: Err > {
392- let parts: Vec < & str > = s. split ( ':' ) . collect ( ) ;
393- let [ batch_id_str, l1_str] = parts. as_slice ( ) else {
394- return Err ( anyhow:: anyhow!(
395- "Invalid BatchMetadata format. Expected 'batch_id:l1_inclusion_block_number'"
396- ) ) ;
397- } ;
398- Ok ( Self {
399- batch_id : batch_id_str. parse ( ) . map_err ( |_| anyhow:: anyhow!( "Invalid batch_id" ) ) ?,
400- l1_inclusion_block_number : l1_str
401- . parse ( )
402- . map_err ( |_| anyhow:: anyhow!( "Invalid l1_inclusion_block_number" ) ) ?,
403- } )
404- }
405- }
406-
407- impl std:: fmt:: Display for BatchMetadata {
408- fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
409- write ! ( f, "{}:{}" , self . batch_id, self . l1_inclusion_block_number)
410- }
411- }
412-
413- #[ serde_as]
414- #[ derive( Clone , Debug , Serialize , Deserialize , ToSchema ) ]
415- pub struct BatchProofRequest {
416- pub batches : Vec < BatchMetadata > ,
417- pub aggregate : bool ,
418- pub proof_type : ProofType ,
419-
420- pub network : String ,
421- pub l1_network : String ,
422- pub graffiti : B256 ,
423- #[ serde_as( as = "DisplayFromStr" ) ]
424- pub prover : Address ,
425- pub blob_proof_type : BlobProofType ,
426- #[ serde( flatten) ]
427- pub prover_args : ProverSpecificOpts ,
428- }
429-
430- #[ serde_as]
431- #[ derive( Clone , Debug , Serialize , Deserialize , ToSchema ) ]
432- pub struct BatchProofRequestOpt {
433- // Required fields
434- pub batches : Vec < BatchMetadata > ,
435- pub aggregate : Option < bool > ,
436- pub proof_type : String ,
437-
438- // Optional fields, if not provided, the default values will be used
439- pub network : Option < String > ,
440- pub l1_network : Option < String > ,
441- pub graffiti : Option < String > ,
442- pub prover : Option < String > ,
443- pub blob_proof_type : Option < String > ,
444- #[ serde( flatten) ]
445- pub prover_args : Option < ProverSpecificOpts > ,
446- }
447-
448- impl TryFrom < BatchProofRequestOpt > for BatchProofRequest {
449- type Error = RaikoError ;
450-
451- fn try_from ( value : BatchProofRequestOpt ) -> Result < Self , Self :: Error > {
452- Ok ( Self {
453- batches : value. batches ,
454- aggregate : value. aggregate . unwrap_or ( false ) ,
455- proof_type : value
456- . proof_type
457- . parse ( )
458- . map_err ( |_| RaikoError :: InvalidRequestConfig ( "Invalid proof_type" . to_string ( ) ) ) ?,
459-
460- network : value. network . ok_or ( RaikoError :: InvalidRequestConfig (
461- "Missing network" . to_string ( ) ,
462- ) ) ?,
463- l1_network : value. l1_network . ok_or ( RaikoError :: InvalidRequestConfig (
464- "Missing l1_network" . to_string ( ) ,
465- ) ) ?,
466- graffiti : value
467- . graffiti
468- . ok_or ( RaikoError :: InvalidRequestConfig (
469- "Missing graffiti" . to_string ( ) ,
470- ) ) ?
471- . parse ( )
472- . map_err ( |_| RaikoError :: InvalidRequestConfig ( "Invalid graffiti" . to_string ( ) ) ) ?,
473- prover : value
474- . prover
475- . ok_or ( RaikoError :: InvalidRequestConfig (
476- "Missing prover" . to_string ( ) ,
477- ) ) ?
478- . parse ( )
479- . map_err ( |_| RaikoError :: InvalidRequestConfig ( "Invalid prover" . to_string ( ) ) ) ?,
480- blob_proof_type : value
481- . blob_proof_type
482- . unwrap_or ( "proof_of_equivalence" . to_string ( ) )
483- . parse ( )
484- . map_err ( |_| {
485- RaikoError :: InvalidRequestConfig ( "Invalid blob_proof_type" . to_string ( ) )
486- } ) ?,
487- prover_args : value
488- . prover_args
489- . ok_or ( RaikoError :: InvalidRequestConfig (
490- "Missing prover_args" . to_string ( ) ,
491- ) ) ?
492- . into ( ) ,
493- } )
494- }
495- }
496-
497381#[ derive( Clone , Debug , Default , Deserialize , Serialize , PartialEq ) ]
498382pub struct ShastaProposalCheckpoint {
499383 pub block_number : u64 ,
@@ -504,7 +388,7 @@ pub struct ShastaProposalCheckpoint {
504388impl From < ShastaProposalCheckpoint > for Checkpoint {
505389 fn from ( value : ShastaProposalCheckpoint ) -> Self {
506390 Checkpoint {
507- blockNumber : value. block_number . into ( ) ,
391+ blockNumber : value. block_number ,
508392 blockHash : value. block_hash ,
509393 stateRoot : value. state_root ,
510394 }
@@ -526,9 +410,7 @@ impl std::fmt::Display for ShastaProposal {
526410 write ! (
527411 f,
528412 "{}:{:?}:{}" ,
529- self . proposal_id,
530- self . checkpoint,
531- self . l1_inclusion_block_number
413+ self . proposal_id, self . checkpoint, self . l1_inclusion_block_number
532414 )
533415 }
534416}
@@ -602,12 +484,9 @@ impl TryFrom<ShastaProofRequestOpt> for ShastaProofRequest {
602484 . map_err ( |_| {
603485 RaikoError :: InvalidRequestConfig ( "Invalid blob_proof_type" . to_string ( ) )
604486 } ) ?,
605- prover_args : value
606- . prover_args
607- . ok_or ( RaikoError :: InvalidRequestConfig (
608- "Missing prover_args" . to_string ( ) ,
609- ) ) ?
610- . into ( ) ,
487+ prover_args : value. prover_args . ok_or ( RaikoError :: InvalidRequestConfig (
488+ "Missing prover_args" . to_string ( ) ,
489+ ) ) ?,
611490 } )
612491 }
613492}
0 commit comments