From 3b3b87f8791f0ab426ec0b56e548670b182bd82f Mon Sep 17 00:00:00 2001 From: Aarsh Shah Date: Wed, 25 Oct 2023 17:23:53 +0400 Subject: [PATCH] review changes --- test_vm/src/lib.rs | 2 +- .../tests/suite/authenticate_message_test.rs | 3 +- test_vm/tests/suite/batch_onboarding.rs | 3 +- .../suite/batch_onboarding_deals_test.rs | 3 +- .../tests/suite/change_beneficiary_test.rs | 7 ++-- test_vm/tests/suite/change_owner_test.rs | 7 ++-- test_vm/tests/suite/commit_post_test.rs | 18 +++++----- test_vm/tests/suite/datacap_tests.rs | 5 ++- test_vm/tests/suite/evm_test.rs | 17 +++++----- test_vm/tests/suite/extend_sectors_test.rs | 11 +++--- test_vm/tests/suite/init_test.rs | 3 +- .../suite/market_miner_withdrawal_test.rs | 16 ++++----- test_vm/tests/suite/move_partitions_test.rs | 3 +- test_vm/tests/suite/multisig_test.rs | 9 +++-- test_vm/tests/suite/power_scenario_tests.rs | 5 ++- test_vm/tests/suite/publish_deals_test.rs | 33 +++++++++--------- test_vm/tests/suite/replica_update_test.rs | 34 +++++++++---------- test_vm/tests/suite/terminate_test.rs | 3 +- test_vm/tests/suite/test_vm_test.rs | 5 ++- test_vm/tests/suite/verified_claim_test.rs | 7 ++-- .../suite/verifreg_remove_datacap_test.rs | 5 ++- test_vm/tests/suite/withdraw_balance_test.rs | 6 ++-- 22 files changed, 91 insertions(+), 114 deletions(-) diff --git a/test_vm/src/lib.rs b/test_vm/src/lib.rs index eb07a2c82..5de2df9aa 100644 --- a/test_vm/src/lib.rs +++ b/test_vm/src/lib.rs @@ -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), diff --git a/test_vm/tests/suite/authenticate_message_test.rs b/test_vm/tests/suite/authenticate_message_test.rs index e359d7283..1d64dd043 100644 --- a/test_vm/tests/suite/authenticate_message_test.rs +++ b/test_vm/tests/suite/authenticate_message_test.rs @@ -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); } diff --git a/test_vm/tests/suite/batch_onboarding.rs b/test_vm/tests/suite/batch_onboarding.rs index b03067604..c374c3846 100644 --- a/test_vm/tests/suite/batch_onboarding.rs +++ b/test_vm/tests/suite/batch_onboarding.rs @@ -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; @@ -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); } diff --git a/test_vm/tests/suite/batch_onboarding_deals_test.rs b/test_vm/tests/suite/batch_onboarding_deals_test.rs index 102cbe0a7..dc6cdd5b0 100644 --- a/test_vm/tests/suite/batch_onboarding_deals_test.rs +++ b/test_vm/tests/suite/batch_onboarding_deals_test.rs @@ -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); } diff --git a/test_vm/tests/suite/change_beneficiary_test.rs b/test_vm/tests/suite/change_beneficiary_test.rs index 724b1e4c8..5fa650e80 100644 --- a/test_vm/tests/suite/change_beneficiary_test.rs +++ b/test_vm/tests/suite/change_beneficiary_test.rs @@ -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); } diff --git a/test_vm/tests/suite/change_owner_test.rs b/test_vm/tests/suite/change_owner_test.rs index 42afe7ae3..7a6269bde 100644 --- a/test_vm/tests/suite/change_owner_test.rs +++ b/test_vm/tests/suite/change_owner_test.rs @@ -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); } diff --git a/test_vm/tests/suite/commit_post_test.rs b/test_vm/tests/suite/commit_post_test.rs index 300209547..7a513bc5f 100644 --- a/test_vm/tests/suite/commit_post_test.rs +++ b/test_vm/tests/suite/commit_post_test.rs @@ -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); } diff --git a/test_vm/tests/suite/datacap_tests.rs b/test_vm/tests/suite/datacap_tests.rs index fe4c1a291..22a196c5b 100644 --- a/test_vm/tests/suite/datacap_tests.rs +++ b/test_vm/tests/suite/datacap_tests.rs @@ -1,13 +1,12 @@ 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); } @@ -15,6 +14,6 @@ fn datacap_transfer() { #[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); } diff --git a/test_vm/tests/suite/evm_test.rs b/test_vm/tests/suite/evm_test.rs index e73b74d4c..b1094fcd2 100644 --- a/test_vm/tests/suite/evm_test.rs +++ b/test_vm/tests/suite/evm_test.rs @@ -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); } diff --git a/test_vm/tests/suite/extend_sectors_test.rs b/test_vm/tests/suite/extend_sectors_test.rs index 1aa2b7a97..f0ba429f1 100644 --- a/test_vm/tests/suite/extend_sectors_test.rs +++ b/test_vm/tests/suite/extend_sectors_test.rs @@ -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); } diff --git a/test_vm/tests/suite/init_test.rs b/test_vm/tests/suite/init_test.rs index ac2d64d12..b8acf6276 100644 --- a/test_vm/tests/suite/init_test.rs +++ b/test_vm/tests/suite/init_test.rs @@ -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); } diff --git a/test_vm/tests/suite/market_miner_withdrawal_test.rs b/test_vm/tests/suite/market_miner_withdrawal_test.rs index 79487706f..f097e22b7 100644 --- a/test_vm/tests/suite/market_miner_withdrawal_test.rs +++ b/test_vm/tests/suite/market_miner_withdrawal_test.rs @@ -2,20 +2,19 @@ mod market_tests { use fil_actors_integration_tests::tests::market_tests::*; use fil_actors_runtime::test_blockstores::MemoryBlockstore; - use std::rc::Rc; use test_vm::TestVM; #[test] fn withdraw_all_funds() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); withdraw_all_funds_test(&v); } #[test] fn withdraw_as_much_as_possible() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); withdraw_as_much_as_possible_test(&v); } @@ -23,7 +22,7 @@ mod market_tests { #[test] fn withdraw_0() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); withdraw_0_test(&v); } } @@ -32,13 +31,12 @@ mod market_tests { mod miner_tests { use fil_actors_integration_tests::tests::miner_tests::*; use fil_actors_runtime::test_blockstores::MemoryBlockstore; - use std::rc::Rc; use test_vm::TestVM; #[test] fn withdraw_all_funds() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); withdraw_all_funds_test(&v); } @@ -46,21 +44,21 @@ mod miner_tests { #[test] fn withdraw_as_much_as_possible() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); withdraw_as_much_as_possible_test(&v); } #[test] fn withdraw_0() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); withdraw_0_test(&v); } #[test] fn withdraw_from_non_owner_address_fails() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); withdraw_from_non_owner_address_fails_test(&v) } } diff --git a/test_vm/tests/suite/move_partitions_test.rs b/test_vm/tests/suite/move_partitions_test.rs index 75a57b02a..23c5d0d8b 100644 --- a/test_vm/tests/suite/move_partitions_test.rs +++ b/test_vm/tests/suite/move_partitions_test.rs @@ -1,11 +1,10 @@ use fil_actors_integration_tests::tests::move_partitions_test; use fil_actors_runtime::test_blockstores::MemoryBlockstore; -use std::rc::Rc; use test_vm::TestVM; #[test] fn move_partitions() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); move_partitions_test(&v); } diff --git a/test_vm/tests/suite/multisig_test.rs b/test_vm/tests/suite/multisig_test.rs index 1d717a125..bac2a249e 100644 --- a/test_vm/tests/suite/multisig_test.rs +++ b/test_vm/tests/suite/multisig_test.rs @@ -2,13 +2,12 @@ use fil_actors_integration_tests::tests::{ proposal_hash_test, swap_self_1_of_2_test, swap_self_2_of_3_test, test_delete_self_inner_test, }; use fil_actors_runtime::test_blockstores::MemoryBlockstore; -use std::rc::Rc; use test_vm::TestVM; #[test] fn proposal_hash() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); proposal_hash_test(&v); } @@ -16,7 +15,7 @@ fn proposal_hash() { fn test_delete_self() { let test = |threshold: usize, signers: u64, remove_idx: usize| { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); test_delete_self_inner_test(&v, signers, threshold, remove_idx); }; test(2, 3, 0); // 2 of 3 removed is proposer @@ -28,13 +27,13 @@ fn test_delete_self() { #[test] fn swap_self_1_of_2() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); swap_self_1_of_2_test(&v); } #[test] fn swap_self_2_of_3() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); swap_self_2_of_3_test(&v); } diff --git a/test_vm/tests/suite/power_scenario_tests.rs b/test_vm/tests/suite/power_scenario_tests.rs index eedfdfba6..fafad17e1 100644 --- a/test_vm/tests/suite/power_scenario_tests.rs +++ b/test_vm/tests/suite/power_scenario_tests.rs @@ -1,12 +1,11 @@ use fil_actors_integration_tests::tests::{cron_tick_test, power_create_miner_test}; use fil_actors_runtime::test_blockstores::MemoryBlockstore; -use std::rc::Rc; use test_vm::TestVM; #[test] fn power_create_miner() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); power_create_miner_test(&v); } @@ -14,7 +13,7 @@ fn power_create_miner() { #[test] fn cron_tick() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); cron_tick_test(&v); } diff --git a/test_vm/tests/suite/publish_deals_test.rs b/test_vm/tests/suite/publish_deals_test.rs index 4809d91c8..23bdc73ff 100644 --- a/test_vm/tests/suite/publish_deals_test.rs +++ b/test_vm/tests/suite/publish_deals_test.rs @@ -8,117 +8,116 @@ use fil_actors_integration_tests::tests::{ psd_valid_deals_with_ones_longer_than_540_test, psd_verified_deal_fails_getting_datacap_test, }; use fil_actors_runtime::test_blockstores::MemoryBlockstore; -use std::rc::Rc; use test_vm::TestVM; #[test] fn psd_mismatched_provider() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); psd_mismatched_provider_test(&v); } #[test] fn psd_bad_piece_size() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); psd_bad_piece_size_test(&v); } #[test] fn psd_start_time_in_past() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); psd_start_time_in_past_test(&v); } #[test] fn psd_client_address_cannot_be_resolved() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); psd_client_address_cannot_be_resolved_test(&v); } #[test] fn psd_no_client_lockup() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); psd_no_client_lockup_test(&v); } #[test] fn psd_not_enough_client_lockup_for_batch() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); psd_not_enough_client_lockup_for_batch_test(&v); } #[test] fn psd_not_enough_provider_lockup_for_batch() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); psd_not_enough_provider_lockup_for_batch_test(&v); } #[test] fn psd_duplicate_deal_in_batch() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); psd_duplicate_deal_in_batch_test(&v); } #[test] fn psd_duplicate_deal_in_state() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); psd_duplicate_deal_in_state_test(&v); } #[test] fn psd_verified_deal_fails_getting_datacap() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); psd_verified_deal_fails_getting_datacap_test(&v); } #[test] fn psd_random_assortment_of_failures() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); psd_random_assortment_of_failures_test(&v); } #[test] fn psd_all_deals_are_bad() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); psd_all_deals_are_bad_test(&v); } #[test] fn psd_bad_sig() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); psd_bad_sig_test(&v); } #[test] fn psd_all_deals_are_good() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); all_deals_are_good_test(&v); } #[test] fn psd_valid_deals_with_ones_longer_than_540() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); psd_valid_deals_with_ones_longer_than_540_test(&v); } #[test] fn psd_deal_duration_too_long() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); psd_deal_duration_too_long_test(&v); } diff --git a/test_vm/tests/suite/replica_update_test.rs b/test_vm/tests/suite/replica_update_test.rs index 513da34f5..b5859c17d 100644 --- a/test_vm/tests/suite/replica_update_test.rs +++ b/test_vm/tests/suite/replica_update_test.rs @@ -23,7 +23,7 @@ use fil_actors_integration_tests::util::assert_invariants; #[test_case(true; "v2")] fn replica_update_simple_path_success(v2: bool) { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); create_miner_and_upgrade_sector(&v, v2); assert_invariants(&v, &Policy::default()); } @@ -33,7 +33,7 @@ fn replica_update_simple_path_success(v2: bool) { #[test_case(true; "v2")] fn replica_update_full_path_success(v2: bool) { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); replica_update_full_path_success_test(&v, v2); } @@ -41,14 +41,14 @@ fn replica_update_full_path_success(v2: bool) { #[test_case(true; "v2")] fn upgrade_and_miss_post(v2: bool) { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); upgrade_and_miss_post_test(&v, v2); } #[test] fn prove_replica_update_multi_dline() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); prove_replica_update_multi_dline_test(&v); } @@ -57,70 +57,70 @@ fn prove_replica_update_multi_dline() { #[test] fn immutable_deadline_failure() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); immutable_deadline_failure_test(&v); } #[test] fn unhealthy_sector_failure() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); unhealthy_sector_failure_test(&v); } #[test] fn terminated_sector_failure() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); terminated_sector_failure_test(&v); } #[test] fn bad_batch_size_failure() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); bad_batch_size_failure_test(&v); } #[test] fn no_dispute_after_upgrade() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); nodispute_after_upgrade_test(&v); } #[test] fn upgrade_bad_post_dispute() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); upgrade_bad_post_dispute_test(&v); } #[test] fn bad_post_upgrade_dispute() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); bad_post_upgrade_dispute_test(&v); } #[test] fn terminate_after_upgrade() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); terminate_after_upgrade_test(&v); } #[test] fn extend_after_upgrade() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); extend_after_upgrade_test(&v); } #[test] fn wrong_deadline_index_failure() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); wrong_deadline_index_failure_test(&v); } @@ -128,7 +128,7 @@ fn wrong_deadline_index_failure() { #[test] fn wrong_partition_index_failure() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); wrong_partition_index_failure_test(&v); } @@ -136,14 +136,14 @@ fn wrong_partition_index_failure() { #[test] fn deal_included_in_multiple_sectors_failure() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); deal_included_in_multiple_sectors_failure_test(&v); } #[test] fn replica_update_verified_deal() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); replica_update_verified_deal_test(&v); } diff --git a/test_vm/tests/suite/terminate_test.rs b/test_vm/tests/suite/terminate_test.rs index 38ff656f2..cfb6ecd9b 100644 --- a/test_vm/tests/suite/terminate_test.rs +++ b/test_vm/tests/suite/terminate_test.rs @@ -1,11 +1,10 @@ use fil_actors_integration_tests::tests::terminate_sectors_test; use fil_actors_runtime::test_blockstores::MemoryBlockstore; -use std::rc::Rc; use test_vm::TestVM; #[test] fn terminate_sectors() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); terminate_sectors_test(&v); } diff --git a/test_vm/tests/suite/test_vm_test.rs b/test_vm/tests/suite/test_vm_test.rs index 72b483ed4..a9e442c54 100644 --- a/test_vm/tests/suite/test_vm_test.rs +++ b/test_vm/tests/suite/test_vm_test.rs @@ -10,7 +10,6 @@ use fvm_shared::econ::TokenAmount; use fvm_shared::error::ExitCode; use fvm_shared::METHOD_SEND; use num_traits::Zero; -use std::rc::Rc; use test_vm::{TestVM, FIRST_TEST_USER_ADDR, TEST_FAUCET_ADDR}; use vm_api::util::{get_state, pk_addrs_from}; use vm_api::{new_actor, VM}; @@ -18,7 +17,7 @@ use vm_api::{new_actor, VM}; #[test] fn state_control() { let store = MemoryBlockstore::new(); - let v = TestVM::new(Rc::new(store)); + let v = TestVM::new(store); let addr1 = Address::new_id(1000); let addr2 = Address::new_id(2222); @@ -74,7 +73,7 @@ fn assert_account_actor( #[test] fn test_sent() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); // send to uninitialized account actor let addr1 = Address::new_bls(&[1; fvm_shared::address::BLS_PUB_LEN]).unwrap(); diff --git a/test_vm/tests/suite/verified_claim_test.rs b/test_vm/tests/suite/verified_claim_test.rs index d623d250c..5e435e8a4 100644 --- a/test_vm/tests/suite/verified_claim_test.rs +++ b/test_vm/tests/suite/verified_claim_test.rs @@ -2,7 +2,6 @@ use fil_actors_integration_tests::tests::{ deal_passes_claim_fails_test, expired_allocations_test, verified_claim_scenario_test, }; use fil_actors_runtime::test_blockstores::MemoryBlockstore; -use std::rc::Rc; use test_vm::TestVM; // Tests a scenario involving a verified deal from the built-in market, with associated @@ -11,20 +10,20 @@ use test_vm::TestVM; #[test] fn verified_claim_scenario() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); verified_claim_scenario_test(&v); } #[test] fn expired_allocations() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); expired_allocations_test(&v); } #[test] fn deal_passes_claim_fails() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); deal_passes_claim_fails_test(&v); } diff --git a/test_vm/tests/suite/verifreg_remove_datacap_test.rs b/test_vm/tests/suite/verifreg_remove_datacap_test.rs index e0f85d22b..c1c26a6b8 100644 --- a/test_vm/tests/suite/verifreg_remove_datacap_test.rs +++ b/test_vm/tests/suite/verifreg_remove_datacap_test.rs @@ -2,19 +2,18 @@ use fil_actors_integration_tests::tests::{ remove_datacap_fails_on_verifreg_test, remove_datacap_simple_successful_path_test, }; use fil_actors_runtime::test_blockstores::MemoryBlockstore; -use std::rc::Rc; use test_vm::TestVM; #[test] fn remove_datacap_simple_successful_path() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); remove_datacap_simple_successful_path_test(&v); } #[test] fn remove_datacap_fails_on_verifreg() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); remove_datacap_fails_on_verifreg_test(&v); } diff --git a/test_vm/tests/suite/withdraw_balance_test.rs b/test_vm/tests/suite/withdraw_balance_test.rs index 578df7d44..2f906509d 100644 --- a/test_vm/tests/suite/withdraw_balance_test.rs +++ b/test_vm/tests/suite/withdraw_balance_test.rs @@ -2,19 +2,17 @@ use fil_actors_integration_tests::tests::{ withdraw_balance_fail_test, withdraw_balance_success_test, }; use fil_actors_runtime::test_blockstores::MemoryBlockstore; -use std::rc::Rc; use test_vm::TestVM; - #[test] fn withdraw_balance_success() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); withdraw_balance_success_test(&v); } #[test] fn withdraw_balance_fail() { let store = MemoryBlockstore::new(); - let v = TestVM::new_with_singletons(Rc::new(store)); + let v = TestVM::new_with_singletons(store); withdraw_balance_fail_test(&v); }