-
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
feat: implement thin transaction converter #145
feat: implement thin transaction converter #145
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #145 +/- ##
==========================================
- Coverage 46.05% 45.41% -0.65%
==========================================
Files 19 19
Lines 634 643 +9
Branches 634 643 +9
==========================================
Hits 292 292
- Misses 328 337 +9
Partials 14 14 ☔ View full report in Codecov by Sentry. |
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 2 files reviewed, 2 unresolved discussions (waiting on @elintul, @MohammadNassar1, and @Yael-Starkware)
crates/gateway/src/starknet_api_test_utils.rs
line 38 at r1 (raw file):
ExternalTransaction::Invoke(ExternalInvokeTransaction::V3(tx)) => tx.nonce, } }
Consider defining this in starknet API similar to #234
(Note - I did not include sender_address
here as it does not work for deploy account).
Code quote:
pub fn get_tip(tx: &ExternalTransaction) -> Tip {
match tx {
ExternalTransaction::Declare(ExternalDeclareTransaction::V3(tx)) => tx.tip,
ExternalTransaction::DeployAccount(ExternalDeployAccountTransaction::V3(tx)) => tx.tip,
ExternalTransaction::Invoke(ExternalInvokeTransaction::V3(tx)) => tx.tip,
}
}
pub fn get_nonce(tx: &ExternalTransaction) -> Nonce {
match tx {
ExternalTransaction::Declare(ExternalDeclareTransaction::V3(tx)) => tx.nonce,
ExternalTransaction::DeployAccount(ExternalDeployAccountTransaction::V3(tx)) => tx.nonce,
ExternalTransaction::Invoke(ExternalInvokeTransaction::V3(tx)) => tx.nonce,
}
}
crates/gateway/src/starknet_api_test_utils.rs
line 49 at r1 (raw file):
ExternalTransaction::Invoke(ExternalInvokeTransaction::V3(tx)) => tx.sender_address, } }
Suggestion:
pub fn get_sender_address(tx: &ExternalTransaction) -> ContractAddress {
match tx {
ExternalTransaction::Declare(ExternalDeclareTransaction::V3(tx)) => tx.sender_address,
// TODO(Mohammad): Add support for deploy account.
ExternalTransaction::DeployAccount(ExternalDeployAccountTransaction::V3(_)) => {
ContractAddress::default()
}
ExternalTransaction::Invoke(ExternalInvokeTransaction::V3(tx)) => tx.sender_address,
}
}
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 2 files reviewed, 2 unresolved discussions (waiting on @ArniStarkware, @elintul, and @Yael-Starkware)
crates/gateway/src/starknet_api_test_utils.rs
line 49 at r1 (raw file):
ExternalTransaction::Invoke(ExternalInvokeTransaction::V3(tx)) => tx.sender_address, } }
Why sender_address
? In Mempool we tend to use contract_address
.
Previously, ArniStarkware (Arnon Hod) wrote…
As discussed in DMs. This is nonblocking. I do suggest we conform to the same design. |
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 2 files reviewed, 2 unresolved discussions (waiting on @elintul, @MohammadNassar1, and @Yael-Starkware)
crates/gateway/src/starknet_api_test_utils.rs
line 49 at r1 (raw file):
Previously, MohammadNassar1 (mohammad-starkware) wrote…
Why
sender_address
? In Mempool we tend to usecontract_address
.
- I did not know that about Mempool, so I am willing to concede it.
- This field is called
sender_address
in external transactions. This is a property of external transactions.
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 2 files reviewed, 2 unresolved discussions (waiting on @ArniStarkware, @elintul, and @Yael-Starkware)
crates/gateway/src/starknet_api_test_utils.rs
line 38 at r1 (raw file):
Previously, ArniStarkware (Arnon Hod) wrote…
As discussed in DMs. This is nonblocking.
I do suggest we conform to the same design.
Opened a PR, please take a look:
starkware-libs/starknet-api#255
f48aaa5
to
8c0da42
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 2 files reviewed, 2 unresolved discussions (waiting on @ArniStarkware, @elintul, and @Yael-Starkware)
crates/gateway/src/starknet_api_test_utils.rs
line 38 at r1 (raw file):
Previously, MohammadNassar1 (mohammad-starkware) wrote…
Opened a PR, please take a look:
starkware-libs/starknet-api#255
Integrating the new SN_API commit is a bit more complicated as it includes some breaking changes made by other teams.
Currently, I added a TODO to use it from the SN_API once the blockier supports the new SN_API version.
crates/gateway/src/starknet_api_test_utils.rs
line 49 at r1 (raw file):
Previously, ArniStarkware (Arnon Hod) wrote…
- I did not know that about Mempool, so I am willing to concede it.
- This field is called
sender_address
in external transactions. This is a property of external transactions.
Changed to sender_address
.
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 r2, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @elintul and @Yael-Starkware)
This change is