-
Notifications
You must be signed in to change notification settings - Fork 89
feat(network): add conversions from protobuf to transaction outputs #2053
feat(network): add conversions from protobuf to transaction outputs #2053
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2053 +/- ##
==========================================
- Coverage 70.29% 70.14% -0.16%
==========================================
Files 130 130
Lines 17047 17096 +49
Branches 17047 17096 +49
==========================================
+ Hits 11984 11992 +8
- Misses 3726 3765 +39
- Partials 1337 1339 +2 ☔ 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.
Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @asmaastarkware and @dan-starkware)
crates/papyrus_network/src/converters/protobuf_conversion/receipt.rs
line 94 at r1 (raw file):
type Error = ProtobufConversionError; fn try_from(value: protobuf::receipt::Deploy) -> Result<Self, Self::Error> { let common = value
There's a lot of code duplication here. Could you create a helper function that receives a protobuf::receipt::Common and outputs the following with types as they appear in SN API output: actual_fee, messages_sent, contract_address, execution_status, execution_resources?
crates/papyrus_network/src/converters/protobuf_conversion/receipt.rs
line 130 at r1 (raw file):
})?); let execution_status = common.revert_reason.map_or_else(
No need to use map_or_else, you can use map_or since there's no cost here for creating the value and not using it
Same in the other functions
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, 2 unresolved discussions (waiting on @asmaastarkware and @dan-starkware)
crates/papyrus_network/src/converters/protobuf_conversion/receipt.rs
line 94 at r1 (raw file):
Previously, ShahakShama wrote…
There's a lot of code duplication here. Could you create a helper function that receives a protobuf::receipt::Common and outputs the following with types as they appear in SN API output: actual_fee, messages_sent, contract_address, execution_status, execution_resources?
It will also need to receive a string for ProtobufConversionError
7a8f5f8
to
94fe5fc
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, 2 unresolved discussions (waiting on @dan-starkware and @ShahakShama)
crates/papyrus_network/src/converters/protobuf_conversion/receipt.rs
line 94 at r1 (raw file):
Previously, ShahakShama wrote…
It will also need to receive a string for ProtobufConversionError
Done.
crates/papyrus_network/src/converters/protobuf_conversion/receipt.rs
line 130 at r1 (raw file):
Previously, ShahakShama wrote…
No need to use map_or_else, you can use map_or since there's no cost here for creating the value and not using it
Same in the other functions
Done.
94fe5fc
to
8d95021
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 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @asmaastarkware and @dan-starkware)
crates/papyrus_network/src/converters/protobuf_conversion/receipt.rs
line 24 at r2 (raw file):
use crate::protobuf_messages::protobuf::{self}; fn parse_common_receipt_fields(
Put this at the end of the file
8d95021
to
59c20cc
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, 1 unresolved discussion (waiting on @dan-starkware and @ShahakShama)
crates/papyrus_network/src/converters/protobuf_conversion/receipt.rs
line 24 at r2 (raw file):
Previously, ShahakShama wrote…
Put this at the end of the file
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.
Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @dan-starkware)
This change is