-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: add tests for add tx on declare tx #235
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @ArniStarkware and the rest of your teammates on Graphite |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #235 +/- ##
==========================================
+ Coverage 76.98% 83.21% +6.22%
==========================================
Files 28 28
Lines 1382 1382
Branches 1382 1382
==========================================
+ Hits 1064 1150 +86
+ Misses 265 173 -92
- Partials 53 59 +6 ☔ View full report in Codecov by Sentry. |
bfed131
to
6b57043
Compare
480bd63
to
3d3c37b
Compare
6b57043
to
7557759
Compare
3d3c37b
to
818e19f
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: 0 of 6 files reviewed, 1 unresolved discussion (waiting on @ArniStarkware and @dafnamatsry)
crates/gateway/src/starknet_api_test_utils.rs
line 96 at r2 (raw file):
pub fn declare_tx() -> ExternalTransaction { env::set_current_dir(get_absolute_path(TEST_FILES_FOLDER)).expect("Couldn't set working dir."); let json_file_path = Path::new(DECLARE_V3_TX_FILE);
I don't think we should take the transaction from a json file, we should create it in the code as we do with invoke.
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: 0 of 6 files reviewed, 1 unresolved discussion (waiting on @ArniStarkware and @dafnamatsry)
crates/gateway/src/starknet_api_test_utils.rs
line 96 at r2 (raw file):
Previously, Yael-Starkware (YaelD) wrote…
I don't think we should take the transaction from a json file, we should create it in the code as we do with invoke.
(and also as in deploy_account - PR https://reviewable.io/reviews/starkware-libs/mempool/239#-)
Previously, Yael-Starkware (YaelD) wrote…
The difference between I agree - this is also bad for consistency. |
7557759
to
af43060
Compare
818e19f
to
f57c7fc
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: 0 of 6 files reviewed, 1 unresolved discussion (waiting on @ArniStarkware and @dafnamatsry)
crates/gateway/src/starknet_api_test_utils.rs
line 96 at r2 (raw file):
Previously, ArniStarkware (Arnon Hod) wrote…
The difference between
Invoke
/DeployAccount
andDeclare
is that the declare tx is much bigger. The Sierra program is long.I agree - this is also bad for consistency.
I think the solution is to load from a json only thecontract_class
/ only thesierra_program
.
WDYT?
I agree.
af43060
to
42eaf2b
Compare
f57c7fc
to
fc6deec
Compare
42eaf2b
to
f3b59f6
Compare
fc6deec
to
abd66c0
Compare
f3b59f6
to
71b97d2
Compare
7a0d0e9
to
05f268b
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: 0 of 7 files reviewed, 1 unresolved discussion (waiting on @dafnamatsry and @Yael-Starkware)
crates/gateway/src/starknet_api_test_utils.rs
line 96 at r2 (raw file):
Previously, Yael-Starkware (YaelD) wrote…
I agree.
Done.
05f268b
to
ee53252
Compare
ee53252
to
4d1ec27
Compare
4fb33d1
to
dc20f13
Compare
09b9c05
to
4fad704
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: 1 of 8 files reviewed, all discussions resolved (waiting on @dafnamatsry and @Yael-Starkware)
crates/gateway/src/stateful_transaction_validator_test.rs
line 28 at r7 (raw file):
local_test_state_reader_factory(CairoVersion::Cairo1, false), Ok(TransactionHash(StarkFelt::try_from( "0x007d70505b4487a4e1c1a4b4e4342cb5aa9e73b86d031891170c45a57ad8b4e6"
why was this hash affected?
Code quote:
"0x007d70505b4487a4e1c1a4b4e4342cb5aa9e73b86d031891170c45a57ad8b4e6"
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: 1 of 8 files reviewed, all discussions resolved (waiting on @dafnamatsry and @Yael-Starkware)
crates/gateway/src/stateful_transaction_validator_test.rs
line 28 at r7 (raw file):
Previously, ArniStarkware (Arnon Hod) wrote…
why was this hash affected?
Because I changed VALID_L1_GAS_MAX_AMOUNT
.
dc20f13
to
7c93ecc
Compare
d7aba7b
to
d628146
Compare
d628146
to
686daf9
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 7 files at r5, 5 of 5 files at r7, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @dafnamatsry)
686daf9
to
5419863
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 7 files at r5, 5 of 5 files at r7, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @ArniStarkware)
crates/gateway/src/gateway_test.rs
line 74 at r7 (raw file):
local_test_state_reader_factory_for_deploy_account(&tx) )] #[case::declare_tx(declare_tx(), local_test_state_reader_factory(CairoVersion::Cairo1, false))]
to be consistent with the other test cases.
Suggestion:
valid_declare_tx
crates/gateway/src/gateway_test.rs
line 102 at r7 (raw file):
assert_eq!(tx_hash, serde_json::from_slice(response_bytes).unwrap()); }
Please add a test for bad declare tx (bad sierra program).
crates/gateway/src/starknet_api_test_utils.rs
line 102 at r7 (raw file):
let cairo_version = CairoVersion::Cairo1; let account_contract = FeatureContract::AccountWithoutValidations(cairo_version);
Suggestion:
let account_contract = FeatureContract::AccountWithoutValidations(CairoVersion::Cairo1);
5419863
to
6d1e94b
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: 6 of 8 files reviewed, 3 unresolved discussions (waiting on @dafnamatsry and @Yael-Starkware)
crates/gateway/src/gateway_test.rs
line 74 at r7 (raw file):
Previously, dafnamatsry wrote…
to be consistent with the other test cases.
Done.
crates/gateway/src/gateway_test.rs
line 102 at r7 (raw file):
Previously, dafnamatsry wrote…
Please add a test for bad declare tx (bad sierra program).
I think it is redundant, as there are unit tests for the compile util.
Anyway - Covered in #246.
crates/gateway/src/starknet_api_test_utils.rs
line 102 at r7 (raw file):
let cairo_version = CairoVersion::Cairo1; let account_contract = FeatureContract::AccountWithoutValidations(cairo_version);
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.
Reviewed 2 of 2 files at r8, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @Yael-Starkware)
6d1e94b
to
a70795b
Compare
This change is