@@ -60,7 +60,7 @@ var _ coreda.DA = &LocalDA{}
6060
6161// MaxBlobSize returns the max blob size in bytes.
6262func (d * LocalDA ) MaxBlobSize (ctx context.Context ) (uint64 , error ) {
63- d .logger .Debug ("MaxBlobSize called" , " maxBlobSize" , d .maxBlobSize )
63+ d .logger .Debug ("MaxBlobSize called, maxBlobSize: " , d .maxBlobSize )
6464 return d .maxBlobSize , nil
6565}
6666
@@ -78,13 +78,13 @@ func (d *LocalDA) GasPrice(ctx context.Context) (float64, error) {
7878
7979// Get returns Blobs for given IDs.
8080func (d * LocalDA ) Get (ctx context.Context , ids []coreda.ID , _ []byte ) ([]coreda.Blob , error ) {
81- d .logger .Debug ("Get called" , " ids" , ids )
81+ d .logger .Debug ("Get called, ids: " , ids )
8282 d .mu .Lock ()
8383 defer d .mu .Unlock ()
8484 blobs := make ([]coreda.Blob , len (ids ))
8585 for i , id := range ids {
8686 if len (id ) < 8 {
87- d .logger .Error ("Get: invalid ID length" , "id " , id )
87+ d .logger .Error ("Get: invalid ID length, id: " , id )
8888 return nil , errors .New ("invalid ID" )
8989 }
9090 height := binary .LittleEndian .Uint64 (id )
@@ -96,45 +96,45 @@ func (d *LocalDA) Get(ctx context.Context, ids []coreda.ID, _ []byte) ([]coreda.
9696 }
9797 }
9898 if ! found {
99- d .logger .Warn ("Get: blob not found" , "id " , id , "height" , height )
99+ d .logger .Warn ("Get: blob not found, id: " , id , "height: " , height )
100100 return nil , coreda .ErrBlobNotFound
101101 }
102102 }
103- d .logger .Debug ("Get successful" , " count" , len (blobs ))
103+ d .logger .Debug ("Get successful, count: " , len (blobs ))
104104 return blobs , nil
105105}
106106
107107// GetIDs returns IDs of Blobs at given DA height.
108108func (d * LocalDA ) GetIDs (ctx context.Context , height uint64 , _ []byte ) (* coreda.GetIDsResult , error ) {
109- d .logger .Debug ("GetIDs called" , " height" , height )
109+ d .logger .Debug ("GetIDs called, height: " , height )
110110 d .mu .Lock ()
111111 defer d .mu .Unlock ()
112112
113113 if height > d .height {
114- d .logger .Error ("GetIDs: height in future" , " requested" , height , "current" , d .height )
114+ d .logger .Error ("GetIDs: height in future, requested: " , height , "current: " , d .height )
115115 return nil , fmt .Errorf ("height %d is in the future: %w" , height , coreda .ErrHeightFromFuture )
116116 }
117117
118118 kvps , ok := d .data [height ]
119119 if ! ok {
120- d .logger .Debug ("GetIDs: no data for height" , "height " , height )
120+ d .logger .Debug ("GetIDs: no data for height: " , height )
121121 return nil , nil
122122 }
123123
124124 ids := make ([]coreda.ID , len (kvps ))
125125 for i , kv := range kvps {
126126 ids [i ] = kv .key
127127 }
128- d .logger .Debug ("GetIDs successful" , " count" , len (ids ))
128+ d .logger .Debug ("GetIDs successful, count: " , len (ids ))
129129 return & coreda.GetIDsResult {IDs : ids , Timestamp : d .timestamps [height ]}, nil
130130}
131131
132132// GetProofs returns inclusion Proofs for all Blobs located in DA at given height.
133133func (d * LocalDA ) GetProofs (ctx context.Context , ids []coreda.ID , _ []byte ) ([]coreda.Proof , error ) {
134- d .logger .Debug ("GetProofs called" , " ids" , ids )
134+ d .logger .Debug ("GetProofs called, ids: " , ids )
135135 blobs , err := d .Get (ctx , ids , nil )
136136 if err != nil {
137- d .logger .Error ("GetProofs: failed to get blobs" , " error" , err )
137+ d .logger .Error ("GetProofs: failed to get blobs, error: " , err )
138138 return nil , err
139139 }
140140
@@ -144,24 +144,24 @@ func (d *LocalDA) GetProofs(ctx context.Context, ids []coreda.ID, _ []byte) ([]c
144144 for i , blob := range blobs {
145145 proofs [i ] = d .getProof (ids [i ], blob )
146146 }
147- d .logger .Debug ("GetProofs successful" , " count" , len (proofs ))
147+ d .logger .Debug ("GetProofs successful, count: " , len (proofs ))
148148 return proofs , nil
149149}
150150
151151// Commit returns cryptographic Commitments for given blobs.
152152func (d * LocalDA ) Commit (ctx context.Context , blobs []coreda.Blob , _ []byte ) ([]coreda.Commitment , error ) {
153- d .logger .Debug ("Commit called" , " numBlobs" , len (blobs ))
153+ d .logger .Debug ("Commit called, numBlobs: " , len (blobs ))
154154 commits := make ([]coreda.Commitment , len (blobs ))
155155 for i , blob := range blobs {
156156 commits [i ] = d .getHash (blob )
157157 }
158- d .logger .Debug ("Commit successful" , " count" , len (commits ))
158+ d .logger .Debug ("Commit successful, count: " , len (commits ))
159159 return commits , nil
160160}
161161
162162// SubmitWithOptions stores blobs in DA layer (options are ignored).
163163func (d * LocalDA ) SubmitWithOptions (ctx context.Context , blobs []coreda.Blob , gasPrice float64 , _ []byte , _ []byte ) ([]coreda.ID , error ) {
164- d .logger .Info ("SubmitWithOptions called" , " numBlobs" , len (blobs ), "gasPrice" , gasPrice )
164+ d .logger .Info ("SubmitWithOptions called, numBlobs: " , len (blobs ), "gasPrice: " , gasPrice )
165165 d .mu .Lock ()
166166 defer d .mu .Unlock ()
167167 ids := make ([]coreda.ID , len (blobs ))
@@ -172,13 +172,13 @@ func (d *LocalDA) SubmitWithOptions(ctx context.Context, blobs []coreda.Blob, ga
172172
173173 d .data [d .height ] = append (d .data [d .height ], kvp {ids [i ], blob })
174174 }
175- d .logger .Info ("SubmitWithOptions successful" , " newHeight" , d .height , "count" , len (ids ))
175+ d .logger .Info ("SubmitWithOptions successful, newHeight: " , d .height , "count: " , len (ids ))
176176 return ids , nil
177177}
178178
179179// Submit stores blobs in DA layer (options are ignored).
180180func (d * LocalDA ) Submit (ctx context.Context , blobs []coreda.Blob , gasPrice float64 , _ []byte ) ([]coreda.ID , error ) {
181- d .logger .Info ("Submit called" , " numBlobs" , len (blobs ), "gasPrice" , gasPrice )
181+ d .logger .Info ("Submit called, numBlobs: " , len (blobs ), "gasPrice: " , gasPrice )
182182 d .mu .Lock ()
183183 defer d .mu .Unlock ()
184184 ids := make ([]coreda.ID , len (blobs ))
@@ -189,23 +189,23 @@ func (d *LocalDA) Submit(ctx context.Context, blobs []coreda.Blob, gasPrice floa
189189
190190 d .data [d .height ] = append (d .data [d .height ], kvp {ids [i ], blob })
191191 }
192- d .logger .Info ("Submit successful" , " newHeight" , d .height , "count" , len (ids ))
192+ d .logger .Info ("Submit successful, newHeight: " , d .height , "count: " , len (ids ))
193193 return ids , nil
194194}
195195
196196// Validate checks the Proofs for given IDs.
197197func (d * LocalDA ) Validate (ctx context.Context , ids []coreda.ID , proofs []coreda.Proof , _ []byte ) ([]bool , error ) {
198- d .logger .Debug ("Validate called" , " numIDs" , len (ids ), "numProofs" , len (proofs ))
198+ d .logger .Debug ("Validate called, numIDs: " , len (ids ), "numProofs: " , len (proofs ))
199199 if len (ids ) != len (proofs ) {
200- d .logger .Error ("Validate: id/proof count mismatch" , " ids" , len (ids ), "proofs" , len (proofs ))
200+ d .logger .Error ("Validate: id/proof count mismatch, ids: " , len (ids ), "proofs: " , len (proofs ))
201201 return nil , errors .New ("number of IDs doesn't equal to number of proofs" )
202202 }
203203 results := make ([]bool , len (ids ))
204204 for i := 0 ; i < len (ids ); i ++ {
205205 results [i ] = ed25519 .Verify (d .pubKey , ids [i ][8 :], proofs [i ])
206- d .logger .Debug ("Validate result" , "id " , ids [i ], "result" , results [i ])
206+ d .logger .Debug ("Validate result, id: " , ids [i ], "result: " , results [i ])
207207 }
208- d .logger .Debug ("Validate finished" , " results" , results )
208+ d .logger .Debug ("Validate finished, results: " , results )
209209 return results , nil
210210}
211211
0 commit comments