-
Notifications
You must be signed in to change notification settings - Fork 89
feat: dump_declared_classes can dump for a specific block range #1283
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 4 of 4 files at r1, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @Yael-Starkware)
crates/dump_declared_classes/src/main.rs
line 11 at r1 (raw file):
/// The file path can be passed as an argument, otherwise it will be dumped to /// "dump_declared_classes.json". /// A starting block and an ending block can also be passed as optional arguments, otherwise the
A start block and an end block
Code quote:
A starting block and an ending block
crates/dump_declared_classes/src/main.rs
line 14 at r1 (raw file):
/// entire table will be dumped. fn main() { let matches = Command::new("Dump declared classes")
move the part of parsing the command-line parameters to a separate function.
crates/dump_declared_classes/src/main.rs
line 14 at r1 (raw file):
/// entire table will be dumped. fn main() { let matches = Command::new("Dump declared classes")
Add a validation that start_block value exists iff end_block value exists.
And validate that stark_block<=end_block.
(Is it possible to validate that end_block < last block ?)
crates/dump_declared_classes/src/main.rs
line 37 at r1 (raw file):
let file_path = matches.get_one::<String>("file_path").unwrap().as_str(); let res: StorageResult<()> =
Maybe call dump_declared_classes_table_to_file() function for both cases (with / without block-range) and inside it separate it to 2 functions (instead of doing it here).
2ff9ce9
to
fe9d358
Compare
Codecov Report
@@ Coverage Diff @@
## main #1283 +/- ##
==========================================
- Coverage 72.99% 72.50% -0.50%
==========================================
Files 84 84
Lines 7972 8059 +87
Branches 7972 8059 +87
==========================================
+ Hits 5819 5843 +24
- Misses 1229 1284 +55
- Partials 924 932 +8
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
a60d5e5
to
0a67776
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 2 of 5 files reviewed, 4 unresolved discussions (waiting on @OmriEshhar1)
crates/dump_declared_classes/src/main.rs
line 11 at r1 (raw file):
Previously, OmriEshhar1 wrote…
A start block and an end block
Done.
crates/dump_declared_classes/src/main.rs
line 14 at r1 (raw file):
Previously, OmriEshhar1 wrote…
Add a validation that start_block value exists iff end_block value exists.
And validate that stark_block<=end_block.
(Is it possible to validate that end_block < last block ?)
added now that both start_block and end_block are required.
added a check that start_block< end_block
also possible to check end_block < last block, done
crates/dump_declared_classes/src/main.rs
line 37 at r1 (raw file):
Previously, OmriEshhar1 wrote…
Maybe call dump_declared_classes_table_to_file() function for both cases (with / without block-range) and inside it separate it to 2 functions (instead of doing it here).
not relevant anymore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 3 of 3 files at r2, all commit messages.
Reviewable status: all files reviewed, 8 unresolved discussions (waiting on @Yael-Starkware)
crates/dump_declared_classes/src/main.rs
line 10 at r2 (raw file):
/// The start_block and end_block arguments are mandatory and define the block range to dump, /// start_block is inclusive and end_block is exclusive. The file_path is an optional parameter, /// otherwise the data will be dumped to "dump_declared_classes.json".
Maybe move this part of the documentation to fn get_cli_params()
Code quote:
/// The start_block and end_block arguments are mandatory and define the block range to dump,
/// start_block is inclusive and end_block is exclusive. The file_path is an optional parameter,
/// otherwise the data will be dumped to "dump_declared_classes.json".
crates/dump_declared_classes/src/main.rs
line 14 at r2 (raw file):
let cli_params = get_cli_params(); match dump_declared_classes_table_by_block_range(cli_params.start_block, cli_params.end_block, &cli_params.file_path) { Ok(_) => println!("Dumped declared_classes table to file: {}", cli_params.file_path),
add . at end of sentenece (x2)
crates/dump_declared_classes/src/main.rs
line 64 at r2 (raw file):
panic!("start_block must be smaller than end_block"); } let compile_class_marker =
compiled_class_marker
Code quote:
compile_class_marker
crates/dump_declared_classes/src/main.rs
line 65 at r2 (raw file):
} let compile_class_marker = get_compiled_class_marker().expect("couldn't get compiled class marker");
Couldn't get compiled_class marker.
Code quote:
couldn't get compiled class marker
crates/dump_declared_classes/src/main.rs
line 66 at r2 (raw file):
let compile_class_marker = get_compiled_class_marker().expect("couldn't get compiled class marker"); if start_block > compile_class_marker.0 || end_block > compile_class_marker.0 {
it's enough to check end_block
crates/papyrus_storage/src/utils_test.rs
line 16 at r2 (raw file):
#[test] fn test_dump_table_to_file() {
change the name of the test
test_dump_declared_classes() ?
Code quote:
test_dump_table_to_file
crates/papyrus_storage/src/utils_test.rs
line 49 at r2 (raw file):
.unwrap(); } let txn = reader.begin_ro_txn().unwrap();
add empty line
crates/papyrus_storage/src/utils_test.rs
line 50 at r2 (raw file):
} let txn = reader.begin_ro_txn().unwrap(); // Test dump_declared_classes_to_file
// Test dump_table_to_file for declared_clases table.
Code quote:
// Test dump_declared_classes_to_file
0a67776
to
878aac1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 8 unresolved discussions (waiting on @OmriEshhar1)
crates/dump_declared_classes/src/main.rs
line 10 at r2 (raw file):
Previously, OmriEshhar1 wrote…
Maybe move this part of the documentation to fn get_cli_params()
Done
crates/dump_declared_classes/src/main.rs
line 14 at r2 (raw file):
Previously, OmriEshhar1 wrote…
add . at end of sentenece (x2)
done
crates/dump_declared_classes/src/main.rs
line 64 at r2 (raw file):
Previously, OmriEshhar1 wrote…
compiled_class_marker
fixed and moved this code to utils.rs
crates/dump_declared_classes/src/main.rs
line 65 at r2 (raw file):
Previously, OmriEshhar1 wrote…
Couldn't get compiled_class marker.
this code was deleted
crates/dump_declared_classes/src/main.rs
line 66 at r2 (raw file):
Previously, OmriEshhar1 wrote…
it's enough to check end_block
right done , now in utils.rs
crates/papyrus_storage/src/utils_test.rs
line 16 at r2 (raw file):
Previously, OmriEshhar1 wrote…
change the name of the test
test_dump_declared_classes() ?
done
crates/papyrus_storage/src/utils_test.rs
line 49 at r2 (raw file):
Previously, OmriEshhar1 wrote…
add empty line
Done.
crates/papyrus_storage/src/utils_test.rs
line 50 at r2 (raw file):
Previously, OmriEshhar1 wrote…
// Test dump_table_to_file for declared_clases table.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 2 of 6 files reviewed, 8 unresolved discussions (waiting on @OmriEshhar1)
crates/dump_declared_classes/src/main.rs
line 14 at r1 (raw file):
Previously, OmriEshhar1 wrote…
move the part of parsing the command-line parameters to a separate function.
Done.
878aac1
to
9108b6b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 3 of 4 files at r3, 1 of 1 files at r4, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @Yael-Starkware)
9108b6b
to
024b1db
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r5, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @Yael-Starkware)
Pull Request type
Please check the type of change your PR introduces:
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this introduce a breaking change?
Other information
This change is