-
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(fee): tx_args holds valid resource bounds #508
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @nimrod-starkware and the rest of your teammates on Graphite |
3f4a277
to
d772755
Compare
fdb5979
to
181dc7a
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 10 files reviewed, 5 unresolved discussions (waiting on @dorimedini-starkware and @TzahiTaub)
crates/blockifier/src/test_utils/declare.rs
line 111 at r1 (raw file):
signature: declare_tx_args.signature, sender_address: declare_tx_args.sender_address, resource_bounds: declare_tx_args.resource_bounds.0.try_into().expect("todo"),
will be handled in an upper branch
Code quote:
0.try_into().expect("todo")
crates/blockifier/src/test_utils/deploy_account.rs
line 99 at r1 (raw file):
starknet_api::transaction::DeployAccountTransaction::V3(DeployAccountTransactionV3 { signature: deploy_tx_args.signature, resource_bounds: deploy_tx_args.resource_bounds.0.try_into().expect("todo"),
ditto
Code quote:
.0.try_into().expect("todo"),
crates/blockifier/src/test_utils/invoke.rs
line 99 at r1 (raw file):
} else if invoke_args.version == TransactionVersion::THREE { starknet_api::transaction::InvokeTransaction::V3(InvokeTransactionV3 { resource_bounds: invoke_args.resource_bounds.0.try_into().expect("todo"),
ditto
Code quote:
s.0.try_into().expect("todo")
crates/papyrus_common/src/transaction_hash.rs
line 226 at r1 (raw file):
) -> Result<Felt, StarknetApiError> { let (l1_resource_bounds, l2_resource_bounds) = match resource_bounds { ValidResourceBounds::L1Gas(l1_gas_bounds) => (l1_gas_bounds, &ResourceBounds::default()),
WDYT?
Assuming l2_gas previously was always zero.
Code quote:
&ResourceBounds::default())
crates/starknet_api/src/transaction_hash.rs
line 181 at r1 (raw file):
) -> Result<Felt, StarknetApiError> { let (l1_resource_bounds, l2_resource_bounds) = match resource_bounds { ValidResourceBounds::L1Gas(l1_gas_bounds) => (l1_gas_bounds, &ResourceBounds::default()),
ditto
Code quote:
ResourceBounds::default()
d772755
to
5c10c7b
Compare
181dc7a
to
a859ccb
Compare
5c10c7b
to
cbb4e6a
Compare
a859ccb
to
8d05eef
Compare
cbb4e6a
to
c9aa976
Compare
8d05eef
to
985744e
Compare
c9aa976
to
ad9d50c
Compare
0b8e76a
to
22cb18b
Compare
ad9d50c
to
72bc281
Compare
22cb18b
to
fcf41bf
Compare
72bc281
to
cdb9892
Compare
fcf41bf
to
3d745d1
Compare
cdb9892
to
0397362
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: all files reviewed, 7 unresolved discussions (waiting on @dorimedini-starkware, @nimrod-starkware, and @TzahiTaub)
crates/papyrus_protobuf/src/converters/transaction.rs
line 577 at r23 (raw file):
Previously, nimrod-starkware wrote…
I spoke with Shahak about it, and he said that's what he and Ariel agreed on.
Yes. @dorimedini-starkware the reason it's ok here is that this is a transaction inside a block, and the gateway would've rejected it if l2_gas=0 but l1_data_gas is present
crates/papyrus_protobuf/src/converters/transaction.rs
line 582 at r25 (raw file):
} impl TryFrom<protobuf::ResourceLimits> for ResourceBounds {
Unrelated to your PR: ResourceBounds is very confusing. Can we rename it?
crates/papyrus_protobuf/src/proto/p2p/proto/transaction.proto
line 13 at r24 (raw file):
Previously, dorimedini-starkware wrote…
what's this...? @ShahakShama any BC issues may arise from this addition?
No, because it's appended to the list of fields. If we would've added it before l2_gas then BC issues would've happened
crates/papyrus_rpc/src/v0_6/transaction.rs
line 172 at r3 (raw file):
Previously, nimrod-starkware wrote…
WDYM?
Should I panic in the case ofValidResourceBounds::AllResources(_)
?
No, you should just convert the l1_gas and l2_gas to the output struct and not use the l1_data_gas
This code is called when the user asks: "Give me all the txs of block 1,000,000". If in block 1,000,000 we have a "new style" transaction then we don't want to panic, we'll just give the data that we know how to give and drop the data we don't know how to. That was what the l2_gas A/C preparation was for, right?
In summary, just remove the TODO
crates/papyrus_rpc/src/v0_7/transaction.rs
line 190 at r25 (raw file):
Self { l1_gas, l2_gas: ResourceBounds::default() } } // TODO(Nimrod): Don't allow this conversion.
Same as before, remove this TODO
crates/starknet_api/src/transaction.rs
line 990 at r3 (raw file):
Previously, dorimedini-starkware wrote…
backwards compatibility
I think you can derive Serialize with serde(untagged) and the result will be the same. Only in deserialization you are doing something unique
crates/starknet_api/src/transaction.rs
line 1001 at r22 (raw file):
Previously, nimrod-starkware wrote…
Your suggestion won't work..
It will always deserialize to theAllResources
variant...
We need to check somewhere that l2 gas is zero in the first variant
That's why I suggested adding serde(deny_unknown_fields). This way it will distinguish between the two by looking if the l1_data_gas field is present. Is that good enough or do you prefer distinguishing through l2_gas being zero specifically?
crates/starknet_client/src/reader/objects/transaction.rs
line at r3 (raw file):
Previously, dorimedini-starkware wrote…
yes
Approved
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: all files reviewed, 6 unresolved discussions (waiting on @nimrod-starkware and @TzahiTaub)
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: all files reviewed, 6 unresolved discussions (waiting on @dorimedini-starkware, @ShahakShama, and @TzahiTaub)
crates/papyrus_protobuf/src/converters/transaction.rs
line 582 at r25 (raw file):
Previously, ShahakShama wrote…
Unrelated to your PR: ResourceBounds is very confusing. Can we rename it?
Added a TODO to consider renaming it
crates/papyrus_rpc/src/v0_6/transaction.rs
line 172 at r3 (raw file):
Previously, ShahakShama wrote…
No, you should just convert the l1_gas and l2_gas to the output struct and not use the l1_data_gas
This code is called when the user asks: "Give me all the txs of block 1,000,000". If in block 1,000,000 we have a "new style" transaction then we don't want to panic, we'll just give the data that we know how to give and drop the data we don't know how to. That was what the l2_gas A/C preparation was for, right?In summary, just remove the TODO
Done.
crates/papyrus_rpc/src/v0_7/transaction.rs
line 190 at r25 (raw file):
Previously, ShahakShama wrote…
Same as before, remove this TODO
Done.
crates/starknet_api/src/transaction.rs
line 990 at r3 (raw file):
Previously, ShahakShama wrote…
I think you can derive Serialize with serde(untagged) and the result will be the same. Only in deserialization you are doing something unique
let's do it in a separate PR, i added a TODO
crates/starknet_api/src/transaction.rs
line 1001 at r22 (raw file):
Previously, ShahakShama wrote…
That's why I suggested adding serde(deny_unknown_fields). This way it will distinguish between the two by looking if the l1_data_gas field is present. Is that good enough or do you prefer distinguishing through l2_gas being zero specifically?
Will do it in a separate PR (added a TODO)
78c8a82
to
f6d0bb9
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 3 files at r26, all commit messages.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @nimrod-starkware, @ShahakShama, and @TzahiTaub)
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: all files reviewed, 2 unresolved discussions (waiting on @dorimedini-starkware, @nimrod-starkware, and @TzahiTaub)
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: all files reviewed, 3 unresolved discussions (waiting on @dorimedini-starkware, @nimrod-starkware, and @TzahiTaub)
crates/papyrus_protobuf/src/converters/transaction.rs
line 567 at r26 (raw file):
}; let Some(l1_data_gas) = value.l1_data_gas else { return Err(ProtobufConversionError::MissingField {
Don't return an error here. Use unwrap_or_default and add a TODO to assert this is not None once we remove support for 0.13.2
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: all files reviewed, 3 unresolved discussions (waiting on @dorimedini-starkware, @ShahakShama, and @TzahiTaub)
crates/papyrus_protobuf/src/converters/transaction.rs
line 567 at r26 (raw file):
Previously, ShahakShama wrote…
Don't return an error here. Use unwrap_or_default and add a TODO to assert this is not None once we remove support for 0.13.2
Done.
f6d0bb9
to
daec58f
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: 42 of 44 files reviewed, 3 unresolved discussions (waiting on @dorimedini-starkware, @ShahakShama, and @TzahiTaub)
crates/papyrus_protobuf/src/converters/transaction.rs
line 567 at r26 (raw file):
Previously, nimrod-starkware wrote…
Done.
Added your name to the TODO if that's ok :)
daec58f
to
2307ff1
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 2 files at r27.
Reviewable status: 42 of 44 files reviewed, 2 unresolved discussions (waiting on @dorimedini-starkware, @nimrod-starkware, and @TzahiTaub)
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: 42 of 44 files reviewed, 2 unresolved discussions (waiting on @dorimedini-starkware, @nimrod-starkware, and @TzahiTaub)
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: 42 of 44 files reviewed, 1 unresolved discussion (waiting on @dorimedini-starkware and @TzahiTaub)
crates/papyrus_protobuf/src/converters/transaction.rs
line 652 at r11 (raw file):
Previously, ShahakShama wrote…
Yes, but you need to add the new fields at the end of the message so that it can work with nodes that didn't do this upgrade (Juno/Pathfinder)
Done.
2307ff1
to
6be435e
Compare
6be435e
to
5477cc6
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.
Dismissed @dorimedini-starkware from a discussion.
Reviewable status: 42 of 44 files reviewed, all discussions resolved (waiting on @dorimedini-starkware and @TzahiTaub)
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 1 files at r28, all commit messages.
Reviewable status: 43 of 44 files reviewed, all discussions resolved (waiting on @dorimedini-starkware)
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 2 files at r27.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @nimrod-starkware)
Merge activity
|
This change is