-
Notifications
You must be signed in to change notification settings - Fork 83
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 test_vm::utils in terms of an abstract VM trait #1269
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #1269 +/- ##
==========================================
- Coverage 90.88% 90.68% -0.20%
==========================================
Files 133 133
Lines 26755 26880 +125
==========================================
+ Hits 24316 24377 +61
- Misses 2439 2503 +64
|
impl<'bs, BS> VM<BS> for TestVM<'bs, BS> | ||
where | ||
BS: Blockstore, |
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.
Eventually will move TestVM
to a separate submodule, but I've left it in this file so the diff is clear
) -> Result<MessageResult, TestVMError>; | ||
|
||
/// Sets the epoch to the specified value | ||
fn set_epoch(&self, epoch: ChainEpoch); |
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 replaces with_epoch
. However, all usages of with_epoch
in the current tests were
let v = v.with_epoch(200);
so the non-mutability/cloneability wasn't being used
Next step of #1236
Moves enough of the functionality of the current
TestVM
into theVM
trait such that the all the utils can be factored in terms of the trait.Some functionality has shifted to immutable patterns (e.g.
with_epoch
->set_epoch
). The trait assumes non-mutable borrows so mutability is achieved withRefCell
when needed. The tests will be refactored in terms of the trait in a followup PR.There's some duplication at the moment between concrete behaviour of
TestVM
and behaviours in theVM
trait but these will be easier to remove in a follow-up (when the tests themselves are refactored in terms of the VM trait