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

replace concrete blockstore in TestVM with a generic trait #1259

Merged
merged 2 commits into from
Mar 28, 2023

Conversation

alexytsu
Copy link
Contributor

Further groundwork for an abstract VM trait. Especially in the context of benchmarking it may be useful to inject TrackingBlockstores etc. in future.

The current TestVM could not implement a method that returns a BS: Blockstore which would be required by a generic VM<BS: Blockstore> trait.

@alexytsu alexytsu enabled auto-merge (squash) March 27, 2023 03:05
@alexytsu alexytsu requested review from anorth and removed request for anorth March 27, 2023 03:05
@alexytsu alexytsu requested a review from anorth March 27, 2023 04:54
auto-merge was automatically disabled March 27, 2023 20:58

Merge queue setting changed

Copy link
Member

@anorth anorth left a comment

Choose a reason for hiding this comment

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

Thanks.

FYI see discussion in #133 and filecoin-project/ref-fvm#1694 about whether the blockstore should instead by a dyn reference rather than generic parameter, and possible changes to its API. I think that because it's currently not object-safe that it's not an option for this PR for the TestVM to hold a blockstore reference, but if it were possible or becomes so, I think that would be better.

FYI @Stebalien

where
BS: Blockstore,
{
pub store: &'bs BS,
pub state_root: RefCell<Cid>,
Copy link
Member

Choose a reason for hiding this comment

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

In a follow-up, these should probably both become non-pub if they're to be abstracted over by trait.

where
BS: Blockstore,
{
pub fn new(store: &'bs MemoryBlockstore) -> TestVM<'bs, MemoryBlockstore> {
Copy link
Member

@anorth anorth Mar 27, 2023

Choose a reason for hiding this comment

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

Is it possible/easy to make this store parameter a BS while you're here?

@alexytsu
Copy link
Contributor Author

I think that because it's currently not object-safe that it's not an option for this PR for the TestVM to hold a blockstore reference

Yeh that was the motivation to make this change here. I would have preferred the ability to use something like filecoin-project/ref-fvm#1694 and a dyn Blockstore upon initial consideration.

@alexytsu alexytsu added this pull request to the merge queue Mar 28, 2023
Merged via the queue into master with commit 424669b Mar 28, 2023
@alexytsu alexytsu deleted the alex/1236-test-vm-bs branch March 28, 2023 02:10
alexytsu added a commit that referenced this pull request Mar 28, 2023
@alexytsu
Copy link
Contributor Author

#1236

@alexytsu alexytsu restored the alex/1236-test-vm-bs branch March 28, 2023 07:25
@alexytsu alexytsu deleted the alex/1236-test-vm-bs branch April 4, 2023 02:21
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.

2 participants