-
Notifications
You must be signed in to change notification settings - Fork 25
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: refactor the stateful tx validator to get executable tx as input #519
refactor: refactor the stateful tx validator to get executable tx as input #519
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @ArniStarkware and the rest of your teammates on Graphite |
fe7f892
to
74144ec
Compare
8fd60c6
to
867299e
Compare
1bd225e
to
ef4229f
Compare
867299e
to
c081dd8
Compare
ef4229f
to
eac85a8
Compare
c081dd8
to
7dcaf90
Compare
eac85a8
to
9c0e1fa
Compare
7dcaf90
to
35f5961
Compare
9c0e1fa
to
cf3cdac
Compare
35f5961
to
4b460e4
Compare
cf3cdac
to
b056be0
Compare
4b460e4
to
cc0e749
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 5 files at r1, 3 of 3 files at r2, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @ArniStarkware, @ayeletstarkware, @MohammadNassar1, and @yair-starkware)
crates/gateway/src/stateful_transaction_validator.rs
line 77 at r2 (raw file):
mut validator: V, ) -> StatefulTransactionValidatorResult<ValidateInfo> { let account_tx = AccountTransaction::try_from(executable_tx.clone()).map_err(|error| {
Why the clone here? Can't AccountTransaction::try_from
get a reference?
Code quote:
executable_tx.clone()
crates/gateway/src/stateful_transaction_validator.rs
line 78 at r2 (raw file):
) -> StatefulTransactionValidatorResult<ValidateInfo> { let account_tx = AccountTransaction::try_from(executable_tx.clone()).map_err(|error| { error!("Failed to executable transaction into account transaction: {}", error);
Suggestion:
Failed to convert executable transaction into account transaction: {}
crates/gateway/src/stateful_transaction_validator_test.rs
line 81 at r2 (raw file):
#[case::invalid_tx(invoke_tx(CairoVersion::Cairo1), Err(STATEFUL_VALIDATOR_FEE_ERROR))] fn test_stateful_tx_validator( #[case] external_tx: RpcTransaction,
I think the test should start with an executable tx, and not do any conversion, and especially not compile anything.
Code quote:
#[case] external_tx: RpcTransaction,
b056be0
to
c993729
Compare
cc0e749
to
98da56f
Compare
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: 4 of 10 files reviewed, 1 unresolved discussion (waiting on @ayeletstarkware, @dafnamatsry, @MohammadNassar1, and @yair-starkware)
crates/gateway/src/gateway_test.rs
line 161 at r8 (raw file):
Previously, dafnamatsry wrote…
Can you explain?
No. I would rather delete this function :)
This was a test util that should be deprecated.
Let us update the test.
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: 4 of 10 files reviewed, 1 unresolved discussion (waiting on @ayeletstarkware, @dafnamatsry, @MohammadNassar1, and @yair-starkware)
crates/gateway/src/stateful_transaction_validator_test.rs
line 67 at r9 (raw file):
executable_invoke_tx(CairoVersion::Cairo1), Ok(ValidateInfo{ tx_hash: TransactionHash::default(),
This is not the subject of this test.
This value is deleted in #521.
Code quote:
tx_hash: TransactionHash::default(),
Previously, ArniStarkware (Arnon Hod) wrote…
The original thread was about a test util called |
176981b
to
b4e640f
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 1 of 6 files at r7, 3 of 8 files at r8, 5 of 5 files at r11, all commit messages.
Reviewable status: 9 of 10 files reviewed, 1 unresolved discussion (waiting on @ayeletstarkware, @dafnamatsry, and @MohammadNassar1)
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: 9 of 10 files reviewed, 2 unresolved discussions (waiting on @ayeletstarkware, @dafnamatsry, and @MohammadNassar1)
a discussion (no related file):
In this PR we change the
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: 9 of 10 files reviewed, 1 unresolved discussion (waiting on @ayeletstarkware, @dafnamatsry, and @MohammadNassar1)
a discussion (no related file):
The original goal of this PR was to refactor the stateful tx validator so that it receives an executable transaction as input.
Another goal achieved is that the proper executable transaction is now used as the mempool input. This change occurred to address issues with the gateway_test: test_add_tx
. In the meantime we also cleaned some test utils for this test and for the stateful validator test.
b4e640f
to
1a4a07f
Compare
1a4a07f
to
811ebb9
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 4 of 5 files at r12, 5 of 5 files at r13, all commit messages.
Reviewable status: 9 of 10 files reviewed, all discussions resolved (waiting on @ayeletstarkware and @MohammadNassar1)
811ebb9
to
f159d01
Compare
The base changed before this PR in #837 Code quote: let response = add_tx(State(app_state), rpc_tx.into()).await.into_response();
let status_code = response.status();
let response_bytes = &to_bytes(response).await;
assert_eq!(status_code, StatusCode::OK, "{response_bytes:?}"); |
728fd16
to
c4e9a61
Compare
c4e9a61
to
ae9880e
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 1 of 7 files at r14, 1 of 6 files at r16, 5 of 5 files at r17, all commit messages.
Reviewable status: 9 of 10 files reviewed, all discussions resolved (waiting on @ayeletstarkware and @MohammadNassar1)
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: 9 of 10 files reviewed, all discussions resolved (waiting on @ayeletstarkware and @MohammadNassar1)
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 1 of 8 files at r8.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @ayeletstarkware and @MohammadNassar1)
In this PR we change the inputs for the
run_validate
method of the stateful validator. This also streamlinesprocess+tx
.This change is