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

Remove generics from test VM #1446

Merged
merged 10 commits into from
Oct 19, 2023

Conversation

aarshkshah1992
Copy link
Contributor

@aarshkshah1992 aarshkshah1992 commented Oct 13, 2023

Remove generics from test VM.

Part 4 of #1442.

pub primitives: FakePrimitives,
pub store: &'bs BS,
pub store: &'bs TrackingMemBlockstore,
Copy link
Member

Choose a reason for hiding this comment

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

The MockVM uses an Rc<> vs TestVM using an & 'bs. Probably one of these patterns is better than the other. The Rc<> is flexible and removes some lifetime specifier noise from the code. Maybe we should do that here too? @Stebalien wdyt?

Copy link
Member

Choose a reason for hiding this comment

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

Rc is generally fine, especially because the Blockstore trait is implemented for Rc<impl Blockstore> (so there's no need to manually call .borrow() everywhere.

And dropping the lifetime would also be nice.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, wait. I'm confusing RefCell and Rc. Yeah, there's no reason not to use Rc<TestBlockstore>.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I went down this path but ended up running into some really weird Rust compiler errors. Are you okay doing this in a follow up PR ?

For now, I'd like to focus on and resolve #1445 (comment). Please can you leave your thoughts there ?

Copy link
Member

Choose a reason for hiding this comment

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

I'm fine doing it in a followup, yes.

@aarshkshah1992 aarshkshah1992 changed the base branch from feat/remove-mocktime-generic-blockstore to master October 19, 2023 06:06
@codecov-commenter
Copy link

codecov-commenter commented Oct 19, 2023

Codecov Report

Merging #1446 (28355ca) into master (6c88f13) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1446   +/-   ##
=======================================
  Coverage   91.15%   91.15%           
=======================================
  Files         146      146           
  Lines       27950    27951    +1     
=======================================
+ Hits        25478    25479    +1     
  Misses       2472     2472           
Files Coverage Δ
test_vm/src/lib.rs 96.07% <100.00%> (+0.01%) ⬆️
test_vm/src/messaging.rs 75.38% <100.00%> (ø)

... and 2 files with indirect coverage changes

@aarshkshah1992 aarshkshah1992 added this pull request to the merge queue Oct 19, 2023
Merged via the queue into master with commit c4cdd4a Oct 19, 2023
13 checks passed
@aarshkshah1992 aarshkshah1992 deleted the feat/remove-testvm-generic-blockstore branch October 19, 2023 10:36
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.

4 participants