-
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(gateway): add fee non zero validation #12
feat(gateway): add fee non zero validation #12
Conversation
e06cfff
to
952c4dd
Compare
39d7882
to
f35ff45
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 all commit messages.
Reviewable status: 0 of 2 files reviewed, 1 unresolved discussion (waiting on @ArniStarkware and @dafnamatsry)
crates/gateway/src/transaction_validator.rs
line 35 at r1 (raw file):
pub max_allowed_tx_version: TransactionVersion, pub enforce_fee: bool,
I think in Python we only use this flag for testing.
Code quote:
enforce_fee
f35ff45
to
ebac973
Compare
952c4dd
to
e1172c4
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## arni/transaction_validator/stateless/skelaton #12 +/- ##
=================================================================================
+ Coverage 83.70% 88.46% +4.75%
=================================================================================
Files 4 4
Lines 135 234 +99
Branches 135 234 +99
=================================================================================
+ Hits 113 207 +94
- Misses 20 22 +2
- Partials 2 5 +3 ☔ View full report in Codecov by Sentry. |
ebac973
to
d78d39c
Compare
e1172c4
to
1ef827f
Compare
5296e8c
to
f450b07
Compare
1ef827f
to
ece33af
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 4 files reviewed, 1 unresolved discussion (waiting on @dafnamatsry and @elintul)
crates/gateway/src/transaction_validator.rs
line 35 at r1 (raw file):
Previously, elintul (Elin) wrote…
I think in Python we only use this flag for testing.
Removed. If it is required, we will add it later.
f450b07
to
33aa4af
Compare
ece33af
to
2683200
Compare
33aa4af
to
c7884cd
Compare
2683200
to
f7972ff
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 4 files reviewed, 2 unresolved discussions (waiting on @ArniStarkware and @elintul)
crates/gateway/src/starknet_api_utils.rs
line 57 at r4 (raw file):
impl TransactionParametersExt for Transaction { fn max_fee(&self) -> StarknetApiTransactionResult<Fee> {
I think it is getting too complicated with macros and many trait extensions.
Consider the following:
let resource_bounds = match self {
StarknetApiTransaction::Declare(
starknet_api::transaction::DeclareTransaction::V0(_)
| starknet_api::transaction::DeclareTransaction::V1(_)
| starknet_api::transaction::DeclareTransaction::V2(_),
) => unimplemented!(),
Transaction::Declare(DeclareTransaction::V3(tx)) => tx.resource_bounds,
...
}
... compute max_fee from resource_bounds ...
Ok(max_fee)
c7884cd
to
a865f4d
Compare
f7972ff
to
e6ae424
Compare
a865f4d
to
60b6092
Compare
e6ae424
to
b2dcffd
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 4 files reviewed, 2 unresolved discussions (waiting on @dafnamatsry and @elintul)
crates/gateway/src/starknet_api_utils.rs
line 57 at r4 (raw file):
Previously, dafnamatsry wrote…
I think it is getting too complicated with macros and many trait extensions.
Consider the following:
let resource_bounds = match self { StarknetApiTransaction::Declare( starknet_api::transaction::DeclareTransaction::V0(_) | starknet_api::transaction::DeclareTransaction::V1(_) | starknet_api::transaction::DeclareTransaction::V2(_), ) => unimplemented!(), Transaction::Declare(DeclareTransaction::V3(tx)) => tx.resource_bounds, ... } ... compute max_fee from resource_bounds ... Ok(max_fee)
I reordered the PRs.
(This PR sitis on top of #15 now).
Now, the macro infrastructure is cleaner, smaller and clearer.
replaced with: #29 |
This change is