Skip to content

Commit 1fc7456

Browse files
committed
Update explanation of how to generate imutable files
1 parent 3401d6f commit 1fc7456

File tree

1 file changed

+2
-66
lines changed

1 file changed

+2
-66
lines changed

mithril-test-lab/test_data/README.md

Lines changed: 2 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -5,69 +5,5 @@
55
> immutable db directory by our db parser (see ([immutable_file.rs](./../../mithril-common/src/digesters/immutable_file.rs))).
66
77
> [!NOTE]
8-
> The `.primary` and `.secondary` files are not real data. They're empty files that are
9-
> here in order to simulate a real cardano immutable db structure.
10-
11-
These files were generated manually from the blocks in the sibling folder:
12-
13-
| Imput Block file | Number of transactions | Output immutable file |
14-
|------------------|------------------------|-----------------------|
15-
| [byron2.block](./blocks/byron2.block) | `2` | `00000.chunk` |
16-
| [shelley1.block](./blocks/shelley1.block) | `4` | `00000.chunk` |
17-
| [mary1.block](./blocks/mary1.block) | `14` | `00000.chunk` |
18-
| [allegra1.block](./blocks/allegra1.block) | `3` | `00001.chunk` |
19-
| [alonzo1.block](./blocks/alonzo1.block) | `5` | `00001.chunk` |
20-
| [conway1.block](./blocks/conway1.block) | `1` | `00001.chunk` |
21-
22-
The following code was used to generate the immutable files:
23-
```rust
24-
use std::io::Write;
25-
26-
let immutable_files = vec![
27-
(
28-
"./00000.chunk",
29-
vec![
30-
(
31-
include_str!("./blocks/byron2.block"),
32-
2usize,
33-
),
34-
(
35-
include_str!("./blocks/shelley1.block"),
36-
4,
37-
),
38-
(
39-
include_str!("./blocks/mary1.block"),
40-
14,
41-
),
42-
],
43-
),
44-
(
45-
"./00001.chunk",
46-
vec![
47-
(
48-
include_str!("./blocks/allegra1.block"),
49-
3,
50-
),
51-
(
52-
include_str!("./blocks/alonzo1.block"),
53-
5,
54-
),
55-
(
56-
include_str!("./blocks/conway1.block"),
57-
5,
58-
),
59-
],
60-
),
61-
];
62-
63-
for immutable_file_definition in immutable_files {
64-
let immutable_file_path = immutable_file_definition.0;
65-
let mut immutable_file = fs::File::create(immutable_file_path).unwrap();
66-
67-
for (block_str, _tx_count) in immutable_file_definition.1.into_iter() {
68-
let cbor = hex::decode(block_str).expect("invalid hex");
69-
immutable_file.write_all(&cbor).unwrap();
70-
}
71-
}
72-
```
73-
8+
> The immutable files (`.chunk`, `.primary` and `.secondary`) files are data that are the result of
9+
> the `mithril-end-to-end` test command execution.

0 commit comments

Comments
 (0)