@@ -21,15 +21,24 @@ pub struct RpcCheckpointInfo {
2121 /// The L2 height range that the checkpoint covers (start, end)
2222 pub l2_range : ( L2BlockCommitment , L2BlockCommitment ) ,
2323 /// Info on txn where checkpoint is committed on chain
24- pub commitment : Option < RpcCheckpointCommitmentInfo > ,
24+ pub l1_reference : Option < CheckpointL1Ref > ,
2525 /// Confirmation status of checkpoint
2626 pub confirmation_status : Option < RpcCheckpointConfStatus > ,
2727}
2828
2929#[ derive( Debug , Clone , PartialEq , Serialize , Deserialize ) ]
3030pub struct L1BlockCommitment {
31- height : u64 ,
32- blkid : L1BlockId ,
31+ pub height : u64 ,
32+ pub blkid : L1BlockId ,
33+ }
34+
35+ #[ derive( Debug , Clone , PartialEq , Serialize , Deserialize ) ]
36+ pub struct Buf32 ( pub [ u8 ; 32 ] ) ;
37+ #[ derive( Debug , Clone , PartialEq , Serialize , Deserialize ) ]
38+ pub struct CheckpointL1Ref {
39+ pub l1_commitment : L1BlockCommitment ,
40+ pub txid : String ,
41+ pub wtxid : String ,
3342}
3443#[ derive( Debug , Clone , PartialEq , Serialize , Deserialize ) ]
3544pub struct L2BlockCommitment {
@@ -72,24 +81,6 @@ impl Display for RpcCheckpointConfStatus {
7281 }
7382}
7483
75- #[ derive( Clone , Debug , Deserialize , Serialize ) ]
76- pub struct RpcCheckpointCommitmentInfo {
77- /// block where checkpoint was posted
78- pub blockhash : String ,
79-
80- /// txid of txn for this checkpoint
81- pub txid : String ,
82-
83- /// wtxid of txn for this checkpoint
84- pub wtxid : String ,
85-
86- /// The height of the block where the checkpoint was posted.
87- pub height : u64 ,
88-
89- /// The position of the checkpoint in the block.
90- pub position : u32 ,
91- }
92-
9384#[ derive(
9485 Clone , Debug , PartialEq , DeriveEntityModel , DeriveActiveModelBehavior , Serialize , Deserialize ,
9586) ]
@@ -117,7 +108,7 @@ impl From<RpcCheckpointInfo> for ActiveModel {
117108 l2_start : Set ( PgU64 ( info. l2_range . 0 . slot ) . to_i64 ( ) ) ,
118109 l2_end : Set ( PgU64 ( info. l2_range . 1 . slot ) . to_i64 ( ) ) ,
119110 batch_txid : Set ( info
120- . commitment
111+ . l1_reference
121112 . as_ref ( )
122113 . map_or ( "-" . to_string ( ) , |c| c. txid . clone ( ) ) ) , // Extracting `txid`
123114 status : Set ( info
@@ -138,7 +129,7 @@ pub struct RpcCheckpointInfoBatchExp {
138129 /// The L2 height range that the checkpoint covers (start, end)
139130 pub l2_range : ( u64 , u64 ) ,
140131 /// Info on txn where checkpoint is committed on chain
141- pub commitment : Option < RpcCheckpointCommitmentInfo > ,
132+ pub l1_reference : Option < CheckpointL1Ref > ,
142133 /// Confirmation status of checkpoint
143134 pub confirmation_status : Option < RpcCheckpointConfStatus > ,
144135}
@@ -155,12 +146,13 @@ impl From<Model> for RpcCheckpointInfoBatchExp {
155146 PgU64 :: from_i64 ( model. l2_start ) . 0 ,
156147 PgU64 :: from_i64 ( model. l2_end ) . 0 ,
157148 ) ,
158- commitment : Some ( RpcCheckpointCommitmentInfo {
159- blockhash : String :: new ( ) ,
160- txid : model. batch_txid ,
161- wtxid : String :: new ( ) ,
162- height : 0 ,
163- position : 0 ,
149+ l1_reference : Some ( CheckpointL1Ref {
150+ l1_commitment : L1BlockCommitment {
151+ height : 0 ,
152+ blkid : "dummy" . to_string ( ) ,
153+ } ,
154+ txid : model. batch_txid . clone ( ) ,
155+ wtxid : "dummy" . to_string ( ) ,
164156 } ) ,
165157 confirmation_status : model. status . parse ( ) . ok ( ) , // Convert status string to `RpcCheckpointConfStatus`
166158 }
0 commit comments