Skip to content

Commit

Permalink
review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
aarshkshah1992 committed Oct 25, 2023
1 parent c3c2d87 commit 3b3b87f
Show file tree
Hide file tree
Showing 22 changed files with 91 additions and 114 deletions.
2 changes: 1 addition & 1 deletion test_vm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl TestVM {

TestVM {
primitives: FakePrimitives {},
store: store,
store,
state_root: RefCell::new(actors.flush().unwrap()),
circulating_supply: RefCell::new(TokenAmount::zero()),
actors_dirty: RefCell::new(false),
Expand Down
3 changes: 1 addition & 2 deletions test_vm/tests/suite/authenticate_message_test.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
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 = Rc::new(MemoryBlockstore::new());
let store = MemoryBlockstore::new();
let v = TestVM::new_with_singletons(store);
account_authenticate_message_test(&v);
}
3 changes: 1 addition & 2 deletions test_vm/tests/suite/batch_onboarding.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use fil_actors_integration_tests::tests::batch_onboarding_test;
use fil_actors_runtime::test_blockstores::MemoryBlockstore;
use std::rc::Rc;
use test_case::test_case;
use test_vm::TestVM;

Expand All @@ -9,7 +8,7 @@ use test_vm::TestVM;
#[test_case(true; "v2")]
fn batch_onboarding(v2: bool) {
let store = MemoryBlockstore::new();
let v = TestVM::new_with_singletons(Rc::new(store));
let v = TestVM::new_with_singletons(store);

batch_onboarding_test(&v, v2);
}
3 changes: 1 addition & 2 deletions test_vm/tests/suite/batch_onboarding_deals_test.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
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(Rc::new(store));
let v = TestVM::new_with_singletons(store);
batch_onboarding_deals_test(&v);
}
7 changes: 3 additions & 4 deletions test_vm/tests/suite/change_beneficiary_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,25 @@ use fil_actors_integration_tests::tests::{
change_beneficiary_success_test,
};
use fil_actors_runtime::test_blockstores::MemoryBlockstore;
use std::rc::Rc;
use test_vm::TestVM;

#[test]
fn change_beneficiary_success() {
let store = MemoryBlockstore::new();
let v = TestVM::new_with_singletons(Rc::new(store));
let v = TestVM::new_with_singletons(store);
change_beneficiary_success_test(&v);
}

#[test]
fn change_beneficiary_back_owner_success() {
let store = MemoryBlockstore::new();
let v = TestVM::new_with_singletons(Rc::new(store));
let v = TestVM::new_with_singletons(store);
change_beneficiary_back_owner_success_test(&v);
}

#[test]
fn change_beneficiary_fail() {
let store = MemoryBlockstore::new();
let v = TestVM::new_with_singletons(Rc::new(store));
let v = TestVM::new_with_singletons(store);
change_beneficiary_fail_test(&v);
}
7 changes: 3 additions & 4 deletions test_vm/tests/suite/change_owner_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,25 @@ use fil_actors_integration_tests::tests::{
change_owner_fail_test, change_owner_success_test, keep_beneficiary_when_owner_changed_test,
};
use fil_actors_runtime::test_blockstores::MemoryBlockstore;
use std::rc::Rc;
use test_vm::TestVM;

#[test]
fn change_owner_success() {
let store = MemoryBlockstore::new();
let v = TestVM::new_with_singletons(Rc::new(store));
let v = TestVM::new_with_singletons(store);
change_owner_success_test(&v);
}

#[test]
fn keep_beneficiary_when_owner_changed() {
let store = MemoryBlockstore::new();
let v = TestVM::new_with_singletons(Rc::new(store));
let v = TestVM::new_with_singletons(store);
keep_beneficiary_when_owner_changed_test(&v);
}

#[test]
fn change_owner_fail() {
let store = MemoryBlockstore::new();
let v = TestVM::new_with_singletons(Rc::new(store));
let v = TestVM::new_with_singletons(store);
change_owner_fail_test(&v);
}
18 changes: 8 additions & 10 deletions test_vm/tests/suite/commit_post_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,61 +5,59 @@ use fil_actors_integration_tests::tests::{
submit_post_succeeds_test,
};
use fil_actors_runtime::test_blockstores::MemoryBlockstore;
use std::rc::Rc;
use test_vm::TestVM;

#[test]
fn submit_post_succeeds() {
let store = MemoryBlockstore::new();
let v = TestVM::new_with_singletons(Rc::new(store));
let v = TestVM::new_with_singletons(store);
submit_post_succeeds_test(&v);
}

#[test]
fn skip_sector() {
let store = MemoryBlockstore::new();
let v = TestVM::new_with_singletons(Rc::new(store));
let v = TestVM::new_with_singletons(store);
skip_sector_test(&v);
}

#[test]
fn missed_first_post_deadline() {
let store = MemoryBlockstore::new();
let v = TestVM::new_with_singletons(Rc::new(store));
let v = TestVM::new_with_singletons(store);
missed_first_post_deadline_test(&v);
}

#[test]
fn overdue_precommit() {
let store = MemoryBlockstore::new();
let v = TestVM::new_with_singletons(Rc::new(store));
let v = TestVM::new_with_singletons(store);
overdue_precommit_test(&v);
}

#[test]
fn aggregate_bad_sector_number() {
let store = MemoryBlockstore::new();
let v = TestVM::new_with_singletons(Rc::new(store));
let v = TestVM::new_with_singletons(store);
aggregate_bad_sector_number_test(&v);
}

#[test]
fn aggregate_size_limits() {
let store = MemoryBlockstore::new();
let v = TestVM::new_with_singletons(Rc::new(store));
let v = TestVM::new_with_singletons(store);
aggregate_size_limits_test(&v);
}

