Skip to content
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

dev: refactor KakarotTestEnvironmentContext.seqeuncer() method to return the Arc<KatanaSeqeuncer> #576

Closed
wants to merge 1 commit into from

Conversation

bajpai244
Copy link
Contributor

@bajpai244 bajpai244 commented Sep 18, 2023

Resolves: #531

Pull Request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Build-related changes
  • Documentation content changes
  • Testing

What is the new behavior?

The KakarotTestEnvironmentContext.seqeuncer() method returns Arc<KatanaSeqeuncer> which helps solve the current code smell of KakarotTestEnvironmentContext.seqeuncer().seqeuncer, we can now just use KakarotTestEnvironmentContext.seqeuncer().

A getter for seqeuncer url has also been added to theKakarotTestEnironmentContext + also fixes some doc issues.

Does this introduce a breaking change?

  • Yes
  • No

@bajpai244 bajpai244 changed the title dev: refactor KakarotTestEnvironmentContext.seqeuncer() method to return the &Arc<KatanaSeqeuncer> dev: refactor KakarotTestEnvironmentContext.seqeuncer() method to return the Arc<KatanaSeqeuncer> Sep 18, 2023
@bajpai244 bajpai244 force-pushed the dev/#531 branch 2 times, most recently from ffd9edb to 9736b2c Compare September 18, 2023 10:49
@codecov
Copy link

codecov bot commented Sep 18, 2023

Codecov Report

Patch coverage: 83.58% and project coverage change: +49.69% 🎉

Comparison is base (71506a8) 23.17% compared to head (c6e8ae8) 72.87%.
Report is 230 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main     #576       +/-   ##
===========================================
+ Coverage   23.17%   72.87%   +49.69%     
===========================================
  Files           9       45       +36     
  Lines        1247     4169     +2922     
===========================================
+ Hits          289     3038     +2749     
- Misses        958     1131      +173     
Files Changed Coverage Δ
crates/core/src/mock/serde.rs 0.00% <0.00%> (ø)
crates/core/src/models/transaction.rs 89.51% <ø> (ø)
crates/core/src/models/transaction_receipt.rs 97.02% <ø> (ø)
crates/eth-rpc/src/api/alchemy_api.rs 100.00% <ø> (ø)
crates/eth-rpc/src/api/eth_api.rs 100.00% <ø> (ø)
crates/eth-rpc/src/api/net_api.rs 100.00% <ø> (ø)
crates/eth-rpc/src/api/web3_api.rs 100.00% <ø> (ø)
crates/eth-rpc/src/config.rs 100.00% <ø> (ø)
crates/eth-rpc/src/lib.rs 93.33% <ø> (ø)
crates/eth-rpc/src/main.rs 0.00% <ø> (ø)
... and 35 more

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines 29 to +31
let sequencer = test_context.sequencer();
let dump_state = sequencer
.sequencer
.backend
.state
.blocking_write()
.dump_state()
.expect("Failed to call dump_state on Katana state");
let dump_state =
sequencer.backend.state.blocking_write().dump_state().expect("Failed to call dump_state on Katana state");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we can do

let dump_state=test_context.sequencer().backend.state.blocking_write().dump_state().expect("Failed to call dump_state on Katana state");

self.sequencer.sequencer.clone()
}

pub fn url(&self) -> Url {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pub fn url(&self) -> Url {
pub fn sequencer_url(&self) -> Url {

pub fn sequencer(&self) -> &TestSequencer {
&self.sequencer
pub fn sequencer(&self) -> Arc<KatanaSequencer> {
self.sequencer.sequencer.clone()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have this pr to remove blocking, not sure if that might affect this

@Eikix
Copy link
Member

Eikix commented Nov 8, 2023

Closing this for now as we're deeply refactoring the codebase

@Eikix Eikix closed this Nov 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

dev: code smells
3 participants