@@ -146,14 +146,14 @@ async fn compare_chains(ocaml_endpoint: &str, mina_rust_endpoint: &str) -> Resul
146
146
) ;
147
147
148
148
let ocaml_chain = get_best_chain ( ocaml_endpoint) . await ?;
149
- let openmina_chain = get_best_chain ( mina_rust_endpoint) . await ?;
149
+ let mina_rust_chain = get_best_chain ( mina_rust_endpoint) . await ?;
150
150
151
151
println ! ( "Chain comparison:" ) ;
152
152
println ! ( "OCaml chain length: {}" , ocaml_chain. len( ) ) ;
153
- println ! ( "Mina Rust chain length: {}" , openmina_chain . len( ) ) ;
153
+ println ! ( "Mina Rust chain length: {}" , mina_rust_chain . len( ) ) ;
154
154
155
155
// Try to compare chains
156
- if let Err ( e) = compare_chain_data ( & ocaml_chain, & openmina_chain ) {
156
+ if let Err ( e) = compare_chain_data ( & ocaml_chain, & mina_rust_chain ) {
157
157
if attempt == MAX_RETRIES {
158
158
return Err ( e) ;
159
159
}
@@ -169,24 +169,24 @@ async fn compare_chains(ocaml_endpoint: &str, mina_rust_endpoint: &str) -> Resul
169
169
unreachable ! ( )
170
170
}
171
171
172
- fn compare_chain_data ( ocaml_chain : & [ String ] , openmina_chain : & [ String ] ) -> Result < ( ) > {
173
- if ocaml_chain. len ( ) != openmina_chain . len ( ) {
172
+ fn compare_chain_data ( ocaml_chain : & [ String ] , mina_rust_chain : & [ String ] ) -> Result < ( ) > {
173
+ if ocaml_chain. len ( ) != mina_rust_chain . len ( ) {
174
174
anyhow:: bail!(
175
175
"Chain lengths don't match! OCaml: {}, Mina Rust: {}" ,
176
176
ocaml_chain. len( ) ,
177
- openmina_chain . len( )
177
+ mina_rust_chain . len( )
178
178
) ;
179
179
}
180
180
181
- for ( i, ( ocaml_hash, openmina_hash ) ) in
182
- ocaml_chain. iter ( ) . zip ( openmina_chain . iter ( ) ) . enumerate ( )
181
+ for ( i, ( ocaml_hash, mina_rust_hash ) ) in
182
+ ocaml_chain. iter ( ) . zip ( mina_rust_chain . iter ( ) ) . enumerate ( )
183
183
{
184
- if ocaml_hash != openmina_hash {
184
+ if ocaml_hash != mina_rust_hash {
185
185
anyhow:: bail!(
186
186
"Chain mismatch at position {}: \n OCaml: {}\n Mina Rust: {}" ,
187
187
i,
188
188
ocaml_hash,
189
- openmina_hash
189
+ mina_rust_hash
190
190
) ;
191
191
}
192
192
}
@@ -202,20 +202,20 @@ struct DiffMismatch {
202
202
203
203
async fn compare_binary_diffs (
204
204
ocaml_dir : PathBuf ,
205
- openmina_dir : PathBuf ,
205
+ mina_rust_dir : PathBuf ,
206
206
state_hashes : & [ String ] ,
207
207
) -> Result < Vec < DiffMismatch > > {
208
208
let mut mismatches = Vec :: new ( ) ;
209
209
210
210
if state_hashes. is_empty ( ) {
211
211
println ! ( "No state hashes provided, comparing all diffs" ) ;
212
- let files = openmina_dir . read_dir ( ) ?;
212
+ let files = mina_rust_dir . read_dir ( ) ?;
213
213
files. for_each ( |file| {
214
214
let file = file. unwrap ( ) ;
215
215
let file_name = file. file_name ( ) ;
216
216
let file_name_str = file_name. to_str ( ) . unwrap ( ) ;
217
217
let ocaml_path = ocaml_dir. join ( file_name_str) ;
218
- let openmina_path = openmina_dir . join ( file_name_str) ;
218
+ let mina_rust_path = mina_rust_dir . join ( file_name_str) ;
219
219
220
220
// Load and deserialize both files
221
221
let ocaml_diff = match load_and_deserialize ( & ocaml_path) {
@@ -229,7 +229,7 @@ async fn compare_binary_diffs(
229
229
}
230
230
} ;
231
231
232
- let openmina_diff = match load_and_deserialize ( & openmina_path ) {
232
+ let mina_rust_diff = match load_and_deserialize ( & mina_rust_path ) {
233
233
Ok ( diff) => diff,
234
234
Err ( e) => {
235
235
mismatches. push ( DiffMismatch {
@@ -241,7 +241,7 @@ async fn compare_binary_diffs(
241
241
} ;
242
242
243
243
// Compare the diffs
244
- if let Some ( reason) = compare_diffs ( & ocaml_diff, & openmina_diff ) {
244
+ if let Some ( reason) = compare_diffs ( & ocaml_diff, & mina_rust_diff ) {
245
245
mismatches. push ( DiffMismatch {
246
246
state_hash : file_name_str. to_string ( ) ,
247
247
reason,
@@ -252,7 +252,7 @@ async fn compare_binary_diffs(
252
252
} else {
253
253
for state_hash in state_hashes {
254
254
let ocaml_path = ocaml_dir. join ( format ! ( "{}.bin" , state_hash) ) ;
255
- let openmina_path = openmina_dir . join ( format ! ( "{}.bin" , state_hash) ) ;
255
+ let mina_rust_path = mina_rust_dir . join ( format ! ( "{}.bin" , state_hash) ) ;
256
256
257
257
// Load and deserialize both files
258
258
let ocaml_diff = match load_and_deserialize ( & ocaml_path) {
@@ -266,7 +266,7 @@ async fn compare_binary_diffs(
266
266
}
267
267
} ;
268
268
269
- let openmina_diff = match load_and_deserialize ( & openmina_path ) {
269
+ let mina_rust_diff = match load_and_deserialize ( & mina_rust_path ) {
270
270
Ok ( diff) => diff,
271
271
Err ( e) => {
272
272
mismatches. push ( DiffMismatch {
@@ -278,7 +278,7 @@ async fn compare_binary_diffs(
278
278
} ;
279
279
280
280
// Compare the diffs
281
- if let Some ( reason) = compare_diffs ( & ocaml_diff, & openmina_diff ) {
281
+ if let Some ( reason) = compare_diffs ( & ocaml_diff, & mina_rust_diff ) {
282
282
mismatches. push ( DiffMismatch {
283
283
state_hash : state_hash. clone ( ) ,
284
284
reason,
@@ -297,9 +297,9 @@ fn load_and_deserialize(path: &PathBuf) -> Result<ArchiveTransitionFrontierDiff>
297
297
298
298
fn compare_diffs (
299
299
ocaml : & ArchiveTransitionFrontierDiff ,
300
- openmina : & ArchiveTransitionFrontierDiff ,
300
+ mina_rust : & ArchiveTransitionFrontierDiff ,
301
301
) -> Option < String > {
302
- match ( ocaml, openmina ) {
302
+ match ( ocaml, mina_rust ) {
303
303
(
304
304
ArchiveTransitionFrontierDiff :: BreadcrumbAdded {
305
305
block : ( b1, ( body_hash1, state_hash1) ) ,
@@ -341,77 +341,77 @@ fn compare_diffs(
341
341
if & b1_with_b2_proof != b2 {
342
342
let ocaml_json =
343
343
serde_json:: to_string_pretty ( & serde_json:: to_value ( b1) . unwrap ( ) ) . unwrap ( ) ;
344
- let openmina_json =
344
+ let mina_rust_json =
345
345
serde_json:: to_string_pretty ( & serde_json:: to_value ( b2) . unwrap ( ) ) . unwrap ( ) ;
346
346
mismatches. push ( format ! (
347
347
"Block data mismatch:\n OCaml:\n {}\n Mina Rust:\n {}" ,
348
- ocaml_json, openmina_json
348
+ ocaml_json, mina_rust_json
349
349
) ) ;
350
350
}
351
351
} else if b1 != b2 {
352
352
let ocaml_json =
353
353
serde_json:: to_string_pretty ( & serde_json:: to_value ( b1) . unwrap ( ) ) . unwrap ( ) ;
354
- let openmina_json =
354
+ let mina_rust_json =
355
355
serde_json:: to_string_pretty ( & serde_json:: to_value ( b2) . unwrap ( ) ) . unwrap ( ) ;
356
356
mismatches. push ( format ! (
357
357
"Block data mismatch:\n OCaml:\n {}\n Mina Rust:\n {}" ,
358
- ocaml_json, openmina_json
358
+ ocaml_json, mina_rust_json
359
359
) ) ;
360
360
}
361
361
362
362
if a1 != a2 {
363
363
let ids_ocaml = a1. iter ( ) . map ( |( id, _) | id. as_u64 ( ) ) . collect :: < HashSet < _ > > ( ) ;
364
- let ids_openmina = a2. iter ( ) . map ( |( id, _) | id. as_u64 ( ) ) . collect :: < HashSet < _ > > ( ) ;
364
+ let ids_mina_rust = a2. iter ( ) . map ( |( id, _) | id. as_u64 ( ) ) . collect :: < HashSet < _ > > ( ) ;
365
365
366
- // Find missing IDs in openmina (present in ocaml but not in openmina )
367
- let missing_in_openmina : Vec < _ > = ids_ocaml. difference ( & ids_openmina ) . collect ( ) ;
368
- // Find extra IDs in openmina (present in openmina but not in ocaml)
369
- let extra_in_openmina : Vec < _ > = ids_openmina . difference ( & ids_ocaml) . collect ( ) ;
366
+ // Find missing IDs in Rust (present in ocaml but not in Rust )
367
+ let missing_in_mina_rust : Vec < _ > = ids_ocaml. difference ( & ids_mina_rust ) . collect ( ) ;
368
+ // Find extra IDs in Rust (present in Rust but not in ocaml)
369
+ let extra_in_mina_rust : Vec < _ > = ids_mina_rust . difference ( & ids_ocaml) . collect ( ) ;
370
370
371
- if !missing_in_openmina . is_empty ( ) {
372
- println ! ( "Missing in Mina Rust: {:?}" , missing_in_openmina ) ;
371
+ if !missing_in_mina_rust . is_empty ( ) {
372
+ println ! ( "Missing in Mina Rust: {:?}" , missing_in_mina_rust ) ;
373
373
}
374
- if !extra_in_openmina . is_empty ( ) {
375
- println ! ( "Extra in Mina Rust: {:?}" , extra_in_openmina ) ;
374
+ if !extra_in_mina_rust . is_empty ( ) {
375
+ println ! ( "Extra in Mina Rust: {:?}" , extra_in_mina_rust ) ;
376
376
}
377
377
378
378
let ocaml_json =
379
379
serde_json:: to_string_pretty ( & serde_json:: to_value ( a1) . unwrap ( ) ) . unwrap ( ) ;
380
- let openmina_json =
380
+ let mina_rust_json =
381
381
serde_json:: to_string_pretty ( & serde_json:: to_value ( a2) . unwrap ( ) ) . unwrap ( ) ;
382
382
mismatches. push ( format ! (
383
383
"Accounts accessed mismatch:\n OCaml:\n {}\n Mina Rust:\n {}" ,
384
- ocaml_json, openmina_json
384
+ ocaml_json, mina_rust_json
385
385
) ) ;
386
386
}
387
387
if c1 != c2 {
388
388
let ocaml_json =
389
389
serde_json:: to_string_pretty ( & serde_json:: to_value ( c1) . unwrap ( ) ) . unwrap ( ) ;
390
- let openmina_json =
390
+ let mina_rust_json =
391
391
serde_json:: to_string_pretty ( & serde_json:: to_value ( c2) . unwrap ( ) ) . unwrap ( ) ;
392
392
mismatches. push ( format ! (
393
393
"Accounts created mismatch:\n OCaml:\n {}\n Mina Rust:\n {}" ,
394
- ocaml_json, openmina_json
394
+ ocaml_json, mina_rust_json
395
395
) ) ;
396
396
}
397
397
if t1 != t2 {
398
398
let ocaml_json =
399
399
serde_json:: to_string_pretty ( & serde_json:: to_value ( t1) . unwrap ( ) ) . unwrap ( ) ;
400
- let openmina_json =
400
+ let mina_rust_json =
401
401
serde_json:: to_string_pretty ( & serde_json:: to_value ( t2) . unwrap ( ) ) . unwrap ( ) ;
402
402
mismatches. push ( format ! (
403
403
"Tokens used mismatch:\n OCaml:\n {}\n Mina Rust:\n {}" ,
404
- ocaml_json, openmina_json
404
+ ocaml_json, mina_rust_json
405
405
) ) ;
406
406
}
407
407
if s1 != s2 {
408
408
let ocaml_json =
409
409
serde_json:: to_string_pretty ( & serde_json:: to_value ( s1) . unwrap ( ) ) . unwrap ( ) ;
410
- let openmina_json =
410
+ let mina_rust_json =
411
411
serde_json:: to_string_pretty ( & serde_json:: to_value ( s2) . unwrap ( ) ) . unwrap ( ) ;
412
412
mismatches. push ( format ! (
413
413
"Sender receipt chains mismatch:\n OCaml:\n {}\n Mina Rust:\n {}" ,
414
- ocaml_json, openmina_json
414
+ ocaml_json, mina_rust_json
415
415
) ) ;
416
416
}
417
417
@@ -424,11 +424,11 @@ fn compare_diffs(
424
424
_ => {
425
425
let ocaml_json =
426
426
serde_json:: to_string_pretty ( & serde_json:: to_value ( ocaml) . unwrap ( ) ) . unwrap ( ) ;
427
- let openmina_json =
428
- serde_json:: to_string_pretty ( & serde_json:: to_value ( openmina ) . unwrap ( ) ) . unwrap ( ) ;
427
+ let mina_rust_json =
428
+ serde_json:: to_string_pretty ( & serde_json:: to_value ( mina_rust ) . unwrap ( ) ) . unwrap ( ) ;
429
429
Some ( format ! (
430
430
"Different diff types:\n OCaml:\n {}\n Mina Rust:\n {}" ,
431
- ocaml_json, openmina_json
431
+ ocaml_json, mina_rust_json
432
432
) )
433
433
}
434
434
}
0 commit comments