-
Notifications
You must be signed in to change notification settings - Fork 21
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(base_layer): remove unnecessary option + dep #849
Conversation
e57cdb9
to
04a9b92
Compare
5a50f51
to
3428527
Compare
Benchmark movements: |
3428527
to
76027f0
Compare
04a9b92
to
0021b18
Compare
Benchmark movements: |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #849 +/- ##
==========================================
+ Coverage 74.47% 75.39% +0.91%
==========================================
Files 368 368
Lines 38554 39217 +663
Branches 38554 39217 +663
==========================================
+ Hits 28715 29569 +854
+ Misses 7513 7365 -148
+ Partials 2326 2283 -43 ☔ 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 4 files reviewed, 1 unresolved discussion (waiting on @dan-starkware and @elintul)
crates/papyrus_base_layer/src/ethereum_base_layer_contract.rs
line 94 at r1 (raw file):
async fn latest_proved_block( &self, min_confirmations: Option<u64>,
Rename ok?
Also since most usages will likely require finality
(?) I suggest adding a separate latest_proved_block_no_finality
and keep finality non-optional here, WDYT?
Suggestion:
async fn latest_proved_block(
&self,
finality: Option<u64>,
76027f0
to
e0d9b76
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 4 files at r1, 2 of 2 files at r2, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @dan-starkware and @giladchase)
crates/papyrus_base_layer/src/ethereum_base_layer_contract.rs
line 94 at r1 (raw file):
Previously, giladchase wrote…
Rename ok?
Also since most usages will likely require
finality
(?) I suggest adding a separatelatest_proved_block_no_finality
and keep finality non-optional here, WDYT?
Rename's good; not sure I understand the following suggestion.
crates/papyrus_base_layer/src/ethereum_base_layer_contract.rs
line 84 at r2 (raw file):
// The solidity contract was pre-compiled, and only the relevant functions were kept. let abi = serde_json::from_str(include_str!("core_contract_latest_block.abi"))?;
How come neither annotation nor turbofish is needed? 😬
35a0d49
to
c063d27
Compare
e368c6b
to
db2ea78
Compare
Benchmark movements: |
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 r3, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @dan-starkware and @giladchase)
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 @elintul)
crates/papyrus_base_layer/src/ethereum_base_layer_contract.rs
line 94 at r1 (raw file):
Previously, elintul (Elin) wrote…
Rename's good; not sure I understand the following suggestion.
i'm wondering if Option
is faithfully representing common usage.
If vast majority of use cases need finality, then it is misleading and unnecessarily cumbersome, and we can just do fn latest_proved_block(&self, finality: u64)
, and add an additional function for the few edge cases that need 0 finality:
fn latest_proved_block_no_finality(&self) {
let finality = 0;
self.latest_proved_block(finality)
}
crates/papyrus_base_layer/src/ethereum_base_layer_contract.rs
line 84 at r2 (raw file):
Previously, elintul (Elin) wrote…
How come neither annotation nor turbofish is needed? 😬
So two things, first of all adding both is unnecessary, only one of them suffices when type can't be inferred.
However (and that is the second thing) here type can be inferred, from the type of the field in ContractInstance
.
I went back and forth on this one for a bit, but since I need a whole new dependency (alloy-json-abi
) just for this annotation, I felt that going without annotation is worth it.
c063d27
to
7be89e7
Compare
db2ea78
to
82cf061
Compare
Benchmark movements: |
7be89e7
to
e8546e9
Compare
82cf061
to
01673e9
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 r4, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @dan-starkware and @giladchase)
crates/papyrus_base_layer/src/ethereum_base_layer_contract.rs
line 94 at r1 (raw file):
Previously, giladchase wrote…
i'm wondering if
Option
is faithfully representing common usage.If vast majority of use cases need finality, then it is misleading and unnecessarily cumbersome, and we can just do
fn latest_proved_block(&self, finality: u64)
, and add an additional function for the few edge cases that need 0 finality:fn latest_proved_block_no_finality(&self) { let finality = 0; self.latest_proved_block(finality) }
I think 0
can represent no finality, no reason for None
; unless I'm missing something.
01673e9
to
9710837
Compare
Benchmark movements: |
commit-id:19ed8b4a
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: 2 of 4 files reviewed, 1 unresolved discussion (waiting on @dan-starkware and @elintul)
crates/papyrus_base_layer/src/ethereum_base_layer_contract.rs
line 94 at r1 (raw file):
Previously, elintul (Elin) wrote…
I think
0
can represent no finality, no reason forNone
; unless I'm missing something.
yr right, added at the top of the stack, diff is big'ish
9710837
to
f0ce810
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 2 files at r5, 1 of 1 files at r6, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @dan-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.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @dan-starkware and @giladchase)
crates/papyrus_base_layer/src/ethereum_base_layer_contract.rs
line 97 at r6 (raw file):
async fn latest_proved_block( &self, finality: Option<u64>,
Planning to remove Option
?
Code quote:
finality: Option<u64>,
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: complete! all files reviewed, all discussions resolved (waiting on @dan-starkware)
crates/papyrus_base_layer/src/ethereum_base_layer_contract.rs
line 97 at r6 (raw file):
Previously, elintul (Elin) wrote…
Planning to remove
Option
?
Done at the end of the stack, diff is too distinct
commit-id:19ed8b4a
Stack:
This change is