Skip to content
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

refactor: add account nonce as input of run_validate and remove validation output #822

Conversation

ArniStarkware
Copy link
Contributor

@ArniStarkware ArniStarkware commented Sep 16, 2024

This change is Reviewable

Copy link

codecov bot commented Sep 16, 2024

Codecov Report

Attention: Patch coverage is 40.00000% with 6 lines in your changes missing coverage. Please review.

Project coverage is 26.62%. Comparing base (7da2d63) to head (5060ddd).
Report is 10 commits behind head on main.

Files with missing lines Patch % Lines
crates/gateway/src/gateway.rs 14.28% 2 Missing and 4 partials ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main     #822       +/-   ##
===========================================
- Coverage   74.29%   26.62%   -47.67%     
===========================================
  Files         358      114      -244     
  Lines       36288    12067    -24221     
  Branches    36288    12067    -24221     
===========================================
- Hits        26960     3213    -23747     
- Misses       7190     8618     +1428     
+ Partials     2138      236     -1902     
Flag Coverage Δ
26.62% <40.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ArniStarkware ArniStarkware force-pushed the arni/executable_tx_in_gateway/stateful_validator_output branch from a52dd31 to 9f74ad3 Compare September 17, 2024 06:39
@ArniStarkware ArniStarkware force-pushed the arni/executable_tx_in_gateway/remove_stateful_validator_output branch from 5625ed5 to 46125e4 Compare September 17, 2024 06:39
Copy link
Contributor

@yair-starkware yair-starkware left a 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 r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @ArniStarkware)


crates/gateway/src/gateway.rs line 169 at r1 (raw file):

    let account_nonce = validator.get_nonce(sender_address).map_err(|e| {
        error!("Failed to get nonce for sender address {}: {}", sender_address, e);
        GatewaySpecError::UnexpectedError { data: "Internal server error.".to_owned() }

I don't think this should be an internal error.
When does getting the nonce fail?

Code quote:

        error!("Failed to get nonce for sender address {}: {}", sender_address, e);
        GatewaySpecError::UnexpectedError { data: "Internal server error.".to_owned() }

@ArniStarkware ArniStarkware force-pushed the arni/executable_tx_in_gateway/remove_stateful_validator_output branch from 46125e4 to df4c10a Compare September 18, 2024 04:34
@ArniStarkware ArniStarkware force-pushed the arni/executable_tx_in_gateway/stateful_validator_output branch from 9f74ad3 to 735383b Compare September 18, 2024 06:56
@ArniStarkware ArniStarkware force-pushed the arni/executable_tx_in_gateway/remove_stateful_validator_output branch from df4c10a to 392d97a Compare September 18, 2024 06:57
@ArniStarkware ArniStarkware force-pushed the arni/executable_tx_in_gateway/stateful_validator_output branch from 735383b to 580522c Compare September 18, 2024 07:00
@ArniStarkware ArniStarkware force-pushed the arni/executable_tx_in_gateway/remove_stateful_validator_output branch from 392d97a to 41a3e0d Compare September 18, 2024 07:01
@ArniStarkware ArniStarkware force-pushed the arni/executable_tx_in_gateway/stateful_validator_output branch from 580522c to df73a6d Compare September 18, 2024 07:24
@ArniStarkware ArniStarkware force-pushed the arni/executable_tx_in_gateway/remove_stateful_validator_output branch from 41a3e0d to 2bdc640 Compare September 18, 2024 07:24
@ArniStarkware ArniStarkware force-pushed the arni/executable_tx_in_gateway/stateful_validator_output branch from df73a6d to 688ea10 Compare September 18, 2024 08:32
@ArniStarkware ArniStarkware force-pushed the arni/executable_tx_in_gateway/remove_stateful_validator_output branch from 2bdc640 to db5fdd1 Compare September 18, 2024 08:33
Copy link
Contributor

@Yael-Starkware Yael-Starkware left a 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 3 files reviewed, 1 unresolved discussion (waiting on @yair-starkware)


crates/gateway/src/gateway.rs line 169 at r1 (raw file):

Previously, yair-starkware (Yair) wrote…

I don't think this should be an internal error.
When does getting the nonce fail?

Getting the nonce from the storage fails if the contract address doesn't exist, but in this case, the state reader will return the default value and not an error.
Other failures derive from communication, serde, internal papyrus error, etc, so I think it makes sense to classify it as an internal error.

@ArniStarkware ArniStarkware force-pushed the arni/executable_tx_in_gateway/stateful_validator_output branch from 688ea10 to e482c6d Compare September 18, 2024 12:29
@ArniStarkware ArniStarkware force-pushed the arni/executable_tx_in_gateway/remove_stateful_validator_output branch from db5fdd1 to 8ab1e32 Compare September 18, 2024 12:29
@ArniStarkware ArniStarkware force-pushed the arni/executable_tx_in_gateway/stateful_validator_output branch from e482c6d to 1e1fbc9 Compare September 19, 2024 07:03
@ArniStarkware ArniStarkware force-pushed the arni/executable_tx_in_gateway/remove_stateful_validator_output branch from 8ab1e32 to 7921033 Compare September 19, 2024 07:03
@ArniStarkware ArniStarkware force-pushed the arni/executable_tx_in_gateway/stateful_validator_output branch from 1e1fbc9 to 7e19e82 Compare September 19, 2024 07:04
@ArniStarkware ArniStarkware force-pushed the arni/executable_tx_in_gateway/remove_stateful_validator_output branch from 7921033 to 2866c29 Compare September 19, 2024 07:04
@ArniStarkware
Copy link
Contributor Author

crates/gateway/src/gateway.rs line 169 at r1 (raw file):

Previously, Yael-Starkware (YaelD) wrote…

Getting the nonce from the storage fails if the contract address doesn't exist, but in this case, the state reader will return the default value and not an error.
Other failures derive from communication, serde, internal papyrus error, etc, so I think it makes sense to classify it as an internal error.

If I understand @Yael-Starkware correctly, this should indeed be an internal error. No error should be handled differently, and indeed, some internal errors may arise.

Copy link
Contributor

@yair-starkware yair-starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewable status: 2 of 3 files reviewed, all discussions resolved (waiting on @ArniStarkware)

Copy link
Contributor Author

@ArniStarkware ArniStarkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @ArniStarkware)

Copy link
Contributor Author

ArniStarkware commented Sep 22, 2024

Merge activity

@ArniStarkware ArniStarkware changed the base branch from arni/executable_tx_in_gateway/stateful_validator_output to graphite-base/822 September 22, 2024 07:05
@ArniStarkware ArniStarkware changed the base branch from graphite-base/822 to main September 22, 2024 07:05
@ArniStarkware ArniStarkware force-pushed the arni/executable_tx_in_gateway/remove_stateful_validator_output branch from 2866c29 to 5060ddd Compare September 22, 2024 07:06
@ArniStarkware ArniStarkware merged commit 3753a5d into main Sep 22, 2024
14 checks passed
@ArniStarkware ArniStarkware deleted the arni/executable_tx_in_gateway/remove_stateful_validator_output branch September 22, 2024 11:35
@github-actions github-actions bot locked and limited conversation to collaborators Sep 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants