-
Notifications
You must be signed in to change notification settings - Fork 80
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
Test VM should use Rc<Blockstore> for consistency with the MockRuntime #1454
Merged
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -1,10 +1,11 @@ | ||||||||||
use fil_actors_integration_tests::tests::account_authenticate_message_test; | ||||||||||
use fil_actors_runtime::test_blockstores::MemoryBlockstore; | ||||||||||
use std::rc::Rc; | ||||||||||
use test_vm::TestVM; | ||||||||||
|
||||||||||
#[test] | ||||||||||
fn account_authenticate_message() { | ||||||||||
let store = MemoryBlockstore::new(); | ||||||||||
let v = TestVM::new_with_singletons(&store); | ||||||||||
let store = Rc::new(MemoryBlockstore::new()); | ||||||||||
let v = TestVM::new_with_singletons(store); | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Given the changes to the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed here and elsewhere. |
||||||||||
account_authenticate_message_test(&v); | ||||||||||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
use fil_actors_integration_tests::tests::batch_onboarding_deals_test; | ||
use fil_actors_runtime::test_blockstores::MemoryBlockstore; | ||
use std::rc::Rc; | ||
use test_vm::TestVM; | ||
|
||
#[test] | ||
fn batch_onboarding_deals() { | ||
let store = MemoryBlockstore::new(); | ||
let v = TestVM::new_with_singletons(&store); | ||
let v = TestVM::new_with_singletons(Rc::new(store)); | ||
batch_onboarding_deals_test(&v); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,20 @@ | ||
use fil_actors_integration_tests::tests::{call_name_symbol_test, datacap_transfer_test}; | ||
use fil_actors_runtime::test_blockstores::MemoryBlockstore; | ||
use std::rc::Rc; | ||
use test_vm::TestVM; | ||
|
||
/* Mint a token for client and transfer it to a receiver, exercising error cases */ | ||
#[test] | ||
fn datacap_transfer() { | ||
let store = MemoryBlockstore::new(); | ||
let v = TestVM::new_with_singletons(&store); | ||
let v = TestVM::new_with_singletons(Rc::new(store)); | ||
datacap_transfer_test(&v); | ||
} | ||
|
||
/* Call name & symbol */ | ||
#[test] | ||
fn call_name_symbol() { | ||
let store = MemoryBlockstore::new(); | ||
let v = TestVM::new_with_singletons(&store); | ||
let v = TestVM::new_with_singletons(Rc::new(store)); | ||
call_name_symbol_test(&v); | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I'd consider defining this as
store: impl Into<Rc<MemoryBlockstoire>>
, allowing the user to pass either aMemoryBlockstore
or anRc<MemoryBlockstore>>
. I.e.Same with
TestVM::new
.But let's wait for @anorth to comment on this before continuing.
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.
This would let us call
TestVM::new_with_singletons(store)
without having to explicitly wrap in anRc
.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.
Yes please (for
new
too)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.
Done for both. Great idea !
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.
@Stebalien @anorth Where is the implementation for
defined though in the code ? I also don't see a
anywhere. Does the Rust stdlib have come default impl here to convert a MemoryBlockstore to an Rc ?
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.
First, there's also a blanket implementation of
Into<U> for T where U: From<T>
. That is, you always implementFrom<T> for U
and get an automatic implementation ofInto<U> for T
. Never implementInto
directly. I recommend reading theInto
documentation and theFrom
andInto
section of the book.Additionally, there's a blanket implementation of
From<T> for Rc<T>
.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.
Thanks @Stebalien ! Yeah the blanket implementation of
From<T> for Rc<T>
is what I missing on.