#[test]
fn aggregate_bad_sender() {
let store = MemoryBlockstore::new();
let v = TestVM::new_with_singletons(Rc::new(store));
let v = TestVM::new_with_singletons(store);
aggregate_bad_sender_test(&v);
}

#[test]
fn aggregate_one_precommit_expires() {
let store = MemoryBlockstore::new();
let v = TestVM::new_with_singletons(Rc::new(store));
let v = TestVM::new_with_singletons(store);
aggregate_one_precommit_expires_test(&v);
}
5 changes: 2 additions & 3 deletions test_vm/tests/suite/datacap_tests.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
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(Rc::new(store));
let v = TestVM::new_with_singletons(store);
datacap_transfer_test(&v);
}

/* Call name & symbol */
#[test]
fn call_name_symbol() {
let store = MemoryBlockstore::new();
let v = TestVM::new_with_singletons(Rc::new(store));
let v = TestVM::new_with_singletons(store);
call_name_symbol_test(&v);
}
17 changes: 8 additions & 9 deletions test_vm/tests/suite/evm_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,60 +4,59 @@ use fil_actors_integration_tests::tests::{
evm_staticcall_test,
};
use fil_actors_runtime::test_blockstores::MemoryBlockstore;
use std::rc::Rc;
use test_vm::TestVM;

#[test]
fn evm_call() {
let store = MemoryBlockstore::new();
let v = TestVM::new_with_singletons(Rc::new(store));
let v = TestVM::new_with_singletons(store);
evm_call_test(&v);
}

#[test]
fn evm_create() {
let store = MemoryBlockstore::new();
let v = TestVM::new_with_singletons(Rc::new(store));
let v = TestVM::new_with_singletons(store);
evm_create_test(&v);
}

#[test]
fn evm_eth_create_external() {
let store = MemoryBlockstore::new();
let v = TestVM::new_with_singletons(Rc::new(store));
let v = TestVM::new_with_singletons(store);
evm_eth_create_external_test(&v);
}

#[test]
fn evm_empty_initcode() {
let store = MemoryBlockstore::new();
let v = TestVM::new_with_singletons(Rc::new(store));
let v = TestVM::new_with_singletons(store);
evm_empty_initcode_test(&v);
}
#[test]
fn evm_staticcall() {
let store = MemoryBlockstore::new();
let v = TestVM::new_with_singletons(Rc::new(store));
let v = TestVM::new_with_singletons(store);
evm_staticcall_test(&v);
}

#[test]
fn evm_delegatecall() {
let store = MemoryBlockstore::new();
let v = TestVM::new_with_singletons(Rc::new(store));
let v = TestVM::new_with_singletons(store);
evm_delegatecall_test(&v);
}

#[test]
fn evm_staticcall_delegatecall() {
let store = MemoryBlockstore::new();
let v = TestVM::new_with_singletons(Rc::new(store));
let v = TestVM::new_with_singletons(store);
evm_staticcall_delegatecall_test(&v);
}

#[test]
fn evm_init_revert_data() {
let store = MemoryBlockstore::new();
let v = TestVM::new_with_singletons(Rc::new(store));
let v = TestVM::new_with_singletons(store);
evm_init_revert_data_test(&v);
}
11 changes: 5 additions & 6 deletions test_vm/tests/suite/extend_sectors_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,39 @@ use fil_actors_integration_tests::tests::{
extend_sector_up_to_max_relative_extension_test, extend_updated_sector_with_claims_test,
};
use fil_actors_runtime::test_blockstores::MemoryBlockstore;
use std::rc::Rc;
use test_vm::TestVM;

#[test]
fn extend_legacy_sector_with_deals() {
let store = MemoryBlockstore::new();
let v = TestVM::new_with_singletons(Rc::new(store));
let v = TestVM::new_with_singletons(store);
extend_legacy_sector_with_deals_test(&v, false);
}

#[test]
fn extend2_legacy_sector_with_deals() {
let store = MemoryBlockstore::new();
let v = TestVM::new_with_singletons(Rc::new(store));
let v = TestVM::new_with_singletons(store);
extend_legacy_sector_with_deals_test(&v, true);
}

#[test]
fn extend_updated_sector_with_claim() {
let store = MemoryBlockstore::new();
let v = TestVM::new_with_singletons(Rc::new(store));
let v = TestVM::new_with_singletons(store);
extend_updated_sector_with_claims_test(&v);
}

#[test]
fn extend_sector_up_to_max_relative_extension() {
let store = MemoryBlockstore::new();
let v = TestVM::new_with_singletons(Rc::new(store));
let v = TestVM::new_with_singletons(store);
extend_sector_up_to_max_relative_extension_test(&v);
}

#[test]
fn commit_sector_with_max_duration_deal() {
let store = MemoryBlockstore::new();
let v = TestVM::new_with_singletons(Rc::new(store));
let v = TestVM::new_with_singletons(store);
commit_sector_with_max_duration_deal_test(&v);
}
3 changes: 1 addition & 2 deletions test_vm/tests/suite/init_test.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
use fil_actors_integration_tests::tests::placeholder_deploy_test;
use fil_actors_runtime::test_blockstores::MemoryBlockstore;
use std::rc::Rc;
use test_vm::TestVM;

#[test]
fn placeholder_deploy() {
let store = MemoryBlockstore::new();
let v = TestVM::new_with_singletons(Rc::new(store));
let v = TestVM::new_with_singletons(store);

placeholder_deploy_test(&v);
}
Loading

0 comments on commit 3b3b87f

Please sign in to comment.