From af836ea569da8e61095aac62600b28f46f8dff43 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Thu, 15 Sep 2022 13:14:28 -0700 Subject: [PATCH] feat: use consts for addrs And expose actor IDs so we don't need to call `.id().unwrap()` to retrieve them. --- Cargo.lock | 7 ++ actors/account/src/lib.rs | 2 +- actors/account/tests/account_actor_test.rs | 6 +- actors/cron/src/lib.rs | 4 +- actors/cron/tests/cron_actor_test.rs | 6 +- actors/init/tests/init_actor_test.rs | 8 +- actors/market/src/lib.rs | 4 +- .../market/tests/cron_tick_deal_slashing.rs | 2 +- .../market/tests/cron_tick_timedout_deals.rs | 10 +-- actors/market/tests/harness.rs | 18 ++-- actors/market/tests/market_actor_test.rs | 12 +-- .../tests/random_cron_epoch_during_publish.rs | 2 +- actors/miner/src/lib.rs | 8 +- actors/miner/tests/apply_rewards.rs | 14 ++-- .../tests/miner_actor_test_construction.rs | 16 ++-- actors/miner/tests/util.rs | 84 +++++++++---------- actors/multisig/src/lib.rs | 2 +- actors/multisig/tests/multisig_actor_test.rs | 38 ++++----- actors/multisig/tests/util.rs | 4 +- actors/paych/tests/paych_actor_test.rs | 2 +- actors/power/src/lib.rs | 4 +- actors/power/tests/harness/mod.rs | 16 ++-- actors/power/tests/power_actor_tests.rs | 56 ++++++------- actors/reward/src/lib.rs | 6 +- actors/reward/tests/reward_actor_test.rs | 28 +++---- actors/system/src/lib.rs | 10 +-- actors/verifreg/src/lib.rs | 6 +- actors/verifreg/tests/harness/mod.rs | 21 ++--- actors/verifreg/tests/verifreg_actor_test.rs | 14 ++-- runtime/Cargo.toml | 1 + runtime/src/builtin/singletons.rs | 33 +++++--- runtime/src/lib.rs | 1 + test_vm/src/lib.rs | 52 +++++------- test_vm/src/util.rs | 40 ++++----- test_vm/tests/batch_onboarding.rs | 4 +- test_vm/tests/commit_post_test.rs | 60 ++++++------- test_vm/tests/extend_sectors_test.rs | 14 ++-- test_vm/tests/market_miner_withdrawal_test.rs | 6 +- test_vm/tests/multisig_test.rs | 14 ++-- test_vm/tests/power_scenario_tests.rs | 32 +++---- test_vm/tests/publish_deals_test.rs | 28 +++---- test_vm/tests/replica_update_test.rs | 12 +-- test_vm/tests/terminate_test.rs | 46 +++++----- test_vm/tests/verifreg_remove_datacap_test.rs | 18 ++-- 44 files changed, 390 insertions(+), 381 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fc155d349..56a83c624 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -793,6 +793,7 @@ dependencies = [ "multihash", "num-derive", "num-traits", + "paste", "rand", "regex", "serde", @@ -1440,6 +1441,12 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" +[[package]] +name = "paste" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1de2e551fb905ac83f73f7aedf2f0cb4a0da7e35efa24a202a936269f1f18e1" + [[package]] name = "pin-project-lite" version = "0.2.9" diff --git a/actors/account/src/lib.rs b/actors/account/src/lib.rs index d630c1589..a985084f4 100644 --- a/actors/account/src/lib.rs +++ b/actors/account/src/lib.rs @@ -47,7 +47,7 @@ impl Actor { BS: Blockstore, RT: Runtime, { - rt.validate_immediate_caller_is(std::iter::once(&*SYSTEM_ACTOR_ADDR))?; + rt.validate_immediate_caller_is(std::iter::once(&SYSTEM_ACTOR_ADDR))?; match address.protocol() { Protocol::Secp256k1 | Protocol::BLS => {} protocol => { diff --git a/actors/account/tests/account_actor_test.rs b/actors/account/tests/account_actor_test.rs index c6d5a946a..384613bdf 100644 --- a/actors/account/tests/account_actor_test.rs +++ b/actors/account/tests/account_actor_test.rs @@ -30,7 +30,7 @@ macro_rules! account_constructor_tests { caller_type: SYSTEM_ACTOR_CODE_ID.clone(), ..Default::default() }; - rt.expect_validate_caller_addr(vec![*SYSTEM_ACTOR_ADDR]); + rt.expect_validate_caller_addr(vec![SYSTEM_ACTOR_ADDR]); if exit_code.is_success() { rt.call::(1, &RawBytes::serialize(addr).unwrap()).unwrap(); @@ -82,13 +82,13 @@ account_constructor_tests! { fn authenticate_message() { let mut rt = MockRuntime { receiver: Address::new_id(100), - caller: *SYSTEM_ACTOR_ADDR, + caller: SYSTEM_ACTOR_ADDR, caller_type: *SYSTEM_ACTOR_CODE_ID, ..Default::default() }; let addr = Address::new_secp256k1(&[2; fvm_shared::address::SECP_PUB_LEN]).unwrap(); - rt.expect_validate_caller_addr(vec![*SYSTEM_ACTOR_ADDR]); + rt.expect_validate_caller_addr(vec![SYSTEM_ACTOR_ADDR]); rt.call::(1, &RawBytes::serialize(addr).unwrap()).unwrap(); diff --git a/actors/cron/src/lib.rs b/actors/cron/src/lib.rs index 891a53d0f..217f84b00 100644 --- a/actors/cron/src/lib.rs +++ b/actors/cron/src/lib.rs @@ -47,7 +47,7 @@ impl Actor { BS: Blockstore, RT: Runtime, { - rt.validate_immediate_caller_is(std::iter::once(&*SYSTEM_ACTOR_ADDR))?; + rt.validate_immediate_caller_is(std::iter::once(&SYSTEM_ACTOR_ADDR))?; rt.create(&State { entries: params.entries })?; Ok(()) } @@ -59,7 +59,7 @@ impl Actor { BS: Blockstore, RT: Runtime, { - rt.validate_immediate_caller_is(std::iter::once(&*SYSTEM_ACTOR_ADDR))?; + rt.validate_immediate_caller_is(std::iter::once(&SYSTEM_ACTOR_ADDR))?; let st: State = rt.state()?; for entry in st.entries { diff --git a/actors/cron/tests/cron_actor_test.rs b/actors/cron/tests/cron_actor_test.rs index 4b6201a8f..bc92de96f 100644 --- a/actors/cron/tests/cron_actor_test.rs +++ b/actors/cron/tests/cron_actor_test.rs @@ -19,7 +19,7 @@ fn check_state(rt: &MockRuntime) { fn construct_runtime() -> MockRuntime { MockRuntime { receiver: Address::new_id(100), - caller: *SYSTEM_ACTOR_ADDR, + caller: SYSTEM_ACTOR_ADDR, caller_type: *SYSTEM_ACTOR_CODE_ID, ..Default::default() } @@ -114,14 +114,14 @@ fn epoch_tick_with_entries() { } fn construct_and_verify(rt: &mut MockRuntime, params: &ConstructorParams) { - rt.expect_validate_caller_addr(vec![*SYSTEM_ACTOR_ADDR]); + rt.expect_validate_caller_addr(vec![SYSTEM_ACTOR_ADDR]); let ret = rt.call::(1, &RawBytes::serialize(¶ms).unwrap()).unwrap(); assert_eq!(RawBytes::default(), ret); rt.verify(); } fn epoch_tick_and_verify(rt: &mut MockRuntime) { - rt.expect_validate_caller_addr(vec![*SYSTEM_ACTOR_ADDR]); + rt.expect_validate_caller_addr(vec![SYSTEM_ACTOR_ADDR]); let ret = rt.call::(2, &RawBytes::default()).unwrap(); assert_eq!(RawBytes::default(), ret); rt.verify(); diff --git a/actors/init/tests/init_actor_test.rs b/actors/init/tests/init_actor_test.rs index f3fbbb4ea..b69992209 100644 --- a/actors/init/tests/init_actor_test.rs +++ b/actors/init/tests/init_actor_test.rs @@ -27,7 +27,7 @@ fn check_state(rt: &MockRuntime) { fn construct_runtime() -> MockRuntime { MockRuntime { receiver: Address::new_id(1000), - caller: *SYSTEM_ACTOR_ADDR, + caller: SYSTEM_ACTOR_ADDR, caller_type: *SYSTEM_ACTOR_CODE_ID, ..Default::default() } @@ -163,7 +163,7 @@ fn create_storage_miner() { construct_and_verify(&mut rt); // only the storage power actor can create a miner - rt.set_caller(*POWER_ACTOR_CODE_ID, *STORAGE_POWER_ACTOR_ADDR); + rt.set_caller(*POWER_ACTOR_CODE_ID, STORAGE_POWER_ACTOR_ADDR); let unique_address = Address::new_actor(b"miner"); rt.new_actor_addr = Some(unique_address); @@ -248,7 +248,7 @@ fn sending_constructor_failure() { construct_and_verify(&mut rt); // Only the storage power actor can create a miner - rt.set_caller(*POWER_ACTOR_CODE_ID, *STORAGE_POWER_ACTOR_ADDR); + rt.set_caller(*POWER_ACTOR_CODE_ID, STORAGE_POWER_ACTOR_ADDR); // Assign new address for the storage actor miner let unique_address = Address::new_actor(b"miner"); @@ -288,7 +288,7 @@ fn sending_constructor_failure() { } fn construct_and_verify(rt: &mut MockRuntime) { - rt.expect_validate_caller_addr(vec![*SYSTEM_ACTOR_ADDR]); + rt.expect_validate_caller_addr(vec![SYSTEM_ACTOR_ADDR]); let params = ConstructorParams { network_name: "mock".to_string() }; let ret = rt.call::(METHOD_CONSTRUCTOR, &RawBytes::serialize(¶ms).unwrap()).unwrap(); diff --git a/actors/market/src/lib.rs b/actors/market/src/lib.rs index 472f5219b..45d1edf68 100644 --- a/actors/market/src/lib.rs +++ b/actors/market/src/lib.rs @@ -97,7 +97,7 @@ impl Actor { BS: Blockstore, RT: Runtime, { - rt.validate_immediate_caller_is(std::iter::once(&*SYSTEM_ACTOR_ADDR))?; + rt.validate_immediate_caller_is(std::iter::once(&SYSTEM_ACTOR_ADDR))?; let st = State::new(rt.store()).map_err(|e| { e.downcast_default(ExitCode::USR_ILLEGAL_STATE, "Failed to create market state") @@ -766,7 +766,7 @@ impl Actor { BS: Blockstore, RT: Runtime, { - rt.validate_immediate_caller_is(std::iter::once(&*CRON_ACTOR_ADDR))?; + rt.validate_immediate_caller_is(std::iter::once(&CRON_ACTOR_ADDR))?; let mut amount_slashed = TokenAmount::zero(); let curr_epoch = rt.curr_epoch(); diff --git a/actors/market/tests/cron_tick_deal_slashing.rs b/actors/market/tests/cron_tick_deal_slashing.rs index 83bbaae42..d7ecc3da2 100644 --- a/actors/market/tests/cron_tick_deal_slashing.rs +++ b/actors/market/tests/cron_tick_deal_slashing.rs @@ -238,7 +238,7 @@ fn slash_multiple_deals_in_the_same_epoch() { + &deal_proposal2.provider_collateral + &deal_proposal3.provider_collateral; rt.expect_send( - *BURNT_FUNDS_ACTOR_ADDR, + BURNT_FUNDS_ACTOR_ADDR, METHOD_SEND, RawBytes::default(), total_slashed, diff --git a/actors/market/tests/cron_tick_timedout_deals.rs b/actors/market/tests/cron_tick_timedout_deals.rs index 4bc10d77d..5da65f6d3 100644 --- a/actors/market/tests/cron_tick_timedout_deals.rs +++ b/actors/market/tests/cron_tick_timedout_deals.rs @@ -43,7 +43,7 @@ fn timed_out_deal_is_slashed_and_deleted() { // do a cron tick for it -> should time out and get slashed rt.set_epoch(process_epoch(START_EPOCH, deal_id)); rt.expect_send( - *BURNT_FUNDS_ACTOR_ADDR, + BURNT_FUNDS_ACTOR_ADDR, METHOD_SEND, RawBytes::default(), deal_proposal.provider_collateral.clone(), @@ -116,7 +116,7 @@ fn publishing_timed_out_deal_again_should_work_after_cron_tick_as_it_should_no_l // do a cron tick for it -> should time out and get slashed rt.set_epoch(process_epoch(START_EPOCH, deal_id)); rt.expect_send( - *BURNT_FUNDS_ACTOR_ADDR, + BURNT_FUNDS_ACTOR_ADDR, METHOD_SEND, RawBytes::default(), deal_proposal.provider_collateral.clone(), @@ -189,7 +189,7 @@ fn timed_out_and_verified_deals_are_slashed_deleted_and_sent_to_the_registry_act }; rt.expect_send( - *VERIFIED_REGISTRY_ACTOR_ADDR, + VERIFIED_REGISTRY_ACTOR_ADDR, ext::verifreg::RESTORE_BYTES_METHOD as u64, RawBytes::serialize(param1).unwrap(), TokenAmount::zero(), @@ -197,7 +197,7 @@ fn timed_out_and_verified_deals_are_slashed_deleted_and_sent_to_the_registry_act ExitCode::OK, ); rt.expect_send( - *VERIFIED_REGISTRY_ACTOR_ADDR, + VERIFIED_REGISTRY_ACTOR_ADDR, ext::verifreg::RESTORE_BYTES_METHOD as u64, RawBytes::serialize(param2).unwrap(), TokenAmount::zero(), @@ -207,7 +207,7 @@ fn timed_out_and_verified_deals_are_slashed_deleted_and_sent_to_the_registry_act let expected_burn = 3 * &deal1.provider_collateral; rt.expect_send( - *BURNT_FUNDS_ACTOR_ADDR, + BURNT_FUNDS_ACTOR_ADDR, METHOD_SEND, RawBytes::default(), expected_burn, diff --git a/actors/market/tests/harness.rs b/actors/market/tests/harness.rs index 5bebec2f0..12afd4957 100644 --- a/actors/market/tests/harness.rs +++ b/actors/market/tests/harness.rs @@ -80,8 +80,8 @@ pub fn setup() -> MockRuntime { ]); let mut rt = MockRuntime { - receiver: *STORAGE_MARKET_ACTOR_ADDR, - caller: *SYSTEM_ACTOR_ADDR, + receiver: STORAGE_MARKET_ACTOR_ADDR, + caller: SYSTEM_ACTOR_ADDR, caller_type: *INIT_ACTOR_CODE_ID, actor_code_cids, balance: RefCell::new(TokenAmount::from_whole(10)), @@ -109,7 +109,7 @@ pub fn check_state_with_expected(rt: &MockRuntime, expected_patterns: &[Regex]) } pub fn construct_and_verify(rt: &mut MockRuntime) { - rt.expect_validate_caller_addr(vec![*SYSTEM_ACTOR_ADDR]); + rt.expect_validate_caller_addr(vec![SYSTEM_ACTOR_ADDR]); assert_eq!( RawBytes::default(), rt.call::(METHOD_CONSTRUCTOR, &RawBytes::default()).unwrap() @@ -365,7 +365,7 @@ pub fn cron_tick_and_assert_balances( let mut payment_end = d.end_epoch; if s.slash_epoch != EPOCH_UNDEFINED { rt.expect_send( - *BURNT_FUNDS_ACTOR_ADDR, + BURNT_FUNDS_ACTOR_ADDR, METHOD_SEND, RawBytes::default(), d.provider_collateral.clone(), @@ -488,7 +488,7 @@ pub fn publish_deals( .unwrap(); rt.expect_send( - *VERIFIED_REGISTRY_ACTOR_ADDR, + VERIFIED_REGISTRY_ACTOR_ADDR, ext::verifreg::USE_BYTES_METHOD as u64, param, TokenAmount::zero(), @@ -587,8 +587,8 @@ pub fn cron_tick(rt: &mut MockRuntime) { } pub fn cron_tick_raw(rt: &mut MockRuntime) -> Result { - rt.expect_validate_caller_addr(vec![*CRON_ACTOR_ADDR]); - rt.set_caller(*CRON_ACTOR_CODE_ID, *CRON_ACTOR_ADDR); + rt.expect_validate_caller_addr(vec![CRON_ACTOR_ADDR]); + rt.set_caller(*CRON_ACTOR_CODE_ID, CRON_ACTOR_ADDR); rt.call::(Method::CronTick as u64, &RawBytes::default()) } @@ -611,7 +611,7 @@ pub fn expect_query_network_info(rt: &mut MockRuntime) { this_epoch_reward_smoothed: epoch_reward_smooth, }; rt.expect_send( - *REWARD_ACTOR_ADDR, + REWARD_ACTOR_ADDR, RewardMethod::ThisEpochReward as u64, RawBytes::default(), TokenAmount::zero(), @@ -619,7 +619,7 @@ pub fn expect_query_network_info(rt: &mut MockRuntime) { ExitCode::OK, ); rt.expect_send( - *STORAGE_POWER_ACTOR_ADDR, + STORAGE_POWER_ACTOR_ADDR, PowerMethod::CurrentTotalPower as u64, RawBytes::default(), TokenAmount::zero(), diff --git a/actors/market/tests/market_actor_test.rs b/actors/market/tests/market_actor_test.rs index 72ad15a51..3f3a449cd 100644 --- a/actors/market/tests/market_actor_test.rs +++ b/actors/market/tests/market_actor_test.rs @@ -52,12 +52,12 @@ fn test_remove_all_error() { fn simple_construction() { let mut rt = MockRuntime { receiver: Address::new_id(100), - caller: *SYSTEM_ACTOR_ADDR, + caller: SYSTEM_ACTOR_ADDR, caller_type: *INIT_ACTOR_CODE_ID, ..Default::default() }; - rt.expect_validate_caller_addr(vec![*SYSTEM_ACTOR_ADDR]); + rt.expect_validate_caller_addr(vec![SYSTEM_ACTOR_ADDR]); assert_eq!( RawBytes::default(), @@ -802,7 +802,7 @@ fn provider_and_client_addresses_are_resolved_before_persisting_state_and_sent_t .unwrap(); rt.expect_send( - *VERIFIED_REGISTRY_ACTOR_ADDR, + VERIFIED_REGISTRY_ACTOR_ADDR, ext::verifreg::USE_BYTES_METHOD as u64, param, TokenAmount::zero(), @@ -1248,7 +1248,7 @@ fn slash_a_deal_and_make_payment_for_another_deal_in_the_same_epoch() { // cron tick will slash deal1 and make payment for deal2 rt.expect_send( - *BURNT_FUNDS_ACTOR_ADDR, + BURNT_FUNDS_ACTOR_ADDR, METHOD_SEND, RawBytes::default(), d1.provider_collateral.clone(), @@ -1491,7 +1491,7 @@ fn locked_fund_tracking_states() { let curr = process_epoch(start_epoch, deal_id3); rt.set_epoch(curr); rt.expect_send( - *BURNT_FUNDS_ACTOR_ADDR, + BURNT_FUNDS_ACTOR_ADDR, METHOD_SEND, RawBytes::default(), d3.provider_collateral.clone(), @@ -1532,7 +1532,7 @@ fn locked_fund_tracking_states() { clc = TokenAmount::zero(); plc = TokenAmount::zero(); rt.expect_send( - *BURNT_FUNDS_ACTOR_ADDR, + BURNT_FUNDS_ACTOR_ADDR, METHOD_SEND, RawBytes::default(), d1.provider_collateral, diff --git a/actors/market/tests/random_cron_epoch_during_publish.rs b/actors/market/tests/random_cron_epoch_during_publish.rs index 831e9beb2..d6f01ad1f 100644 --- a/actors/market/tests/random_cron_epoch_during_publish.rs +++ b/actors/market/tests/random_cron_epoch_during_publish.rs @@ -177,7 +177,7 @@ fn cron_processing_of_deal_after_missed_activation_should_fail_and_slash() { // FIXME: cron_tick calls 'VERIFIED_REGISTRY_ACTOR_ADDR' with the 'USE_BYTES_METHOD' method. rt.expect_send( - *BURNT_FUNDS_ACTOR_ADDR, + BURNT_FUNDS_ACTOR_ADDR, METHOD_SEND, RawBytes::default(), deal_proposal.provider_collateral.clone(), diff --git a/actors/miner/src/lib.rs b/actors/miner/src/lib.rs index d00878757..9ef612cb8 100644 --- a/actors/miner/src/lib.rs +++ b/actors/miner/src/lib.rs @@ -139,7 +139,7 @@ impl Actor { BS: Blockstore, RT: Runtime, { - rt.validate_immediate_caller_is(&[*INIT_ACTOR_ADDR])?; + rt.validate_immediate_caller_is(std::iter::once(&INIT_ACTOR_ADDR))?; check_control_addresses(rt.policy(), ¶ms.control_addresses)?; check_peer_info(rt.policy(), ¶ms.peer_id, ¶ms.multi_addresses)?; @@ -2045,7 +2045,7 @@ impl Actor { BS: Blockstore, RT: Runtime, { - rt.validate_immediate_caller_is(iter::once(&*STORAGE_POWER_ACTOR_ADDR))?; + rt.validate_immediate_caller_is(iter::once(&STORAGE_POWER_ACTOR_ADDR))?; // This should be enforced by the power actor. We log here just in case // something goes wrong. @@ -3067,7 +3067,7 @@ impl Actor { let (pledge_delta_total, to_burn) = rt.transaction(|st: &mut State, rt| { let mut pledge_delta_total = TokenAmount::zero(); - rt.validate_immediate_caller_is(std::iter::once(&*REWARD_ACTOR_ADDR))?; + rt.validate_immediate_caller_is(std::iter::once(&REWARD_ACTOR_ADDR))?; let (reward_to_lock, locked_reward_vesting_spec) = locked_reward_from_reward(params.reward); @@ -3531,7 +3531,7 @@ impl Actor { BS: Blockstore, RT: Runtime, { - rt.validate_immediate_caller_is(std::iter::once(&*STORAGE_POWER_ACTOR_ADDR))?; + rt.validate_immediate_caller_is(std::iter::once(&STORAGE_POWER_ACTOR_ADDR))?; let payload: CronEventPayload = from_slice(¶ms.event_payload).map_err(|e| { actor_error!( diff --git a/actors/miner/tests/apply_rewards.rs b/actors/miner/tests/apply_rewards.rs index 3d1418cda..1bec82b51 100644 --- a/actors/miner/tests/apply_rewards.rs +++ b/actors/miner/tests/apply_rewards.rs @@ -123,8 +123,8 @@ fn penalty_is_partially_burnt_and_stored_as_fee_debt() { let new_balance = &reward + &amt; rt.set_balance(new_balance); - rt.set_caller(*REWARD_ACTOR_CODE_ID, *REWARD_ACTOR_ADDR); - rt.expect_validate_caller_addr(vec![*REWARD_ACTOR_ADDR]); + rt.set_caller(*REWARD_ACTOR_CODE_ID, REWARD_ACTOR_ADDR); + rt.expect_validate_caller_addr(vec![REWARD_ACTOR_ADDR]); // pledge change is new reward - reward taken for fee debt // zero here since all reward goes to debt @@ -133,7 +133,7 @@ fn penalty_is_partially_burnt_and_stored_as_fee_debt() { // burn initial balance + reward = 2*amt let expect_burnt = 2 * &amt; rt.expect_send( - *BURNT_FUNDS_ACTOR_ADDR, + BURNT_FUNDS_ACTOR_ADDR, METHOD_SEND, RawBytes::default(), expect_burnt, @@ -186,11 +186,11 @@ fn rewards_pay_back_fee_debt() { let remaining_locked = locked_reward - &st.fee_debt; // note that this would be clamped at 0 if difference above is < 0 assert!(remaining_locked.is_positive()); let pledge_delta = remaining_locked.clone(); - rt.set_caller(*REWARD_ACTOR_CODE_ID, *REWARD_ACTOR_ADDR); - rt.expect_validate_caller_addr(vec![*REWARD_ACTOR_ADDR]); + rt.set_caller(*REWARD_ACTOR_CODE_ID, REWARD_ACTOR_ADDR); + rt.expect_validate_caller_addr(vec![REWARD_ACTOR_ADDR]); // expect pledge update rt.expect_send( - *STORAGE_POWER_ACTOR_ADDR, + STORAGE_POWER_ACTOR_ADDR, PowerMethod::UpdatePledgeTotal as u64, RawBytes::serialize(&pledge_delta).unwrap(), TokenAmount::zero(), @@ -200,7 +200,7 @@ fn rewards_pay_back_fee_debt() { let expect_burnt = st.fee_debt; rt.expect_send( - *BURNT_FUNDS_ACTOR_ADDR, + BURNT_FUNDS_ACTOR_ADDR, METHOD_SEND, RawBytes::default(), expect_burnt.clone(), diff --git a/actors/miner/tests/miner_actor_test_construction.rs b/actors/miner/tests/miner_actor_test_construction.rs index 9f8c770cd..41f4a7b17 100644 --- a/actors/miner/tests/miner_actor_test_construction.rs +++ b/actors/miner/tests/miner_actor_test_construction.rs @@ -47,7 +47,7 @@ fn prepare_env() -> TestEnv { env.rt.actor_code_cids.insert(env.control_addrs[0], *ACCOUNT_ACTOR_CODE_ID); env.rt.actor_code_cids.insert(env.control_addrs[1], *ACCOUNT_ACTOR_CODE_ID); env.rt.hash_func = Box::new(blake2b_256); - env.rt.caller = *INIT_ACTOR_ADDR; + env.rt.caller = INIT_ACTOR_ADDR; env.rt.caller_type = *INIT_ACTOR_CODE_ID; env } @@ -68,7 +68,7 @@ fn simple_construction() { let mut env = prepare_env(); let params = constructor_params(&env); - env.rt.expect_validate_caller_addr(vec![*INIT_ACTOR_ADDR]); + env.rt.expect_validate_caller_addr(vec![INIT_ACTOR_ADDR]); env.rt.expect_send( env.worker, AccountMethod::PubkeyAddress as u64, @@ -141,7 +141,7 @@ fn control_addresses_are_resolved_during_construction() { env.rt.id_addresses.insert(control2, control2id); let params = constructor_params(&env); - env.rt.expect_validate_caller_addr(vec![*INIT_ACTOR_ADDR]); + env.rt.expect_validate_caller_addr(vec![INIT_ACTOR_ADDR]); env.rt.expect_send( env.worker, AccountMethod::PubkeyAddress as u64, @@ -175,7 +175,7 @@ fn fails_if_control_address_is_not_an_account_actor() { env.rt.actor_code_cids.insert(control1, *PAYCH_ACTOR_CODE_ID); let params = constructor_params(&env); - env.rt.expect_validate_caller_addr(vec![*INIT_ACTOR_ADDR]); + env.rt.expect_validate_caller_addr(vec![INIT_ACTOR_ADDR]); env.rt.expect_send( env.worker, AccountMethod::PubkeyAddress as u64, @@ -199,7 +199,7 @@ fn test_construct_with_invalid_peer_id() { env.peer_id = vec![0; env.rt.policy.max_peer_id_length + 1]; let params = constructor_params(&env); - env.rt.expect_validate_caller_addr(vec![*INIT_ACTOR_ADDR]); + env.rt.expect_validate_caller_addr(vec![INIT_ACTOR_ADDR]); let result = env .rt @@ -218,7 +218,7 @@ fn fails_if_control_addresses_exceeds_maximum_length() { } let params = constructor_params(&env); - env.rt.expect_validate_caller_addr(vec![*INIT_ACTOR_ADDR]); + env.rt.expect_validate_caller_addr(vec![INIT_ACTOR_ADDR]); let result = env .rt @@ -237,7 +237,7 @@ fn test_construct_with_large_multiaddr() { } let params = constructor_params(&env); - env.rt.expect_validate_caller_addr(vec![*INIT_ACTOR_ADDR]); + env.rt.expect_validate_caller_addr(vec![INIT_ACTOR_ADDR]); let result = env .rt @@ -255,7 +255,7 @@ fn test_construct_with_empty_multiaddr() { env.multiaddrs.push(BytesDe(vec![1])); let params = constructor_params(&env); - env.rt.expect_validate_caller_addr(vec![*INIT_ACTOR_ADDR]); + env.rt.expect_validate_caller_addr(vec![INIT_ACTOR_ADDR]); let result = env .rt diff --git a/actors/miner/tests/util.rs b/actors/miner/tests/util.rs index 0314cf867..063c9462a 100644 --- a/actors/miner/tests/util.rs +++ b/actors/miner/tests/util.rs @@ -224,8 +224,8 @@ impl ActorHarness { rt.actor_code_cids.insert(*a, *ACCOUNT_ACTOR_CODE_ID); } - rt.set_caller(*INIT_ACTOR_CODE_ID, *INIT_ACTOR_ADDR); - rt.expect_validate_caller_addr(vec![*INIT_ACTOR_ADDR]); + rt.set_caller(*INIT_ACTOR_CODE_ID, INIT_ACTOR_ADDR); + rt.expect_validate_caller_addr(vec![INIT_ACTOR_ADDR]); rt.expect_send( self.worker, AccountMethod::PubkeyAddress as u64, @@ -501,7 +501,7 @@ impl ActorHarness { let vdparams = VerifyDealsForActivationParams { sectors: sector_deals }; let vdreturn = VerifyDealsForActivationReturn { sectors: sector_deal_data }; rt.expect_send( - *STORAGE_MARKET_ACTOR_ADDR, + STORAGE_MARKET_ACTOR_ADDR, MarketMethod::VerifyDealsForActivation as u64, RawBytes::serialize(vdparams).unwrap(), TokenAmount::zero(), @@ -517,7 +517,7 @@ impl ActorHarness { aggregate_pre_commit_network_fee(params.sectors.len() as i64, base_fee); let expected_burn = expected_network_fee + state.fee_debt; rt.expect_send( - *BURNT_FUNDS_ACTOR_ADDR, + BURNT_FUNDS_ACTOR_ADDR, METHOD_SEND, RawBytes::default(), expected_burn, @@ -534,7 +534,7 @@ impl ActorHarness { ); let cron_params = make_deadline_cron_event_params(dlinfo.last()); rt.expect_send( - *STORAGE_POWER_ACTOR_ADDR, + STORAGE_POWER_ACTOR_ADDR, PowerMethod::EnrollCronEvent as u64, RawBytes::serialize(cron_params).unwrap(), TokenAmount::zero(), @@ -587,7 +587,7 @@ impl ActorHarness { let vdreturn = VerifyDealsForActivationReturn { sectors: vec![conf.0] }; rt.expect_send( - *STORAGE_MARKET_ACTOR_ADDR, + STORAGE_MARKET_ACTOR_ADDR, MarketMethod::VerifyDealsForActivation as u64, RawBytes::serialize(vdparams).unwrap(), TokenAmount::zero(), @@ -600,7 +600,7 @@ impl ActorHarness { let state = self.get_state(rt); if state.fee_debt.is_positive() { rt.expect_send( - *BURNT_FUNDS_ACTOR_ADDR, + BURNT_FUNDS_ACTOR_ADDR, METHOD_SEND, RawBytes::default(), state.fee_debt.clone(), @@ -617,7 +617,7 @@ impl ActorHarness { ); let cron_params = make_deadline_cron_event_params(dlinfo.last()); rt.expect_send( - *STORAGE_POWER_ACTOR_ADDR, + STORAGE_POWER_ACTOR_ADDR, PowerMethod::EnrollCronEvent as u64, RawBytes::serialize(cron_params).unwrap(), TokenAmount::zero(), @@ -674,7 +674,7 @@ impl ActorHarness { this_epoch_reward_smoothed: self.epoch_reward_smooth.clone(), }; rt.expect_send( - *REWARD_ACTOR_ADDR, + REWARD_ACTOR_ADDR, RewardMethod::ThisEpochReward as u64, RawBytes::default(), TokenAmount::zero(), @@ -682,7 +682,7 @@ impl ActorHarness { ExitCode::OK, ); rt.expect_send( - *STORAGE_POWER_ACTOR_ADDR, + STORAGE_POWER_ACTOR_ADDR, PowerMethod::CurrentTotalPower as u64, RawBytes::default(), TokenAmount::zero(), @@ -742,7 +742,7 @@ impl ActorHarness { unsealed_cid: pc.info.unsealed_cid.get_cid(pc.info.seal_proof).unwrap(), }; rt.expect_send( - *STORAGE_POWER_ACTOR_ADDR, + STORAGE_POWER_ACTOR_ADDR, PowerMethod::SubmitPoRepForBulkVerify as u64, RawBytes::serialize(seal).unwrap(), TokenAmount::zero(), @@ -822,7 +822,7 @@ impl ActorHarness { let expected_fee = aggregate_prove_commit_network_fee(precommits.len() as i64, base_fee); assert!(expected_fee.is_positive()); rt.expect_send( - *BURNT_FUNDS_ACTOR_ADDR, + BURNT_FUNDS_ACTOR_ADDR, METHOD_SEND, RawBytes::default(), expected_fee, @@ -855,8 +855,8 @@ impl ActorHarness { all_sector_numbers.push(pc.info.sector_number); } - rt.set_caller(*POWER_ACTOR_CODE_ID, *STORAGE_POWER_ACTOR_ADDR); - rt.expect_validate_caller_addr(vec![*STORAGE_POWER_ACTOR_ADDR]); + rt.set_caller(*POWER_ACTOR_CODE_ID, STORAGE_POWER_ACTOR_ADDR); + rt.expect_validate_caller_addr(vec![STORAGE_POWER_ACTOR_ADDR]); let params = ConfirmSectorProofsParams { sectors: all_sector_numbers, @@ -905,7 +905,7 @@ impl ActorHarness { }; rt.expect_send( - *STORAGE_MARKET_ACTOR_ADDR, + STORAGE_MARKET_ACTOR_ADDR, MarketMethod::ActivateDeals as u64, RawBytes::serialize(params).unwrap(), TokenAmount::zero(), @@ -950,7 +950,7 @@ impl ActorHarness { if !expected_pledge.is_zero() { rt.expect_send( - *STORAGE_POWER_ACTOR_ADDR, + STORAGE_POWER_ACTOR_ADDR, PowerMethod::UpdatePledgeTotal as u64, RawBytes::serialize(&expected_pledge).unwrap(), TokenAmount::zero(), @@ -1009,7 +1009,7 @@ impl ActorHarness { pub fn on_deadline_cron(&self, rt: &mut MockRuntime, cfg: CronConfig) { let state = self.get_state(rt); - rt.expect_validate_caller_addr(vec![*STORAGE_POWER_ACTOR_ADDR]); + rt.expect_validate_caller_addr(vec![STORAGE_POWER_ACTOR_ADDR]); // preamble let mut power_delta = PowerPair::zero(); @@ -1022,7 +1022,7 @@ impl ActorHarness { quality_adjusted_delta: power_delta.qa, }; rt.expect_send( - *STORAGE_POWER_ACTOR_ADDR, + STORAGE_POWER_ACTOR_ADDR, PowerMethod::UpdateClaimedPower as u64, RawBytes::serialize(params).unwrap(), TokenAmount::zero(), @@ -1040,7 +1040,7 @@ impl ActorHarness { if !penalty_total.is_zero() { rt.expect_send( - *BURNT_FUNDS_ACTOR_ADDR, + BURNT_FUNDS_ACTOR_ADDR, METHOD_SEND, RawBytes::default(), penalty_total.clone(), @@ -1064,7 +1064,7 @@ impl ActorHarness { if !pledge_delta.is_zero() { rt.expect_send( - *STORAGE_POWER_ACTOR_ADDR, + STORAGE_POWER_ACTOR_ADDR, PowerMethod::UpdatePledgeTotal as u64, RawBytes::serialize(&pledge_delta).unwrap(), TokenAmount::zero(), @@ -1077,7 +1077,7 @@ impl ActorHarness { if !cfg.no_enrollment { let params = make_deadline_cron_event_params(cfg.expected_enrollment); rt.expect_send( - *STORAGE_POWER_ACTOR_ADDR, + STORAGE_POWER_ACTOR_ADDR, PowerMethod::EnrollCronEvent as u64, RawBytes::serialize(params).unwrap(), TokenAmount::zero(), @@ -1090,7 +1090,7 @@ impl ActorHarness { self.epoch_reward_smooth.clone(), self.epoch_qa_power_smooth.clone(), ); - rt.set_caller(*POWER_ACTOR_CODE_ID, *STORAGE_POWER_ACTOR_ADDR); + rt.set_caller(*POWER_ACTOR_CODE_ID, STORAGE_POWER_ACTOR_ADDR); rt.call::(Method::OnDeferredCronEvent as u64, &RawBytes::serialize(params).unwrap()) .unwrap(); rt.verify(); @@ -1194,7 +1194,7 @@ impl ActorHarness { quality_adjusted_delta: power_delta.qa, }; rt.expect_send( - *STORAGE_POWER_ACTOR_ADDR, + STORAGE_POWER_ACTOR_ADDR, PowerMethod::UpdateClaimedPower as u64, RawBytes::serialize(claim).unwrap(), TokenAmount::zero(), @@ -1302,7 +1302,7 @@ impl ActorHarness { quality_adjusted_delta: expected_power_delta.qa, }; rt.expect_send( - *STORAGE_POWER_ACTOR_ADDR, + STORAGE_POWER_ACTOR_ADDR, PowerMethod::UpdateClaimedPower as u64, RawBytes::serialize(claim).unwrap(), TokenAmount::zero(), @@ -1326,7 +1326,7 @@ impl ActorHarness { if dispute_result.expected_penalty.is_some() { let expected_penalty = dispute_result.expected_penalty.unwrap(); rt.expect_send( - *BURNT_FUNDS_ACTOR_ADDR, + BURNT_FUNDS_ACTOR_ADDR, METHOD_SEND, RawBytes::default(), expected_penalty, @@ -1338,7 +1338,7 @@ impl ActorHarness { if dispute_result.expected_pledge_delta.is_some() { let expected_pledge_delta = dispute_result.expected_pledge_delta.unwrap(); rt.expect_send( - *STORAGE_POWER_ACTOR_ADDR, + STORAGE_POWER_ACTOR_ADDR, PowerMethod::UpdatePledgeTotal as u64, RawBytes::serialize(&expected_pledge_delta).unwrap(), TokenAmount::zero(), @@ -1403,11 +1403,11 @@ impl ActorHarness { let (lock_amt, _) = locked_reward_from_reward(amt.clone()); let pledge_delta = lock_amt - &penalty; - rt.set_caller(*REWARD_ACTOR_CODE_ID, *REWARD_ACTOR_ADDR); - rt.expect_validate_caller_addr(vec![*REWARD_ACTOR_ADDR]); + rt.set_caller(*REWARD_ACTOR_CODE_ID, REWARD_ACTOR_ADDR); + rt.expect_validate_caller_addr(vec![REWARD_ACTOR_ADDR]); // expect pledge update rt.expect_send( - *STORAGE_POWER_ACTOR_ADDR, + STORAGE_POWER_ACTOR_ADDR, PowerMethod::UpdatePledgeTotal as u64, RawBytes::serialize(&pledge_delta).unwrap(), TokenAmount::zero(), @@ -1417,7 +1417,7 @@ impl ActorHarness { if penalty.is_positive() { rt.expect_send( - *BURNT_FUNDS_ACTOR_ADDR, + BURNT_FUNDS_ACTOR_ADDR, METHOD_SEND, RawBytes::default(), penalty.clone(), @@ -1563,7 +1563,7 @@ impl ActorHarness { quality_adjusted_delta: expected_qa_delta.clone(), }; rt.expect_send( - *STORAGE_POWER_ACTOR_ADDR, + STORAGE_POWER_ACTOR_ADDR, PowerMethod::UpdateClaimedPower as u64, RawBytes::serialize(claim).unwrap(), TokenAmount::zero(), @@ -1594,7 +1594,7 @@ impl ActorHarness { if expected_debt_repaid.is_positive() { rt.expect_send( - *BURNT_FUNDS_ACTOR_ADDR, + BURNT_FUNDS_ACTOR_ADDR, METHOD_SEND, RawBytes::default(), expected_debt_repaid, @@ -1704,7 +1704,7 @@ impl ActorHarness { this_epoch_reward_smoothed: self.epoch_reward_smooth.clone(), }; rt.expect_send( - *REWARD_ACTOR_ADDR, + REWARD_ACTOR_ADDR, RewardMethod::ThisEpochReward as u64, RawBytes::default(), TokenAmount::zero(), @@ -1726,7 +1726,7 @@ impl ActorHarness { // pay fault fee let to_burn = &penalty_total - &reward_total; rt.expect_send( - *BURNT_FUNDS_ACTOR_ADDR, + BURNT_FUNDS_ACTOR_ADDR, METHOD_SEND, RawBytes::default(), to_burn, @@ -1803,7 +1803,7 @@ impl ActorHarness { let mut pledge_delta = TokenAmount::zero(); if expected_fee.is_positive() { rt.expect_send( - *BURNT_FUNDS_ACTOR_ADDR, + BURNT_FUNDS_ACTOR_ADDR, METHOD_SEND, RawBytes::default(), expected_fee.clone(), @@ -1820,7 +1820,7 @@ impl ActorHarness { if !pledge_delta.is_zero() { rt.expect_send( - *STORAGE_POWER_ACTOR_ADDR, + STORAGE_POWER_ACTOR_ADDR, UPDATE_PLEDGE_TOTAL_METHOD, RawBytes::serialize(&pledge_delta).unwrap(), TokenAmount::zero(), @@ -1837,7 +1837,7 @@ impl ActorHarness { deal_ids: deal_ids[0..size].to_owned(), }; rt.expect_send( - *STORAGE_MARKET_ACTOR_ADDR, + STORAGE_MARKET_ACTOR_ADDR, ON_MINER_SECTORS_TERMINATE_METHOD, RawBytes::serialize(params).unwrap(), TokenAmount::zero(), @@ -1852,7 +1852,7 @@ impl ActorHarness { quality_adjusted_delta: -sector_power.qa.clone(), }; rt.expect_send( - *STORAGE_POWER_ACTOR_ADDR, + STORAGE_POWER_ACTOR_ADDR, UPDATE_CLAIMED_POWER_METHOD, RawBytes::serialize(params).unwrap(), TokenAmount::zero(), @@ -1916,7 +1916,7 @@ impl ActorHarness { if expected_repaid_from_vest > &TokenAmount::zero() { let pledge_delta = expected_repaid_from_vest.neg(); rt.expect_send( - *STORAGE_POWER_ACTOR_ADDR, + STORAGE_POWER_ACTOR_ADDR, PowerMethod::UpdatePledgeTotal as u64, RawBytes::serialize(&pledge_delta).unwrap(), TokenAmount::zero(), @@ -1928,7 +1928,7 @@ impl ActorHarness { let total_repaid = expected_repaid_from_vest + expected_repaid_from_balance; if total_repaid.is_positive() { rt.expect_send( - *BURNT_FUNDS_ACTOR_ADDR, + BURNT_FUNDS_ACTOR_ADDR, METHOD_SEND, RawBytes::default(), total_repaid.clone(), @@ -1966,7 +1966,7 @@ impl ActorHarness { if expected_debt_repaid.is_positive() { rt.expect_send( - *BURNT_FUNDS_ACTOR_ADDR, + BURNT_FUNDS_ACTOR_ADDR, METHOD_SEND, RawBytes::default(), expected_debt_repaid.clone(), @@ -2157,7 +2157,7 @@ impl ActorHarness { quality_adjusted_delta: qa_delta, }; rt.expect_send( - *STORAGE_POWER_ACTOR_ADDR, + STORAGE_POWER_ACTOR_ADDR, UPDATE_CLAIMED_POWER_METHOD, RawBytes::serialize(params).unwrap(), TokenAmount::zero(), diff --git a/actors/multisig/src/lib.rs b/actors/multisig/src/lib.rs index 308c2a67b..e3d481719 100644 --- a/actors/multisig/src/lib.rs +++ b/actors/multisig/src/lib.rs @@ -53,7 +53,7 @@ impl Actor { BS: Blockstore, RT: Runtime, { - rt.validate_immediate_caller_is(std::iter::once(&*INIT_ACTOR_ADDR))?; + rt.validate_immediate_caller_is(std::iter::once(&INIT_ACTOR_ADDR))?; if params.signers.is_empty() { return Err(actor_error!(illegal_argument; "Must have at least one signer")); diff --git a/actors/multisig/tests/multisig_actor_test.rs b/actors/multisig/tests/multisig_actor_test.rs index a31d451b5..523ecce01 100644 --- a/actors/multisig/tests/multisig_actor_test.rs +++ b/actors/multisig/tests/multisig_actor_test.rs @@ -22,7 +22,7 @@ mod util; fn construct_runtime(receiver: Address) -> MockRuntime { MockRuntime { receiver, - caller: *SYSTEM_ACTOR_ADDR, + caller: SYSTEM_ACTOR_ADDR, caller_type: *SYSTEM_ACTOR_CODE_ID, ..Default::default() } @@ -55,8 +55,8 @@ mod constructor_tests { }; rt.set_received(TokenAmount::from_atto(100u8)); - rt.expect_validate_caller_addr(vec![*INIT_ACTOR_ADDR]); - rt.set_caller(*INIT_ACTOR_CODE_ID, *INIT_ACTOR_ADDR); + rt.expect_validate_caller_addr(vec![INIT_ACTOR_ADDR]); + rt.set_caller(*INIT_ACTOR_CODE_ID, INIT_ACTOR_ADDR); let ret = rt.call::( Method::Constructor as u64, &RawBytes::serialize(¶ms).unwrap(), @@ -91,8 +91,8 @@ mod constructor_tests { start_epoch: 0, }; - rt.expect_validate_caller_addr(vec![*INIT_ACTOR_ADDR]); - rt.set_caller(*INIT_ACTOR_CODE_ID, *INIT_ACTOR_ADDR); + rt.expect_validate_caller_addr(vec![INIT_ACTOR_ADDR]); + rt.set_caller(*INIT_ACTOR_CODE_ID, INIT_ACTOR_ADDR); let ret = rt .call::( Method::Constructor as u64, @@ -114,8 +114,8 @@ mod constructor_tests { unlock_duration: 100, start_epoch: 1234, }; - rt.expect_validate_caller_addr(vec![*INIT_ACTOR_ADDR]); - rt.set_caller(*INIT_ACTOR_CODE_ID, *INIT_ACTOR_ADDR); + rt.expect_validate_caller_addr(vec![INIT_ACTOR_ADDR]); + rt.set_caller(*INIT_ACTOR_CODE_ID, INIT_ACTOR_ADDR); assert_eq!( RawBytes::default(), rt.call::( @@ -144,8 +144,8 @@ mod constructor_tests { unlock_duration: 1, start_epoch: 0, }; - rt.expect_validate_caller_addr(vec![*INIT_ACTOR_ADDR]); - rt.set_caller(*INIT_ACTOR_CODE_ID, *INIT_ACTOR_ADDR); + rt.expect_validate_caller_addr(vec![INIT_ACTOR_ADDR]); + rt.set_caller(*INIT_ACTOR_CODE_ID, INIT_ACTOR_ADDR); expect_abort( ExitCode::USR_ILLEGAL_ARGUMENT, @@ -172,8 +172,8 @@ mod constructor_tests { unlock_duration: 1, start_epoch: 0, }; - rt.expect_validate_caller_addr(vec![*INIT_ACTOR_ADDR]); - rt.set_caller(*INIT_ACTOR_CODE_ID, *INIT_ACTOR_ADDR); + rt.expect_validate_caller_addr(vec![INIT_ACTOR_ADDR]); + rt.set_caller(*INIT_ACTOR_CODE_ID, INIT_ACTOR_ADDR); expect_abort( ExitCode::USR_ILLEGAL_ARGUMENT, rt.call::( @@ -193,8 +193,8 @@ mod constructor_tests { unlock_duration: 0, start_epoch: 0, }; - rt.expect_validate_caller_addr(vec![*INIT_ACTOR_ADDR]); - rt.set_caller(*INIT_ACTOR_CODE_ID, *INIT_ACTOR_ADDR); + rt.expect_validate_caller_addr(vec![INIT_ACTOR_ADDR]); + rt.set_caller(*INIT_ACTOR_CODE_ID, INIT_ACTOR_ADDR); expect_abort( ExitCode::USR_ILLEGAL_ARGUMENT, rt.call::( @@ -216,7 +216,7 @@ mod constructor_tests { unlock_duration: 1, start_epoch: 0, }; - rt.expect_validate_caller_addr(vec![*INIT_ACTOR_ADDR]); + rt.expect_validate_caller_addr(vec![INIT_ACTOR_ADDR]); rt.expect_send( anne_non_id, METHOD_SEND, @@ -225,7 +225,7 @@ mod constructor_tests { RawBytes::default(), ExitCode::OK, ); - rt.set_caller(*INIT_ACTOR_CODE_ID, *INIT_ACTOR_ADDR); + rt.set_caller(*INIT_ACTOR_CODE_ID, INIT_ACTOR_ADDR); expect_abort( ExitCode::USR_ILLEGAL_ARGUMENT, rt.call::( @@ -245,8 +245,8 @@ mod constructor_tests { unlock_duration: 0, start_epoch: 0, }; - rt.expect_validate_caller_addr(vec![*INIT_ACTOR_ADDR]); - rt.set_caller(*INIT_ACTOR_CODE_ID, *INIT_ACTOR_ADDR); + rt.expect_validate_caller_addr(vec![INIT_ACTOR_ADDR]); + rt.set_caller(*INIT_ACTOR_CODE_ID, INIT_ACTOR_ADDR); expect_abort( ExitCode::USR_ILLEGAL_ARGUMENT, rt.call::( @@ -268,8 +268,8 @@ mod constructor_tests { unlock_duration: 0, start_epoch: 0, }; - rt.expect_validate_caller_addr(vec![*INIT_ACTOR_ADDR]); - rt.set_caller(*INIT_ACTOR_CODE_ID, *INIT_ACTOR_ADDR); + rt.expect_validate_caller_addr(vec![INIT_ACTOR_ADDR]); + rt.set_caller(*INIT_ACTOR_CODE_ID, INIT_ACTOR_ADDR); expect_abort( ExitCode::USR_ILLEGAL_ARGUMENT, rt.call::( diff --git a/actors/multisig/tests/util.rs b/actors/multisig/tests/util.rs index b5e6979cf..1ff3bba74 100644 --- a/actors/multisig/tests/util.rs +++ b/actors/multisig/tests/util.rs @@ -38,8 +38,8 @@ impl ActorHarness { unlock_duration, start_epoch, }; - rt.set_caller(*INIT_ACTOR_CODE_ID, *INIT_ACTOR_ADDR); - rt.expect_validate_caller_addr(vec![*INIT_ACTOR_ADDR]); + rt.set_caller(*INIT_ACTOR_CODE_ID, INIT_ACTOR_ADDR); + rt.expect_validate_caller_addr(vec![INIT_ACTOR_ADDR]); let result = rt .call::(Method::Constructor as u64, &RawBytes::serialize(params).unwrap()) .unwrap(); diff --git a/actors/paych/tests/paych_actor_test.rs b/actors/paych/tests/paych_actor_test.rs index 5a010309e..c36cf1c62 100644 --- a/actors/paych/tests/paych_actor_test.rs +++ b/actors/paych/tests/paych_actor_test.rs @@ -1135,7 +1135,7 @@ fn require_create_channel_with_lanes(num_lanes: u64) -> (MockRuntime, SignedVouc let mut rt = MockRuntime { receiver: paych_addr, - caller: *INIT_ACTOR_ADDR, + caller: INIT_ACTOR_ADDR, caller_type: *INIT_ACTOR_CODE_ID, actor_code_cids, value_received: received, diff --git a/actors/power/src/lib.rs b/actors/power/src/lib.rs index b421e67b3..4b6c4b5b2 100644 --- a/actors/power/src/lib.rs +++ b/actors/power/src/lib.rs @@ -75,7 +75,7 @@ impl Actor { BS: Blockstore, RT: Runtime, { - rt.validate_immediate_caller_is(std::iter::once(&*SYSTEM_ACTOR_ADDR))?; + rt.validate_immediate_caller_is(std::iter::once(&SYSTEM_ACTOR_ADDR))?; let st = State::new(rt.store()).map_err(|e| { e.downcast_default(ExitCode::USR_ILLEGAL_STATE, "Failed to create power actor state") @@ -249,7 +249,7 @@ impl Actor { BS: Blockstore, RT: Runtime, { - rt.validate_immediate_caller_is(std::iter::once(&*CRON_ACTOR_ADDR))?; + rt.validate_immediate_caller_is(std::iter::once(&CRON_ACTOR_ADDR))?; let rewret: ThisEpochRewardReturn = rt .send( diff --git a/actors/power/tests/harness/mod.rs b/actors/power/tests/harness/mod.rs index 24c1b7024..5a6ad643d 100644 --- a/actors/power/tests/harness/mod.rs +++ b/actors/power/tests/harness/mod.rs @@ -64,8 +64,8 @@ lazy_static! { pub fn new_runtime() -> MockRuntime { MockRuntime { - receiver: *STORAGE_POWER_ACTOR_ADDR, - caller: *SYSTEM_ACTOR_ADDR, + receiver: STORAGE_POWER_ACTOR_ADDR, + caller: SYSTEM_ACTOR_ADDR, caller_type: *SYSTEM_ACTOR_CODE_ID, ..Default::default() } @@ -100,7 +100,7 @@ pub struct Harness { impl Harness { pub fn construct(&self, rt: &mut MockRuntime) { - rt.expect_validate_caller_addr(vec![*SYSTEM_ACTOR_ADDR]); + rt.expect_validate_caller_addr(vec![SYSTEM_ACTOR_ADDR]); rt.call::(Method::Constructor as MethodNum, &RawBytes::default()).unwrap(); rt.verify() } @@ -156,7 +156,7 @@ impl Harness { }; let create_miner_ret = CreateMinerReturn { id_address: *miner, robust_address: *robust }; rt.expect_send( - *INIT_ACTOR_ADDR, + INIT_ACTOR_ADDR, ext::init::EXEC_METHOD, RawBytes::serialize(expected_init_params).unwrap(), value.clone(), @@ -378,7 +378,7 @@ impl Harness { }; rt.expect_send( - *REWARD_ACTOR_ADDR, + REWARD_ACTOR_ADDR, ThisEpochReward as u64, RawBytes::default(), TokenAmount::zero(), @@ -422,17 +422,17 @@ impl Harness { // expect power sends to reward actor rt.expect_send( - *REWARD_ACTOR_ADDR, + REWARD_ACTOR_ADDR, UPDATE_NETWORK_KPI, RawBytes::serialize(BigIntSer(expected_raw_power)).unwrap(), TokenAmount::zero(), RawBytes::default(), ExitCode::new(0), ); - rt.expect_validate_caller_addr(vec![*CRON_ACTOR_ADDR]); + rt.expect_validate_caller_addr(vec![CRON_ACTOR_ADDR]); rt.set_epoch(current_epoch); - rt.set_caller(*CRON_ACTOR_CODE_ID, *CRON_ACTOR_ADDR); + rt.set_caller(*CRON_ACTOR_CODE_ID, CRON_ACTOR_ADDR); rt.call::(Method::OnEpochTickEnd as u64, &RawBytes::default()).unwrap(); diff --git a/actors/power/tests/power_actor_tests.rs b/actors/power/tests/power_actor_tests.rs index 9b754a064..c090725bc 100644 --- a/actors/power/tests/power_actor_tests.rs +++ b/actors/power/tests/power_actor_tests.rs @@ -137,7 +137,7 @@ fn create_miner_given_send_to_init_actor_fails_should_fail() { }; rt.expect_send( - *INIT_ACTOR_ADDR, + INIT_ACTOR_ADDR, EXEC_METHOD, RawBytes::serialize(message_params).unwrap(), TokenAmount::from_atto(10), @@ -633,18 +633,18 @@ mod cron_tests { let expected_power = BigInt::zero(); rt.set_epoch(1); - rt.expect_validate_caller_addr(vec![*CRON_ACTOR_ADDR]); + rt.expect_validate_caller_addr(vec![CRON_ACTOR_ADDR]); h.expect_query_network_info(&mut rt); rt.expect_send( - *REWARD_ACTOR_ADDR, + REWARD_ACTOR_ADDR, RewardMethod::UpdateNetworkKPI as u64, RawBytes::serialize(BigIntSer(&expected_power)).unwrap(), TokenAmount::zero(), RawBytes::default(), ExitCode::OK, ); - rt.set_caller(*CRON_ACTOR_CODE_ID, *CRON_ACTOR_ADDR); + rt.set_caller(*CRON_ACTOR_CODE_ID, CRON_ACTOR_ADDR); rt.expect_batch_verify_seals(Vec::new(), Ok(Vec::new())); rt.call::(Method::OnEpochTickEnd as u64, &RawBytes::default()).unwrap(); @@ -715,7 +715,7 @@ mod cron_tests { let expected_raw_byte_power = BigInt::zero(); rt.set_epoch(4); - rt.expect_validate_caller_addr(vec![*CRON_ACTOR_ADDR]); + rt.expect_validate_caller_addr(vec![CRON_ACTOR_ADDR]); h.expect_query_network_info(&mut rt); let state: State = rt.get_state(); @@ -748,14 +748,14 @@ mod cron_tests { ); rt.expect_send( - *REWARD_ACTOR_ADDR, + REWARD_ACTOR_ADDR, UPDATE_NETWORK_KPI, RawBytes::serialize(BigIntSer(&expected_raw_byte_power)).unwrap(), TokenAmount::zero(), RawBytes::default(), ExitCode::OK, ); - rt.set_caller(*CRON_ACTOR_CODE_ID, *CRON_ACTOR_ADDR); + rt.set_caller(*CRON_ACTOR_CODE_ID, CRON_ACTOR_ADDR); rt.expect_batch_verify_seals(Vec::new(), Ok(Vec::new())); rt.call::(Method::OnEpochTickEnd as u64, &RawBytes::default()).unwrap(); @@ -773,17 +773,17 @@ mod cron_tests { // run cron once to put it in a clean state at epoch 4 let expected_raw_byte_power = BigInt::zero(); rt.set_epoch(4); - rt.expect_validate_caller_addr(vec![*CRON_ACTOR_ADDR]); + rt.expect_validate_caller_addr(vec![CRON_ACTOR_ADDR]); h.expect_query_network_info(&mut rt); rt.expect_send( - *REWARD_ACTOR_ADDR, + REWARD_ACTOR_ADDR, UPDATE_NETWORK_KPI, RawBytes::serialize(BigIntSer(&expected_raw_byte_power)).unwrap(), TokenAmount::zero(), RawBytes::default(), ExitCode::OK, ); - rt.set_caller(*CRON_ACTOR_CODE_ID, *CRON_ACTOR_ADDR); + rt.set_caller(*CRON_ACTOR_CODE_ID, CRON_ACTOR_ADDR); rt.expect_batch_verify_seals(Vec::new(), Ok(Vec::new())); @@ -796,7 +796,7 @@ mod cron_tests { // run cron again in the future rt.set_epoch(6); - rt.expect_validate_caller_addr(vec![*CRON_ACTOR_ADDR]); + rt.expect_validate_caller_addr(vec![CRON_ACTOR_ADDR]); h.expect_query_network_info(&mut rt); let state: State = rt.get_state(); @@ -815,14 +815,14 @@ mod cron_tests { ExitCode::OK, ); rt.expect_send( - *REWARD_ACTOR_ADDR, + REWARD_ACTOR_ADDR, UPDATE_NETWORK_KPI, RawBytes::serialize(BigIntSer(&expected_raw_byte_power)).unwrap(), TokenAmount::zero(), RawBytes::default(), ExitCode::OK, ); - rt.set_caller(*CRON_ACTOR_CODE_ID, *CRON_ACTOR_ADDR); + rt.set_caller(*CRON_ACTOR_CODE_ID, CRON_ACTOR_ADDR); rt.expect_batch_verify_seals(Vec::new(), Ok(Vec::new())); rt.call::(Method::OnEpochTickEnd as u64, &RawBytes::default()).unwrap(); @@ -867,7 +867,7 @@ mod cron_tests { h.delete_claim(&mut rt, &miner1); rt.set_epoch(2); - rt.expect_validate_caller_addr(vec![*CRON_ACTOR_ADDR]); + rt.expect_validate_caller_addr(vec![CRON_ACTOR_ADDR]); // process batch verifies first rt.expect_batch_verify_seals(Vec::new(), Ok(Vec::new())); @@ -892,14 +892,14 @@ mod cron_tests { // reward actor is still invoked rt.expect_send( - *REWARD_ACTOR_ADDR, + REWARD_ACTOR_ADDR, UPDATE_NETWORK_KPI, RawBytes::serialize(BigIntSer(&BigInt::zero())).unwrap(), TokenAmount::zero(), RawBytes::default(), ExitCode::OK, ); - rt.set_caller(*CRON_ACTOR_CODE_ID, *CRON_ACTOR_ADDR); + rt.set_caller(*CRON_ACTOR_CODE_ID, CRON_ACTOR_ADDR); rt.call::(Method::OnEpochTickEnd as u64, &RawBytes::default()).unwrap(); rt.verify(); @@ -932,7 +932,7 @@ mod cron_tests { h.expect_miners_above_min_power(&mut rt, 1); rt.set_epoch(2); - rt.expect_validate_caller_addr(vec![*CRON_ACTOR_ADDR]); + rt.expect_validate_caller_addr(vec![CRON_ACTOR_ADDR]); // process batch verifies first rt.expect_batch_verify_seals(Vec::new(), Ok(Vec::new())); @@ -967,9 +967,9 @@ mod cron_tests { ExitCode::OK, ); // reward actor is still invoked - rt.set_caller(*CRON_ACTOR_CODE_ID, *CRON_ACTOR_ADDR); + rt.set_caller(*CRON_ACTOR_CODE_ID, CRON_ACTOR_ADDR); rt.expect_send( - *REWARD_ACTOR_ADDR, + REWARD_ACTOR_ADDR, UPDATE_NETWORK_KPI, RawBytes::serialize(BigIntSer(&BigInt::zero())).unwrap(), TokenAmount::zero(), @@ -991,19 +991,19 @@ mod cron_tests { // next epoch, only the reward actor is invoked rt.set_epoch(3); - rt.expect_validate_caller_addr(vec![*CRON_ACTOR_ADDR]); + rt.expect_validate_caller_addr(vec![CRON_ACTOR_ADDR]); h.expect_query_network_info(&mut rt); rt.expect_send( - *REWARD_ACTOR_ADDR, + REWARD_ACTOR_ADDR, UPDATE_NETWORK_KPI, RawBytes::serialize(BigIntSer(&BigInt::zero())).unwrap(), TokenAmount::zero(), RawBytes::default(), ExitCode::OK, ); - rt.set_caller(*CRON_ACTOR_CODE_ID, *CRON_ACTOR_ADDR); + rt.set_caller(*CRON_ACTOR_CODE_ID, CRON_ACTOR_ADDR); rt.expect_batch_verify_seals(Vec::new(), Ok(Vec::new())); rt.call::(Method::OnEpochTickEnd as u64, &RawBytes::default()).unwrap(); @@ -1242,7 +1242,7 @@ mod cron_batch_proof_verifies_tests { // expect power sends to reward actor rt.expect_send( - *REWARD_ACTOR_ADDR, + REWARD_ACTOR_ADDR, UPDATE_NETWORK_KPI, RawBytes::serialize(BigIntSer(&BigInt::zero())).unwrap(), TokenAmount::zero(), @@ -1250,10 +1250,10 @@ mod cron_batch_proof_verifies_tests { ExitCode::OK, ); - rt.expect_validate_caller_addr(vec![*CRON_ACTOR_ADDR]); + rt.expect_validate_caller_addr(vec![CRON_ACTOR_ADDR]); rt.set_epoch(0); - rt.set_caller(*CRON_ACTOR_CODE_ID, *CRON_ACTOR_ADDR); + rt.set_caller(*CRON_ACTOR_CODE_ID, CRON_ACTOR_ADDR); rt.call::(Method::OnEpochTickEnd as u64, &RawBytes::default()).unwrap(); @@ -1274,11 +1274,11 @@ mod cron_batch_proof_verifies_tests { h.expect_query_network_info(&mut rt); rt.expect_batch_verify_seals(infos, Err(anyhow::Error::msg("fail"))); - rt.expect_validate_caller_addr(vec![*CRON_ACTOR_ADDR]); + rt.expect_validate_caller_addr(vec![CRON_ACTOR_ADDR]); // expect power sends to reward actor rt.expect_send( - *REWARD_ACTOR_ADDR, + REWARD_ACTOR_ADDR, UPDATE_NETWORK_KPI, RawBytes::serialize(BigIntSer(&BigInt::zero())).unwrap(), TokenAmount::zero(), @@ -1286,7 +1286,7 @@ mod cron_batch_proof_verifies_tests { ExitCode::OK, ); rt.set_epoch(0); - rt.set_caller(*CRON_ACTOR_CODE_ID, *CRON_ACTOR_ADDR); + rt.set_caller(*CRON_ACTOR_CODE_ID, CRON_ACTOR_ADDR); rt.call::(Method::OnEpochTickEnd as u64, &RawBytes::default()).unwrap(); rt.verify(); diff --git a/actors/reward/src/lib.rs b/actors/reward/src/lib.rs index 9d146b8d5..2f7e13940 100644 --- a/actors/reward/src/lib.rs +++ b/actors/reward/src/lib.rs @@ -61,7 +61,7 @@ impl Actor { BS: Blockstore, RT: Runtime, { - rt.validate_immediate_caller_is(std::iter::once(&*SYSTEM_ACTOR_ADDR))?; + rt.validate_immediate_caller_is(std::iter::once(&SYSTEM_ACTOR_ADDR))?; if let Some(power) = curr_realized_power { rt.create(&State::new(power))?; @@ -89,7 +89,7 @@ impl Actor { BS: Blockstore, RT: Runtime, { - rt.validate_immediate_caller_is(std::iter::once(&*SYSTEM_ACTOR_ADDR))?; + rt.validate_immediate_caller_is(std::iter::once(&SYSTEM_ACTOR_ADDR))?; let prior_balance = rt.current_balance(); if params.penalty.is_negative() { return Err(actor_error!(illegal_argument, "negative penalty {}", params.penalty)); @@ -209,7 +209,7 @@ impl Actor { BS: Blockstore, RT: Runtime, { - rt.validate_immediate_caller_is(std::iter::once(&*STORAGE_POWER_ACTOR_ADDR))?; + rt.validate_immediate_caller_is(std::iter::once(&STORAGE_POWER_ACTOR_ADDR))?; let curr_realized_power = curr_realized_power .ok_or_else(|| actor_error!(illegal_argument, "argument cannot be None"))?; diff --git a/actors/reward/tests/reward_actor_test.rs b/actors/reward/tests/reward_actor_test.rs index f8ed63937..33dfe720b 100644 --- a/actors/reward/tests/reward_actor_test.rs +++ b/actors/reward/tests/reward_actor_test.rs @@ -89,7 +89,7 @@ mod test_award_block_reward { let mut rt = construct_and_verify(&StoragePower::default()); rt.set_balance(TokenAmount::from_atto(9)); - rt.expect_validate_caller_addr(vec![*SYSTEM_ACTOR_ADDR]); + rt.expect_validate_caller_addr(vec![SYSTEM_ACTOR_ADDR]); assert_eq!( ExitCode::USR_ILLEGAL_STATE, award_block_reward( @@ -109,7 +109,7 @@ mod test_award_block_reward { fn rejects_negative_penalty_or_reward() { let mut rt = construct_and_verify(&StoragePower::default()); rt.set_balance(TokenAmount::from_whole(1)); - rt.expect_validate_caller_addr(vec![*SYSTEM_ACTOR_ADDR]); + rt.expect_validate_caller_addr(vec![SYSTEM_ACTOR_ADDR]); let reward_penalty_pairs = [(-1, 0), (0, -1)]; @@ -136,7 +136,7 @@ mod test_award_block_reward { let mut rt = construct_and_verify(&StoragePower::default()); rt.set_balance(TokenAmount::from_whole(1)); - rt.expect_validate_caller_addr(vec![*SYSTEM_ACTOR_ADDR]); + rt.expect_validate_caller_addr(vec![SYSTEM_ACTOR_ADDR]); assert!(award_block_reward( &mut rt, *WINNER, @@ -153,7 +153,7 @@ mod test_award_block_reward { fn pays_reward_and_tracks_penalty() { let mut rt = construct_and_verify(&StoragePower::default()); rt.set_balance(TokenAmount::from_whole(1_000_000_000)); - rt.expect_validate_caller_addr(vec![*SYSTEM_ACTOR_ADDR]); + rt.expect_validate_caller_addr(vec![SYSTEM_ACTOR_ADDR]); let penalty: TokenAmount = TokenAmount::from_atto(100); let gas_reward: TokenAmount = TokenAmount::from_atto(200); let expected_reward: TokenAmount = @@ -191,7 +191,7 @@ mod test_award_block_reward { let small_reward = TokenAmount::from_atto(300); let penalty = TokenAmount::from_atto(100); rt.set_balance(small_reward.clone()); - rt.expect_validate_caller_addr(vec![*SYSTEM_ACTOR_ADDR]); + rt.expect_validate_caller_addr(vec![SYSTEM_ACTOR_ADDR]); let miner_penalty = PENALTY_MULTIPLIER * &penalty; let params = RawBytes::serialize(&ext::miner::ApplyRewardParams { @@ -263,7 +263,7 @@ mod test_award_block_reward { // enough balance to pay 3 full rewards and one partial rt.set_balance(TokenAmount::from_atto(3500)); - rt.expect_validate_caller_addr(vec![*SYSTEM_ACTOR_ADDR]); + rt.expect_validate_caller_addr(vec![SYSTEM_ACTOR_ADDR]); let expected_reward = TokenAmount::from_atto(1000); let miner_penalty = TokenAmount::zero(); let params = RawBytes::serialize(&ext::miner::ApplyRewardParams { @@ -280,7 +280,7 @@ mod test_award_block_reward { ExitCode::USR_FORBIDDEN, ); rt.expect_send( - *BURNT_FUNDS_ACTOR_ADDR, + BURNT_FUNDS_ACTOR_ADDR, METHOD_SEND, RawBytes::default(), expected_reward, @@ -335,12 +335,12 @@ fn test_successive_kpi_updates() { fn construct_and_verify(curr_power: &StoragePower) -> MockRuntime { let mut rt = MockRuntime { - receiver: *REWARD_ACTOR_ADDR, - caller: *SYSTEM_ACTOR_ADDR, + receiver: REWARD_ACTOR_ADDR, + caller: SYSTEM_ACTOR_ADDR, caller_type: *SYSTEM_ACTOR_CODE_ID, ..Default::default() }; - rt.expect_validate_caller_addr(vec![*SYSTEM_ACTOR_ADDR]); + rt.expect_validate_caller_addr(vec![SYSTEM_ACTOR_ADDR]); let ret = rt .call::( METHOD_CONSTRUCTOR, @@ -361,7 +361,7 @@ fn award_block_reward( win_count: i64, expected_payment: TokenAmount, ) -> Result { - rt.expect_validate_caller_addr(vec![*SYSTEM_ACTOR_ADDR]); + rt.expect_validate_caller_addr(vec![SYSTEM_ACTOR_ADDR]); let miner_penalty = &penalty * PENALTY_MULTIPLIER; rt.expect_send( miner, @@ -378,7 +378,7 @@ fn award_block_reward( if penalty.is_positive() { rt.expect_send( - *BURNT_FUNDS_ACTOR_ADDR, + BURNT_FUNDS_ACTOR_ADDR, METHOD_SEND, RawBytes::default(), expected_payment, @@ -407,8 +407,8 @@ fn this_epoch_reward(rt: &mut MockRuntime) -> ThisEpochRewardReturn { } fn update_network_kpi(rt: &mut MockRuntime, curr_raw_power: &StoragePower) { - rt.set_caller(*POWER_ACTOR_CODE_ID, *STORAGE_POWER_ACTOR_ADDR); - rt.expect_validate_caller_addr(vec![*STORAGE_POWER_ACTOR_ADDR]); + rt.set_caller(*POWER_ACTOR_CODE_ID, STORAGE_POWER_ACTOR_ADDR); + rt.expect_validate_caller_addr(vec![STORAGE_POWER_ACTOR_ADDR]); let params = &RawBytes::serialize(BigIntSer(curr_raw_power)).unwrap(); assert!(rt.call::(Method::UpdateNetworkKPI as u64, params).is_ok()); diff --git a/actors/system/src/lib.rs b/actors/system/src/lib.rs index 1c6ef5f38..f3a062791 100644 --- a/actors/system/src/lib.rs +++ b/actors/system/src/lib.rs @@ -60,7 +60,7 @@ impl Actor { BS: Blockstore, RT: Runtime, { - rt.validate_immediate_caller_is(std::iter::once(&*SYSTEM_ACTOR_ADDR))?; + rt.validate_immediate_caller_is(std::iter::once(&SYSTEM_ACTOR_ADDR))?; let state = State::new(rt.store()).context("failed to construct state")?; rt.create(&state)?; @@ -100,8 +100,8 @@ mod tests { pub fn new_runtime() -> MockRuntime { MockRuntime { - receiver: *SYSTEM_ACTOR_ADDR, - caller: *SYSTEM_ACTOR_ADDR, + receiver: SYSTEM_ACTOR_ADDR, + caller: SYSTEM_ACTOR_ADDR, caller_type: *SYSTEM_ACTOR_CODE_ID, ..Default::default() } @@ -110,8 +110,8 @@ mod tests { #[test] fn construct_with_root_id() { let mut rt = new_runtime(); - rt.expect_validate_caller_addr(vec![*SYSTEM_ACTOR_ADDR]); - rt.set_caller(*SYSTEM_ACTOR_CODE_ID, *SYSTEM_ACTOR_ADDR); + rt.expect_validate_caller_addr(vec![SYSTEM_ACTOR_ADDR]); + rt.set_caller(*SYSTEM_ACTOR_CODE_ID, SYSTEM_ACTOR_ADDR); rt.call::(Method::Constructor as MethodNum, &RawBytes::default()).unwrap(); let state: State = rt.get_state(); diff --git a/actors/verifreg/src/lib.rs b/actors/verifreg/src/lib.rs index 8d91e76db..e8f4d73e1 100644 --- a/actors/verifreg/src/lib.rs +++ b/actors/verifreg/src/lib.rs @@ -50,7 +50,7 @@ impl Actor { BS: Blockstore, RT: Runtime, { - rt.validate_immediate_caller_is(std::iter::once(&*SYSTEM_ACTOR_ADDR))?; + rt.validate_immediate_caller_is(std::iter::once(&SYSTEM_ACTOR_ADDR))?; // root should be an ID address let id_addr = rt @@ -308,7 +308,7 @@ impl Actor { BS: Blockstore, RT: Runtime, { - rt.validate_immediate_caller_is(std::iter::once(&*STORAGE_MARKET_ACTOR_ADDR))?; + rt.validate_immediate_caller_is(std::iter::once(&STORAGE_MARKET_ACTOR_ADDR))?; let client = resolve_to_actor_id(rt, ¶ms.address)?; let client = Address::new_id(client); @@ -405,7 +405,7 @@ impl Actor { BS: Blockstore, RT: Runtime, { - rt.validate_immediate_caller_is(std::iter::once(&*STORAGE_MARKET_ACTOR_ADDR))?; + rt.validate_immediate_caller_is(std::iter::once(&STORAGE_MARKET_ACTOR_ADDR))?; if params.deal_size < rt.policy().minimum_verified_deal_size { return Err(actor_error!( illegal_argument, diff --git a/actors/verifreg/tests/harness/mod.rs b/actors/verifreg/tests/harness/mod.rs index b7760631a..76d5f1fe5 100644 --- a/actors/verifreg/tests/harness/mod.rs +++ b/actors/verifreg/tests/harness/mod.rs @@ -5,7 +5,6 @@ use fvm_ipld_encoding::RawBytes; use fvm_shared::address::Address; use fvm_shared::bigint::bigint_ser::BigIntDe; use fvm_shared::{MethodNum, HAMT_BIT_WIDTH}; -use lazy_static::lazy_static; use fil_actor_verifreg::{ Actor as VerifregActor, AddVerifierClientParams, AddVerifierParams, DataCap, Method, @@ -17,14 +16,12 @@ use fil_actors_runtime::{ SYSTEM_ACTOR_ADDR, }; -lazy_static! { - pub static ref ROOT_ADDR: Address = Address::new_id(101); -} +pub const ROOT_ADDR: Address = Address::new_id(101); pub fn new_runtime() -> MockRuntime { MockRuntime { - receiver: *ROOT_ADDR, - caller: *SYSTEM_ACTOR_ADDR, + receiver: ROOT_ADDR, + caller: SYSTEM_ACTOR_ADDR, caller_type: *SYSTEM_ACTOR_CODE_ID, ..Default::default() } @@ -32,7 +29,7 @@ pub fn new_runtime() -> MockRuntime { pub fn new_harness() -> (Harness, MockRuntime) { let mut rt = new_runtime(); - let h = Harness { root: *ROOT_ADDR }; + let h = Harness { root: ROOT_ADDR }; h.construct_and_verify(&mut rt, &h.root); (h, rt) } @@ -43,7 +40,7 @@ pub struct Harness { impl Harness { pub fn construct_and_verify(&self, rt: &mut MockRuntime, root_param: &Address) { - rt.expect_validate_caller_addr(vec![*SYSTEM_ACTOR_ADDR]); + rt.expect_validate_caller_addr(vec![SYSTEM_ACTOR_ADDR]); let ret = rt .call::( Method::Constructor as MethodNum, @@ -179,8 +176,8 @@ impl Harness { client: &Address, amount: &DataCap, ) -> Result<(), ActorError> { - rt.expect_validate_caller_addr(vec![*STORAGE_MARKET_ACTOR_ADDR]); - rt.set_caller(*MARKET_ACTOR_CODE_ID, *STORAGE_MARKET_ACTOR_ADDR); + rt.expect_validate_caller_addr(vec![STORAGE_MARKET_ACTOR_ADDR]); + rt.set_caller(*MARKET_ACTOR_CODE_ID, STORAGE_MARKET_ACTOR_ADDR); let params = UseBytesParams { address: *client, deal_size: amount.clone() }; let ret = rt.call::( Method::UseBytes as MethodNum, @@ -197,8 +194,8 @@ impl Harness { client: &Address, amount: &DataCap, ) -> Result<(), ActorError> { - rt.expect_validate_caller_addr(vec![*STORAGE_MARKET_ACTOR_ADDR]); - rt.set_caller(*MARKET_ACTOR_CODE_ID, *STORAGE_MARKET_ACTOR_ADDR); + rt.expect_validate_caller_addr(vec![STORAGE_MARKET_ACTOR_ADDR]); + rt.set_caller(*MARKET_ACTOR_CODE_ID, STORAGE_MARKET_ACTOR_ADDR); let params = RestoreBytesParams { address: *client, deal_size: amount.clone() }; let ret = rt.call::( Method::RestoreBytes as MethodNum, diff --git a/actors/verifreg/tests/verifreg_actor_test.rs b/actors/verifreg/tests/verifreg_actor_test.rs index e5e67faa7..8bbb13581 100644 --- a/actors/verifreg/tests/verifreg_actor_test.rs +++ b/actors/verifreg/tests/verifreg_actor_test.rs @@ -41,7 +41,7 @@ mod construction { #[test] fn construct_with_root_id() { let mut rt = new_runtime(); - let h = Harness { root: *ROOT_ADDR }; + let h = Harness { root: ROOT_ADDR }; h.construct_and_verify(&mut rt, &h.root); h.check_state(&rt); } @@ -49,7 +49,7 @@ mod construction { #[test] fn construct_resolves_non_id() { let mut rt = new_runtime(); - let h = Harness { root: *ROOT_ADDR }; + let h = Harness { root: ROOT_ADDR }; let root_pubkey = Address::new_bls(&[7u8; BLS_PUB_LEN]).unwrap(); rt.id_addresses.insert(root_pubkey, h.root); h.construct_and_verify(&mut rt, &root_pubkey); @@ -61,7 +61,7 @@ mod construction { let mut rt = new_runtime(); let root_pubkey = Address::new_bls(&[7u8; BLS_PUB_LEN]).unwrap(); - rt.expect_validate_caller_addr(vec![*SYSTEM_ACTOR_ADDR]); + rt.expect_validate_caller_addr(vec![SYSTEM_ACTOR_ADDR]); expect_abort( ExitCode::USR_ILLEGAL_ARGUMENT, rt.call::( @@ -517,8 +517,8 @@ mod datacap { #[test] fn consume_requires_market_actor_caller() { let (h, mut rt) = new_harness(); - rt.expect_validate_caller_addr(vec![*STORAGE_MARKET_ACTOR_ADDR]); - rt.set_caller(*POWER_ACTOR_CODE_ID, *STORAGE_POWER_ACTOR_ADDR); + rt.expect_validate_caller_addr(vec![STORAGE_MARKET_ACTOR_ADDR]); + rt.set_caller(*POWER_ACTOR_CODE_ID, STORAGE_POWER_ACTOR_ADDR); let params = UseBytesParams { address: *CLIENT, deal_size: rt.policy.minimum_verified_deal_size.clone(), @@ -675,8 +675,8 @@ mod datacap { #[test] fn restore_requires_market_actor_caller() { let (h, mut rt) = new_harness(); - rt.expect_validate_caller_addr(vec![*STORAGE_MARKET_ACTOR_ADDR]); - rt.set_caller(*POWER_ACTOR_CODE_ID, *STORAGE_POWER_ACTOR_ADDR); + rt.expect_validate_caller_addr(vec![STORAGE_MARKET_ACTOR_ADDR]); + rt.set_caller(*POWER_ACTOR_CODE_ID, STORAGE_POWER_ACTOR_ADDR); let params = RestoreBytesParams { address: *CLIENT, deal_size: rt.policy.minimum_verified_deal_size.clone(), diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index 3983b8ed8..55db5d7bf 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -36,6 +36,7 @@ rand = "0.8.5" serde_repr = "0.1.8" regex = "1" itertools = "0.10" +paste = "1.0.9" [dependencies.sha2] version = "0.10" diff --git a/runtime/src/builtin/singletons.rs b/runtime/src/builtin/singletons.rs index ccaf4bc83..8c896e976 100644 --- a/runtime/src/builtin/singletons.rs +++ b/runtime/src/builtin/singletons.rs @@ -1,22 +1,31 @@ -// Copyright 2019-2022 ChainSafe Systems // SPDX-License-Identifier: Apache-2.0, MIT use fvm_shared::address::Address; use fvm_shared::ActorID; -lazy_static! { - pub static ref SYSTEM_ACTOR_ADDR: Address = Address::new_id(0); - pub static ref INIT_ACTOR_ADDR: Address = Address::new_id(1); - pub static ref REWARD_ACTOR_ADDR: Address = Address::new_id(2); - pub static ref CRON_ACTOR_ADDR: Address = Address::new_id(3); - pub static ref STORAGE_POWER_ACTOR_ADDR: Address = Address::new_id(4); - pub static ref STORAGE_MARKET_ACTOR_ADDR: Address = Address::new_id(5); - pub static ref VERIFIED_REGISTRY_ACTOR_ADDR: Address = Address::new_id(6); +use paste::paste; - pub static ref CHAOS_ACTOR_ADDR: Address = Address::new_id(98); +macro_rules! define_singletons { + ($($name:ident = $id:literal,)*) => { + $( + paste! { + pub const [<$name _ID>]: ActorID = $id; + pub const [<$name _ADDR>]: Address = Address::new_id([<$name _ID>]); + } + )* + } +} - /// Distinguished AccountActor that is the destination of all burnt funds. - pub static ref BURNT_FUNDS_ACTOR_ADDR: Address = Address::new_id(99); +define_singletons! { + SYSTEM_ACTOR = 0, + INIT_ACTOR = 1, + REWARD_ACTOR = 2, + CRON_ACTOR = 3, + STORAGE_POWER_ACTOR = 4, + STORAGE_MARKET_ACTOR = 5, + VERIFIED_REGISTRY_ACTOR = 6, + CHAOS_ACTOR = 98, + BURNT_FUNDS_ACTOR = 99, } /// Defines first available ID address after builtin actors diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index ce322f463..11d7ee901 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -3,6 +3,7 @@ // TODO: disable everything else when not using runtime-wasm +#[allow(unused_imports)] // rust seems to be wrong here #[macro_use] extern crate lazy_static; // workaround for a compiler bug, see https://github.com/rust-lang/rust/issues/55779 diff --git a/test_vm/src/lib.rs b/test_vm/src/lib.rs index 3ff08f70d..a22308d6d 100644 --- a/test_vm/src/lib.rs +++ b/test_vm/src/lib.rs @@ -139,56 +139,50 @@ impl<'bs> VM<'bs> { let sys_st = SystemState::new(store).unwrap(); let sys_head = v.put_store(&sys_st); let sys_value = faucet_total.clone(); // delegate faucet funds to system so we can construct faucet by sending to bls addr - v.set_actor(*SYSTEM_ACTOR_ADDR, actor(*SYSTEM_ACTOR_CODE_ID, sys_head, 0, sys_value)); + v.set_actor(SYSTEM_ACTOR_ADDR, actor(*SYSTEM_ACTOR_CODE_ID, sys_head, 0, sys_value)); // init let init_st = InitState::new(store, "integration-test".to_string()).unwrap(); let init_head = v.put_store(&init_st); - v.set_actor( - *INIT_ACTOR_ADDR, - actor(*INIT_ACTOR_CODE_ID, init_head, 0, TokenAmount::zero()), - ); + v.set_actor(INIT_ACTOR_ADDR, actor(*INIT_ACTOR_CODE_ID, init_head, 0, TokenAmount::zero())); // reward let reward_head = v.put_store(&RewardState::new(StoragePower::zero())); - v.set_actor(*REWARD_ACTOR_ADDR, actor(*REWARD_ACTOR_CODE_ID, reward_head, 0, reward_total)); + v.set_actor(REWARD_ACTOR_ADDR, actor(*REWARD_ACTOR_CODE_ID, reward_head, 0, reward_total)); // cron let builtin_entries = vec![ CronEntry { - receiver: *STORAGE_POWER_ACTOR_ADDR, + receiver: STORAGE_POWER_ACTOR_ADDR, method_num: MethodPower::OnEpochTickEnd as u64, }, CronEntry { - receiver: *STORAGE_MARKET_ACTOR_ADDR, + receiver: STORAGE_MARKET_ACTOR_ADDR, method_num: MarketMethod::CronTick as u64, }, ]; let cron_head = v.put_store(&CronState { entries: builtin_entries }); - v.set_actor( - *CRON_ACTOR_ADDR, - actor(*CRON_ACTOR_CODE_ID, cron_head, 0, TokenAmount::zero()), - ); + v.set_actor(CRON_ACTOR_ADDR, actor(*CRON_ACTOR_CODE_ID, cron_head, 0, TokenAmount::zero())); // power let power_head = v.put_store(&PowerState::new(&v.store).unwrap()); v.set_actor( - *STORAGE_POWER_ACTOR_ADDR, + STORAGE_POWER_ACTOR_ADDR, actor(*POWER_ACTOR_CODE_ID, power_head, 0, TokenAmount::zero()), ); // market let market_head = v.put_store(&MarketState::new(&v.store).unwrap()); v.set_actor( - *STORAGE_MARKET_ACTOR_ADDR, + STORAGE_MARKET_ACTOR_ADDR, actor(*MARKET_ACTOR_CODE_ID, market_head, 0, TokenAmount::zero()), ); // verifreg // initialize verifreg root signer v.apply_message( - *INIT_ACTOR_ADDR, + INIT_ACTOR_ADDR, Address::new_bls(VERIFREG_ROOT_KEY).unwrap(), TokenAmount::zero(), METHOD_SEND, @@ -211,8 +205,8 @@ impl<'bs> VM<'bs> { .unwrap(); let msig_ctor_ret: ExecReturn = v .apply_message( - *SYSTEM_ACTOR_ADDR, - *INIT_ACTOR_ADDR, + SYSTEM_ACTOR_ADDR, + INIT_ACTOR_ADDR, TokenAmount::zero(), fil_actor_init::Method::Exec as u64, fil_actor_init::ExecParams { @@ -229,20 +223,20 @@ impl<'bs> VM<'bs> { // verifreg let verifreg_head = v.put_store(&VerifRegState::new(&v.store, root_msig_addr).unwrap()); v.set_actor( - *VERIFIED_REGISTRY_ACTOR_ADDR, + VERIFIED_REGISTRY_ACTOR_ADDR, actor(*VERIFREG_ACTOR_CODE_ID, verifreg_head, 0, TokenAmount::zero()), ); // burnt funds - let burnt_funds_head = v.put_store(&AccountState { address: *BURNT_FUNDS_ACTOR_ADDR }); + let burnt_funds_head = v.put_store(&AccountState { address: BURNT_FUNDS_ACTOR_ADDR }); v.set_actor( - *BURNT_FUNDS_ACTOR_ADDR, + BURNT_FUNDS_ACTOR_ADDR, actor(*ACCOUNT_ACTOR_CODE_ID, burnt_funds_head, 0, TokenAmount::zero()), ); // create a faucet with 1 billion FIL for setting up test accounts v.apply_message( - *SYSTEM_ACTOR_ADDR, + SYSTEM_ACTOR_ADDR, Address::new_bls(FAUCET_ROOT_KEY).unwrap(), faucet_total, METHOD_SEND, @@ -281,9 +275,9 @@ impl<'bs> VM<'bs> { } pub fn get_network_stats(&self) -> NetworkStats { - let power_state = self.get_state::(*STORAGE_POWER_ACTOR_ADDR).unwrap(); - let reward_state = self.get_state::(*REWARD_ACTOR_ADDR).unwrap(); - let market_state = self.get_state::(*STORAGE_MARKET_ACTOR_ADDR).unwrap(); + let power_state = self.get_state::(STORAGE_POWER_ACTOR_ADDR).unwrap(); + let reward_state = self.get_state::(REWARD_ACTOR_ADDR).unwrap(); + let market_state = self.get_state::(STORAGE_MARKET_ACTOR_ADDR).unwrap(); NetworkStats { total_raw_byte_power: power_state.total_raw_byte_power, @@ -360,7 +354,7 @@ impl<'bs> VM<'bs> { } pub fn normalize_address(&self, addr: &Address) -> Option
{ - let st = self.get_state::(*INIT_ACTOR_ADDR).unwrap(); + let st = self.get_state::(INIT_ACTOR_ADDR).unwrap(); st.resolve_address::(self.store, addr).unwrap() } @@ -562,15 +556,15 @@ impl<'invocation, 'bs> InvocationCtx<'invocation, 'bs> { } _ => (), } - let mut st = self.v.get_state::(*INIT_ACTOR_ADDR).unwrap(); + let mut st = self.v.get_state::(INIT_ACTOR_ADDR).unwrap(); let target_id = st.map_address_to_new_id(self.v.store, target).unwrap(); let target_id_addr = Address::new_id(target_id); - let mut init_actor = self.v.get_actor(*INIT_ACTOR_ADDR).unwrap(); + let mut init_actor = self.v.get_actor(INIT_ACTOR_ADDR).unwrap(); init_actor.head = self.v.store.put_cbor(&st, Code::Blake2b256).unwrap(); - self.v.set_actor(*INIT_ACTOR_ADDR, init_actor); + self.v.set_actor(INIT_ACTOR_ADDR, init_actor); let new_actor_msg = InternalMessage { - from: *SYSTEM_ACTOR_ADDR, + from: SYSTEM_ACTOR_ADDR, to: target_id_addr, value: TokenAmount::zero(), method: METHOD_CONSTRUCTOR, diff --git a/test_vm/src/util.rs b/test_vm/src/util.rs index 7867d1ce6..3fb078ad3 100644 --- a/test_vm/src/util.rs +++ b/test_vm/src/util.rs @@ -110,7 +110,7 @@ pub fn create_miner( let res: CreateMinerReturn = v .apply_message( owner, - *STORAGE_POWER_ACTOR_ADDR, + STORAGE_POWER_ACTOR_ADDR, balance, PowerMethod::CreateMiner as u64, params, @@ -138,12 +138,12 @@ pub fn precommit_sectors( let invocs_common = || -> Vec { vec![ ExpectInvocation { - to: *REWARD_ACTOR_ADDR, + to: REWARD_ACTOR_ADDR, method: RewardMethod::ThisEpochReward as u64, ..Default::default() }, ExpectInvocation { - to: *STORAGE_POWER_ACTOR_ADDR, + to: STORAGE_POWER_ACTOR_ADDR, method: PowerMethod::CurrentTotalPower as u64, ..Default::default() }, @@ -151,14 +151,14 @@ pub fn precommit_sectors( }; let invoc_first = || -> ExpectInvocation { ExpectInvocation { - to: *STORAGE_POWER_ACTOR_ADDR, + to: STORAGE_POWER_ACTOR_ADDR, method: PowerMethod::EnrollCronEvent as u64, ..Default::default() } }; let invoc_net_fee = |fee: TokenAmount| -> ExpectInvocation { ExpectInvocation { - to: *BURNT_FUNDS_ACTOR_ADDR, + to: BURNT_FUNDS_ACTOR_ADDR, method: METHOD_SEND, value: Some(fee), ..Default::default() @@ -270,22 +270,22 @@ pub fn prove_commit_sectors( params: Some(prove_commit_aggregate_params_ser), subinvocs: Some(vec![ ExpectInvocation { - to: *REWARD_ACTOR_ADDR, + to: REWARD_ACTOR_ADDR, method: RewardMethod::ThisEpochReward as u64, ..Default::default() }, ExpectInvocation { - to: *STORAGE_POWER_ACTOR_ADDR, + to: STORAGE_POWER_ACTOR_ADDR, method: PowerMethod::CurrentTotalPower as u64, ..Default::default() }, ExpectInvocation { - to: *STORAGE_POWER_ACTOR_ADDR, + to: STORAGE_POWER_ACTOR_ADDR, method: PowerMethod::UpdatePledgeTotal as u64, ..Default::default() }, ExpectInvocation { - to: *BURNT_FUNDS_ACTOR_ADDR, + to: BURNT_FUNDS_ACTOR_ADDR, method: METHOD_SEND, ..Default::default() }, @@ -359,8 +359,8 @@ where let res = v .apply_message( - *SYSTEM_ACTOR_ADDR, - *CRON_ACTOR_ADDR, + SYSTEM_ACTOR_ADDR, + CRON_ACTOR_ADDR, TokenAmount::zero(), CronMethod::EpochTick as u64, RawBytes::default(), @@ -412,7 +412,7 @@ pub fn sector_info(v: &VM, m: Address, s: SectorNumber) -> SectorOnChainInfo { } pub fn miner_power(v: &VM, m: Address) -> PowerPair { - let st = v.get_state::(*STORAGE_POWER_ACTOR_ADDR).unwrap(); + let st = v.get_state::(STORAGE_POWER_ACTOR_ADDR).unwrap(); let claim = st.get_claim(v.store, &m).unwrap().unwrap(); PowerPair::new(claim.raw_byte_power, claim.quality_adj_power) } @@ -476,7 +476,7 @@ pub fn submit_windowed_post( ) .unwrap(); subinvocs = Some(vec![ExpectInvocation { - to: *STORAGE_POWER_ACTOR_ADDR, + to: STORAGE_POWER_ACTOR_ADDR, method: PowerMethod::UpdateClaimedPower as u64, params: Some(update_power_params), ..Default::default() @@ -517,7 +517,7 @@ pub fn add_verifier(v: &VM, verifier: Address, data_cap: StoragePower) { let add_verifier_params = VerifierParams { address: verifier, allowance: data_cap }; // root address is msig, send proposal from root key let proposal = ProposeParams { - to: *VERIFIED_REGISTRY_ACTOR_ADDR, + to: VERIFIED_REGISTRY_ACTOR_ADDR, value: TokenAmount::zero(), method: VerifregMethod::AddVerifier as u64, params: serialize(&add_verifier_params, "verifreg add verifier params").unwrap(), @@ -532,7 +532,7 @@ pub fn add_verifier(v: &VM, verifier: Address, data_cap: StoragePower) { proposal, ); let verifreg_invoc = ExpectInvocation { - to: *VERIFIED_REGISTRY_ACTOR_ADDR, + to: VERIFIED_REGISTRY_ACTOR_ADDR, method: VerifregMethod::AddVerifier as u64, params: Some(serialize(&add_verifier_params, "verifreg add verifier params").unwrap()), subinvocs: Some(vec![]), @@ -586,7 +586,7 @@ pub fn publish_deal( let ret: PublishStorageDealsReturn = apply_ok( v, provider, - *STORAGE_MARKET_ACTOR_ADDR, + STORAGE_MARKET_ACTOR_ADDR, TokenAmount::zero(), MarketMethod::PublishStorageDeals as u64, publish_params, @@ -601,12 +601,12 @@ pub fn publish_deal( ..Default::default() }, ExpectInvocation { - to: *REWARD_ACTOR_ADDR, + to: REWARD_ACTOR_ADDR, method: RewardMethod::ThisEpochReward as u64, ..Default::default() }, ExpectInvocation { - to: *STORAGE_POWER_ACTOR_ADDR, + to: STORAGE_POWER_ACTOR_ADDR, method: PowerMethod::CurrentTotalPower as u64, ..Default::default() }, @@ -618,13 +618,13 @@ pub fn publish_deal( ]; if verified_deal { expect_publish_invocs.push(ExpectInvocation { - to: *VERIFIED_REGISTRY_ACTOR_ADDR, + to: VERIFIED_REGISTRY_ACTOR_ADDR, method: VerifregMethod::UseBytes as u64, ..Default::default() }) } ExpectInvocation { - to: *STORAGE_MARKET_ACTOR_ADDR, + to: STORAGE_MARKET_ACTOR_ADDR, method: MarketMethod::PublishStorageDeals as u64, subinvocs: Some(expect_publish_invocs), ..Default::default() diff --git a/test_vm/tests/batch_onboarding.rs b/test_vm/tests/batch_onboarding.rs index 38f5f606a..b9b4bcc3e 100644 --- a/test_vm/tests/batch_onboarding.rs +++ b/test_vm/tests/batch_onboarding.rs @@ -143,8 +143,8 @@ fn batch_onboarding() { apply_ok( &v, - *SYSTEM_ACTOR_ADDR, - *CRON_ACTOR_ADDR, + SYSTEM_ACTOR_ADDR, + CRON_ACTOR_ADDR, TokenAmount::zero(), CronMethod::EpochTick as u64, RawBytes::default(), diff --git a/test_vm/tests/commit_post_test.rs b/test_vm/tests/commit_post_test.rs index 4ccb987c8..228745634 100644 --- a/test_vm/tests/commit_post_test.rs +++ b/test_vm/tests/commit_post_test.rs @@ -84,7 +84,7 @@ fn setup(store: &'_ MemoryBlockstore) -> (VM<'_>, MinerInfo, SectorInfo) { method: MinerMethod::ProveCommitSector as u64, params: Some(prove_params_ser), subinvocs: Some(vec![ExpectInvocation { - to: *STORAGE_POWER_ACTOR_ADDR, + to: STORAGE_POWER_ACTOR_ADDR, method: PowerMethod::SubmitPoRepForBulkVerify as u64, ..Default::default() }]), @@ -93,8 +93,8 @@ fn setup(store: &'_ MemoryBlockstore) -> (VM<'_>, MinerInfo, SectorInfo) { .matches(v.take_invocations().last().unwrap()); let res = v .apply_message( - *SYSTEM_ACTOR_ADDR, - *CRON_ACTOR_ADDR, + SYSTEM_ACTOR_ADDR, + CRON_ACTOR_ADDR, TokenAmount::zero(), CronMethod::EpochTick as u64, RawBytes::default(), @@ -102,15 +102,15 @@ fn setup(store: &'_ MemoryBlockstore) -> (VM<'_>, MinerInfo, SectorInfo) { .unwrap(); assert_eq!(ExitCode::OK, res.code); ExpectInvocation { - to: *CRON_ACTOR_ADDR, + to: CRON_ACTOR_ADDR, method: CronMethod::EpochTick as u64, subinvocs: Some(vec![ ExpectInvocation { - to: *STORAGE_POWER_ACTOR_ADDR, + to: STORAGE_POWER_ACTOR_ADDR, method: PowerMethod::OnEpochTickEnd as u64, subinvocs: Some(vec![ ExpectInvocation { - to: *REWARD_ACTOR_ADDR, + to: REWARD_ACTOR_ADDR, method: RewardMethod::ThisEpochReward as u64, ..Default::default() }, @@ -118,14 +118,14 @@ fn setup(store: &'_ MemoryBlockstore) -> (VM<'_>, MinerInfo, SectorInfo) { to: id_addr, method: MinerMethod::ConfirmSectorProofsValid as u64, subinvocs: Some(vec![ExpectInvocation { - to: *STORAGE_POWER_ACTOR_ADDR, + to: STORAGE_POWER_ACTOR_ADDR, method: PowerMethod::UpdatePledgeTotal as u64, ..Default::default() }]), ..Default::default() }, ExpectInvocation { - to: *REWARD_ACTOR_ADDR, + to: REWARD_ACTOR_ADDR, method: RewardMethod::UpdateNetworkKPI as u64, ..Default::default() }, @@ -133,7 +133,7 @@ fn setup(store: &'_ MemoryBlockstore) -> (VM<'_>, MinerInfo, SectorInfo) { ..Default::default() }, ExpectInvocation { - to: *STORAGE_MARKET_ACTOR_ADDR, + to: STORAGE_MARKET_ACTOR_ADDR, method: MarketMethod::CronTick as u64, ..Default::default() }, @@ -185,7 +185,7 @@ fn submit_post_succeeds() { ); let balances = v.get_miner_balance(miner_info.miner_id); assert!(balances.initial_pledge.is_positive()); - let p_st = v.get_state::(*STORAGE_POWER_ACTOR_ADDR).unwrap(); + let p_st = v.get_state::(STORAGE_POWER_ACTOR_ADDR).unwrap(); assert_eq!(sector_power.raw, p_st.total_bytes_committed); v.assert_state_invariants(); @@ -245,24 +245,24 @@ fn missed_first_post_deadline() { apply_ok( &v, - *SYSTEM_ACTOR_ADDR, - *CRON_ACTOR_ADDR, + SYSTEM_ACTOR_ADDR, + CRON_ACTOR_ADDR, TokenAmount::zero(), CronMethod::EpochTick as u64, RawBytes::default(), ); ExpectInvocation { - to: *CRON_ACTOR_ADDR, + to: CRON_ACTOR_ADDR, method: CronMethod::EpochTick as u64, params: None, subinvocs: Some(vec![ ExpectInvocation { - to: *STORAGE_POWER_ACTOR_ADDR, + to: STORAGE_POWER_ACTOR_ADDR, method: PowerMethod::OnEpochTickEnd as u64, subinvocs: Some(vec![ ExpectInvocation { - to: *REWARD_ACTOR_ADDR, + to: REWARD_ACTOR_ADDR, method: RewardMethod::ThisEpochReward as u64, ..Default::default() }, @@ -270,14 +270,14 @@ fn missed_first_post_deadline() { to: miner_info.miner_id, method: MinerMethod::OnDeferredCronEvent as u64, subinvocs: Some(vec![ExpectInvocation { - to: *STORAGE_POWER_ACTOR_ADDR, + to: STORAGE_POWER_ACTOR_ADDR, method: PowerMethod::EnrollCronEvent as u64, ..Default::default() }]), ..Default::default() }, ExpectInvocation { - to: *REWARD_ACTOR_ADDR, + to: REWARD_ACTOR_ADDR, method: RewardMethod::UpdateNetworkKPI as u64, ..Default::default() }, @@ -285,7 +285,7 @@ fn missed_first_post_deadline() { ..Default::default() }, ExpectInvocation { - to: *STORAGE_MARKET_ACTOR_ADDR, + to: STORAGE_MARKET_ACTOR_ADDR, method: MarketMethod::CronTick as u64, ..Default::default() }, @@ -350,24 +350,24 @@ fn overdue_precommit() { // run cron which should clean up precommit apply_ok( &v, - *SYSTEM_ACTOR_ADDR, - *CRON_ACTOR_ADDR, + SYSTEM_ACTOR_ADDR, + CRON_ACTOR_ADDR, TokenAmount::zero(), CronMethod::EpochTick as u64, RawBytes::default(), ); ExpectInvocation { - to: *CRON_ACTOR_ADDR, + to: CRON_ACTOR_ADDR, method: CronMethod::EpochTick as u64, params: None, subinvocs: Some(vec![ ExpectInvocation { - to: *STORAGE_POWER_ACTOR_ADDR, + to: STORAGE_POWER_ACTOR_ADDR, method: PowerMethod::OnEpochTickEnd as u64, subinvocs: Some(vec![ ExpectInvocation { - to: *REWARD_ACTOR_ADDR, + to: REWARD_ACTOR_ADDR, method: RewardMethod::ThisEpochReward as u64, ..Default::default() }, @@ -377,7 +377,7 @@ fn overdue_precommit() { subinvocs: Some(vec![ ExpectInvocation { // The call to burnt funds indicates the overdue precommit has been penalized - to: *BURNT_FUNDS_ACTOR_ADDR, + to: BURNT_FUNDS_ACTOR_ADDR, method: METHOD_SEND, value: Option::from(precommit.pre_commit_deposit), ..Default::default() @@ -387,7 +387,7 @@ fn overdue_precommit() { ..Default::default() }, ExpectInvocation { - to: *REWARD_ACTOR_ADDR, + to: REWARD_ACTOR_ADDR, method: RewardMethod::UpdateNetworkKPI as u64, ..Default::default() }, @@ -395,7 +395,7 @@ fn overdue_precommit() { ..Default::default() }, ExpectInvocation { - to: *STORAGE_MARKET_ACTOR_ADDR, + to: STORAGE_MARKET_ACTOR_ADDR, method: MarketMethod::CronTick as u64, ..Default::default() }, @@ -808,22 +808,22 @@ fn aggregate_one_precommit_expires() { params: Some(prove_params_ser), subinvocs: Some(vec![ ExpectInvocation { - to: *REWARD_ACTOR_ADDR, + to: REWARD_ACTOR_ADDR, method: RewardMethod::ThisEpochReward as u64, ..Default::default() }, ExpectInvocation { - to: *STORAGE_POWER_ACTOR_ADDR, + to: STORAGE_POWER_ACTOR_ADDR, method: PowerMethod::CurrentTotalPower as u64, ..Default::default() }, ExpectInvocation { - to: *STORAGE_POWER_ACTOR_ADDR, + to: STORAGE_POWER_ACTOR_ADDR, method: PowerMethod::UpdatePledgeTotal as u64, ..Default::default() }, ExpectInvocation { - to: *BURNT_FUNDS_ACTOR_ADDR, + to: BURNT_FUNDS_ACTOR_ADDR, method: METHOD_SEND, ..Default::default() }, diff --git a/test_vm/tests/extend_sectors_test.rs b/test_vm/tests/extend_sectors_test.rs index 6f4a8c964..a86af038e 100644 --- a/test_vm/tests/extend_sectors_test.rs +++ b/test_vm/tests/extend_sectors_test.rs @@ -65,7 +65,7 @@ fn extend_sector_with_deals() { apply_ok( &v, verifier, - *VERIFIED_REGISTRY_ACTOR_ADDR, + VERIFIED_REGISTRY_ACTOR_ADDR, TokenAmount::zero(), VerifregMethod::AddVerifiedClient as u64, add_client_params, @@ -76,7 +76,7 @@ fn extend_sector_with_deals() { apply_ok( &v, verified_client, - *STORAGE_MARKET_ACTOR_ADDR, + STORAGE_MARKET_ACTOR_ADDR, collateral.clone(), MarketMethod::AddBalance as u64, verified_client, @@ -85,7 +85,7 @@ fn extend_sector_with_deals() { apply_ok( &v, worker, - *STORAGE_MARKET_ACTOR_ADDR, + STORAGE_MARKET_ACTOR_ADDR, collateral, MarketMethod::AddBalance as u64, miner_id, @@ -153,8 +153,8 @@ fn extend_sector_with_deals() { // In the same epoch, trigger cron to validate prove commit apply_ok( &v, - *SYSTEM_ACTOR_ADDR, - *CRON_ACTOR_ADDR, + SYSTEM_ACTOR_ADDR, + CRON_ACTOR_ADDR, TokenAmount::zero(), CronMethod::EpochTick as u64, RawBytes::default(), @@ -240,7 +240,7 @@ fn extend_sector_with_deals() { to: miner_id, method: MinerMethod::ExtendSectorExpiration as u64, subinvocs: Some(vec![ExpectInvocation { - to: *STORAGE_POWER_ACTOR_ADDR, + to: STORAGE_POWER_ACTOR_ADDR, method: PowerMethod::UpdateClaimedPower as u64, params: Some(expected_update_claimed_power_params_ser), ..Default::default() @@ -291,7 +291,7 @@ fn extend_sector_with_deals() { to: miner_id, method: MinerMethod::ExtendSectorExpiration as u64, subinvocs: Some(vec![ExpectInvocation { - to: *STORAGE_POWER_ACTOR_ADDR, + to: STORAGE_POWER_ACTOR_ADDR, method: PowerMethod::UpdateClaimedPower as u64, params: Some(expected_update_claimed_power_params_ser), ..Default::default() diff --git a/test_vm/tests/market_miner_withdrawal_test.rs b/test_vm/tests/market_miner_withdrawal_test.rs index 632e8802d..dd9c37b2a 100644 --- a/test_vm/tests/market_miner_withdrawal_test.rs +++ b/test_vm/tests/market_miner_withdrawal_test.rs @@ -32,7 +32,7 @@ mod market_tests { three_fil.clone(), three_fil.clone(), three_fil, - *STORAGE_MARKET_ACTOR_ADDR, + STORAGE_MARKET_ACTOR_ADDR, caller, ); } @@ -50,7 +50,7 @@ mod market_tests { two_fil.clone(), two_fil, three_fil, - *STORAGE_MARKET_ACTOR_ADDR, + STORAGE_MARKET_ACTOR_ADDR, caller, ); } @@ -67,7 +67,7 @@ mod market_tests { TokenAmount::zero(), TokenAmount::zero(), three_fil, - *STORAGE_MARKET_ACTOR_ADDR, + STORAGE_MARKET_ACTOR_ADDR, caller, ); } diff --git a/test_vm/tests/multisig_test.rs b/test_vm/tests/multisig_test.rs index 8cc5e2591..8f5c07f61 100644 --- a/test_vm/tests/multisig_test.rs +++ b/test_vm/tests/multisig_test.rs @@ -26,14 +26,14 @@ fn test_proposal_hash() { let addrs = create_accounts(&v, 3, TokenAmount::from_whole(10_000)); let alice = addrs[0]; let bob = addrs[1]; - let sys_act_start_bal = v.get_actor(*SYSTEM_ACTOR_ADDR).unwrap().balance; + let sys_act_start_bal = v.get_actor(SYSTEM_ACTOR_ADDR).unwrap().balance; let msig_addr = create_msig(&v, addrs, 2); // fund msig and propose send funds to system actor let fil_delta = TokenAmount::from_nano(3); let propose_send_sys_params = ProposeParams { - to: *SYSTEM_ACTOR_ADDR, + to: SYSTEM_ACTOR_ADDR, value: fil_delta.clone(), method: METHOD_SEND, params: RawBytes::default(), @@ -48,7 +48,7 @@ fn test_proposal_hash() { ); let wrong_tx = Transaction { - to: *SYSTEM_ACTOR_ADDR, + to: SYSTEM_ACTOR_ADDR, value: &fil_delta - TokenAmount::from_atto(1), // incorrect send amount not consistent with proposal method: METHOD_SEND, approved: vec![alice], @@ -67,7 +67,7 @@ fn test_proposal_hash() { ); let correct_tx = Transaction { - to: *SYSTEM_ACTOR_ADDR, + to: SYSTEM_ACTOR_ADDR, value: fil_delta.clone(), method: METHOD_SEND, approved: vec![alice], @@ -89,12 +89,12 @@ fn test_proposal_hash() { method: MsigMethod::Approve as u64, subinvocs: Some(vec![ // Tx goes through to fund the system actor - ExpectInvocation { to: *SYSTEM_ACTOR_ADDR, method: METHOD_SEND, ..Default::default() }, + ExpectInvocation { to: SYSTEM_ACTOR_ADDR, method: METHOD_SEND, ..Default::default() }, ]), ..Default::default() }; expect.matches(v.take_invocations().last().unwrap()); - assert_eq!(sys_act_start_bal + fil_delta, v.get_actor(*SYSTEM_ACTOR_ADDR).unwrap().balance); + assert_eq!(sys_act_start_bal + fil_delta, v.get_actor(SYSTEM_ACTOR_ADDR).unwrap().balance); v.assert_state_invariants(); } @@ -288,7 +288,7 @@ fn create_msig(v: &VM, signers: Vec
, threshold: u64) -> Address { let msig_ctor_ret: ExecReturn = apply_ok( v, signers[0], - *INIT_ACTOR_ADDR, + INIT_ACTOR_ADDR, TokenAmount::zero(), fil_actor_init::Method::Exec as u64, fil_actor_init::ExecParams { diff --git a/test_vm/tests/power_scenario_tests.rs b/test_vm/tests/power_scenario_tests.rs index 7512b1faa..fd4dbba70 100644 --- a/test_vm/tests/power_scenario_tests.rs +++ b/test_vm/tests/power_scenario_tests.rs @@ -52,7 +52,7 @@ fn create_miner_test() { let res = v .apply_message( owner, - *STORAGE_POWER_ACTOR_ADDR, + STORAGE_POWER_ACTOR_ADDR, TokenAmount::from_atto(1000u32), PowerMethod::CreateMiner as u64, params.clone(), @@ -61,14 +61,14 @@ fn create_miner_test() { let expect = ExpectInvocation { // send to power actor - to: *STORAGE_POWER_ACTOR_ADDR, + to: STORAGE_POWER_ACTOR_ADDR, method: PowerMethod::CreateMiner as u64, params: Some(serialize(¶ms, "power create miner params").unwrap()), ret: Some(res.ret), subinvocs: Some(vec![ // request init actor construct miner ExpectInvocation { - to: *INIT_ACTOR_ADDR, + to: INIT_ACTOR_ADDR, method: InitMethod::Exec as u64, subinvocs: Some(vec![ExpectInvocation { // init then calls miner constructor @@ -151,8 +151,8 @@ fn test_cron_tick() { // run cron and expect a call to miner and a call to update reward actor params apply_ok( &v, - *CRON_ACTOR_ADDR, - *STORAGE_POWER_ACTOR_ADDR, + CRON_ACTOR_ADDR, + STORAGE_POWER_ACTOR_ADDR, TokenAmount::zero(), PowerMethod::OnEpochTickEnd as u64, RawBytes::default(), @@ -161,20 +161,20 @@ fn test_cron_tick() { // expect miner call to be missing ExpectInvocation { // original send to storage power actor - to: *STORAGE_POWER_ACTOR_ADDR, + to: STORAGE_POWER_ACTOR_ADDR, method: PowerMethod::OnEpochTickEnd as u64, subinvocs: Some(vec![ // get data from reward actor for any eventual calls to confirmsectorproofsparams ExpectInvocation { - to: *REWARD_ACTOR_ADDR, + to: REWARD_ACTOR_ADDR, method: RewardMethod::ThisEpochReward as u64, ..Default::default() }, // expect call to reward to update kpi ExpectInvocation { - to: *REWARD_ACTOR_ADDR, + to: REWARD_ACTOR_ADDR, method: RewardMethod::UpdateNetworkKPI as u64, - from: Some(*STORAGE_POWER_ACTOR_ADDR), + from: Some(STORAGE_POWER_ACTOR_ADDR), ..Default::default() }, ]), @@ -188,8 +188,8 @@ fn test_cron_tick() { // run cron and expect a call to miner and a a call to update reward actor params apply_ok( &v, - *CRON_ACTOR_ADDR, - *STORAGE_POWER_ACTOR_ADDR, + CRON_ACTOR_ADDR, + STORAGE_POWER_ACTOR_ADDR, TokenAmount::zero(), PowerMethod::OnEpochTickEnd as u64, RawBytes::default(), @@ -198,7 +198,7 @@ fn test_cron_tick() { let sub_invocs = vec![ // get data from reward and power for any eventual calls to confirmsectorproofsvalid ExpectInvocation { - to: *REWARD_ACTOR_ADDR, + to: REWARD_ACTOR_ADDR, method: RewardMethod::ThisEpochReward as u64, ..Default::default() }, @@ -206,15 +206,15 @@ fn test_cron_tick() { ExpectInvocation { to: id_addr, method: MinerMethod::OnDeferredCronEvent as u64, - from: Some(*STORAGE_POWER_ACTOR_ADDR), + from: Some(STORAGE_POWER_ACTOR_ADDR), value: Some(TokenAmount::zero()), ..Default::default() }, // expect call to reward to update kpi ExpectInvocation { - to: *REWARD_ACTOR_ADDR, + to: REWARD_ACTOR_ADDR, method: RewardMethod::UpdateNetworkKPI as u64, - from: Some(*STORAGE_POWER_ACTOR_ADDR), + from: Some(STORAGE_POWER_ACTOR_ADDR), ..Default::default() }, ]; @@ -222,7 +222,7 @@ fn test_cron_tick() { // expect call to miner ExpectInvocation { // original send to storage power actor - to: *STORAGE_POWER_ACTOR_ADDR, + to: STORAGE_POWER_ACTOR_ADDR, method: PowerMethod::OnEpochTickEnd as u64, subinvocs: Some(sub_invocs), ..Default::default() diff --git a/test_vm/tests/publish_deals_test.rs b/test_vm/tests/publish_deals_test.rs index aa48526dd..06eae0cce 100644 --- a/test_vm/tests/publish_deals_test.rs +++ b/test_vm/tests/publish_deals_test.rs @@ -81,7 +81,7 @@ fn setup(store: &'_ MemoryBlockstore) -> (VM<'_>, Addrs, ChainEpoch) { apply_ok( &v, verifier, - *VERIFIED_REGISTRY_ACTOR_ADDR, + VERIFIED_REGISTRY_ACTOR_ADDR, TokenAmount::zero(), VerifregMethod::AddVerifiedClient as u64, add_client_params, @@ -91,7 +91,7 @@ fn setup(store: &'_ MemoryBlockstore) -> (VM<'_>, Addrs, ChainEpoch) { apply_ok( &v, client1, - *STORAGE_MARKET_ACTOR_ADDR, + STORAGE_MARKET_ACTOR_ADDR, client_collateral.clone(), MarketMethod::AddBalance as u64, client1, @@ -99,7 +99,7 @@ fn setup(store: &'_ MemoryBlockstore) -> (VM<'_>, Addrs, ChainEpoch) { apply_ok( &v, client2, - *STORAGE_MARKET_ACTOR_ADDR, + STORAGE_MARKET_ACTOR_ADDR, client_collateral.clone(), MarketMethod::AddBalance as u64, client2, @@ -107,7 +107,7 @@ fn setup(store: &'_ MemoryBlockstore) -> (VM<'_>, Addrs, ChainEpoch) { apply_ok( &v, verified_client, - *STORAGE_MARKET_ACTOR_ADDR, + STORAGE_MARKET_ACTOR_ADDR, client_collateral, MarketMethod::AddBalance as u64, verified_client, @@ -117,7 +117,7 @@ fn setup(store: &'_ MemoryBlockstore) -> (VM<'_>, Addrs, ChainEpoch) { apply_ok( &v, worker, - *STORAGE_MARKET_ACTOR_ADDR, + STORAGE_MARKET_ACTOR_ADDR, miner_collateral, MarketMethod::AddBalance as u64, maddr, @@ -239,7 +239,7 @@ fn psd_not_enought_client_lockup_for_batch() { apply_ok( &v, a.cheap_client, - *STORAGE_MARKET_ACTOR_ADDR, + STORAGE_MARKET_ACTOR_ADDR, one_lifetime_cost, MarketMethod::AddBalance as u64, a.cheap_client, @@ -279,7 +279,7 @@ fn psd_not_enough_provider_lockup_for_batch() { apply_ok( &v, cheap_worker, - *STORAGE_MARKET_ACTOR_ADDR, + STORAGE_MARKET_ACTOR_ADDR, default_provider_collateral, MarketMethod::AddBalance as u64, cheap_maddr, @@ -402,7 +402,7 @@ fn psd_random_assortment_of_failures() { apply_ok( &v, a.cheap_client, - *STORAGE_MARKET_ACTOR_ADDR, + STORAGE_MARKET_ACTOR_ADDR, one_lifetime_cost, MarketMethod::AddBalance as u64, a.cheap_client, @@ -524,7 +524,7 @@ fn psd_bad_sig() { let ret = v .apply_message( a.worker, - *STORAGE_MARKET_ACTOR_ADDR, + STORAGE_MARKET_ACTOR_ADDR, TokenAmount::zero(), MarketMethod::PublishStorageDeals as u64, publish_params, @@ -533,7 +533,7 @@ fn psd_bad_sig() { assert_eq!(ExitCode::USR_ILLEGAL_ARGUMENT, ret.code); ExpectInvocation { - to: *STORAGE_MARKET_ACTOR_ADDR, + to: STORAGE_MARKET_ACTOR_ADDR, method: MarketMethod::PublishStorageDeals as u64, subinvocs: Some(vec![ ExpectInvocation { @@ -542,12 +542,12 @@ fn psd_bad_sig() { ..Default::default() }, ExpectInvocation { - to: *REWARD_ACTOR_ADDR, + to: REWARD_ACTOR_ADDR, method: RewardMethod::ThisEpochReward as u64, ..Default::default() }, ExpectInvocation { - to: *STORAGE_POWER_ACTOR_ADDR, + to: STORAGE_POWER_ACTOR_ADDR, method: PowerMethod::CurrentTotalPower as u64, ..Default::default() }, @@ -710,7 +710,7 @@ impl<'bs> DealBatcher<'bs> { let ret: PublishStorageDealsReturn = apply_ok( self.v, sender, - *STORAGE_MARKET_ACTOR_ADDR, + STORAGE_MARKET_ACTOR_ADDR, TokenAmount::zero(), MarketMethod::PublishStorageDeals as u64, publish_params, @@ -737,7 +737,7 @@ impl<'bs> DealBatcher<'bs> { .v .apply_message( sender, - *STORAGE_MARKET_ACTOR_ADDR, + STORAGE_MARKET_ACTOR_ADDR, TokenAmount::zero(), MarketMethod::PublishStorageDeals as u64, publish_params, diff --git a/test_vm/tests/replica_update_test.rs b/test_vm/tests/replica_update_test.rs index f074cd412..44a3929d4 100644 --- a/test_vm/tests/replica_update_test.rs +++ b/test_vm/tests/replica_update_test.rs @@ -886,8 +886,8 @@ fn deal_included_in_multiple_sectors_failure() { // In the same epoch, trigger cron to validate prove commit apply_ok( &v, - *SYSTEM_ACTOR_ADDR, - *CRON_ACTOR_ADDR, + SYSTEM_ACTOR_ADDR, + CRON_ACTOR_ADDR, TokenAmount::zero(), CronMethod::EpochTick as u64, RawBytes::default(), @@ -1061,8 +1061,8 @@ fn create_sector( ); let res = v .apply_message( - *SYSTEM_ACTOR_ADDR, - *CRON_ACTOR_ADDR, + SYSTEM_ACTOR_ADDR, + CRON_ACTOR_ADDR, TokenAmount::zero(), CronMethod::EpochTick as u64, RawBytes::default(), @@ -1120,7 +1120,7 @@ fn create_deals_frac( apply_ok( v, client, - *STORAGE_MARKET_ACTOR_ADDR, + STORAGE_MARKET_ACTOR_ADDR, collateral.clone(), MarketMethod::AddBalance as u64, client, @@ -1128,7 +1128,7 @@ fn create_deals_frac( apply_ok( v, worker, - *STORAGE_MARKET_ACTOR_ADDR, + STORAGE_MARKET_ACTOR_ADDR, collateral, MarketMethod::AddBalance as u64, maddr, diff --git a/test_vm/tests/terminate_test.rs b/test_vm/tests/terminate_test.rs index 36ddff82e..14561fa0a 100644 --- a/test_vm/tests/terminate_test.rs +++ b/test_vm/tests/terminate_test.rs @@ -64,7 +64,7 @@ fn terminate_sectors() { apply_ok( &v, verifier, - *VERIFIED_REGISTRY_ACTOR_ADDR, + VERIFIED_REGISTRY_ACTOR_ADDR, TokenAmount::zero(), VerifregMethod::AddVerifiedClient as u64, add_client_params, @@ -75,7 +75,7 @@ fn terminate_sectors() { apply_ok( &v, unverified_client, - *STORAGE_MARKET_ACTOR_ADDR, + STORAGE_MARKET_ACTOR_ADDR, collateral.clone(), MarketMethod::AddBalance as u64, unverified_client, @@ -83,7 +83,7 @@ fn terminate_sectors() { apply_ok( &v, verified_client, - *STORAGE_MARKET_ACTOR_ADDR, + STORAGE_MARKET_ACTOR_ADDR, collateral, MarketMethod::AddBalance as u64, verified_client, @@ -93,7 +93,7 @@ fn terminate_sectors() { apply_ok( &v, worker, - *STORAGE_MARKET_ACTOR_ADDR, + STORAGE_MARKET_ACTOR_ADDR, miner_collateral.clone(), MarketMethod::AddBalance as u64, id_addr, @@ -147,15 +147,15 @@ fn terminate_sectors() { let res = v .apply_message( - *SYSTEM_ACTOR_ADDR, - *CRON_ACTOR_ADDR, + SYSTEM_ACTOR_ADDR, + CRON_ACTOR_ADDR, TokenAmount::zero(), CronMethod::EpochTick as u64, RawBytes::default(), ) .unwrap(); assert_eq!(ExitCode::OK, res.code); - let st = v.get_state::(*STORAGE_MARKET_ACTOR_ADDR).unwrap(); + let st = v.get_state::(STORAGE_MARKET_ACTOR_ADDR).unwrap(); let deal_states = DealMetaArray::load(&st.states, v.store).unwrap(); for id in deal_ids.iter() { // deals are pending and don't yet have deal states @@ -194,8 +194,8 @@ fn terminate_sectors() { ); let res = v .apply_message( - *SYSTEM_ACTOR_ADDR, - *CRON_ACTOR_ADDR, + SYSTEM_ACTOR_ADDR, + CRON_ACTOR_ADDR, TokenAmount::zero(), CronMethod::EpochTick as u64, RawBytes::default(), @@ -211,8 +211,8 @@ fn terminate_sectors() { let v = v.with_epoch(dline_info.last()); v.apply_message( - *SYSTEM_ACTOR_ADDR, - *CRON_ACTOR_ADDR, + SYSTEM_ACTOR_ADDR, + CRON_ACTOR_ADDR, TokenAmount::zero(), CronMethod::EpochTick as u64, RawBytes::default(), @@ -232,7 +232,7 @@ fn terminate_sectors() { ); // market cron updates deal states indication deals are no longer pending - let st = v.get_state::(*STORAGE_MARKET_ACTOR_ADDR).unwrap(); + let st = v.get_state::(STORAGE_MARKET_ACTOR_ADDR).unwrap(); let deal_states = DealMetaArray::load(&st.states, v.store).unwrap(); for id in deal_ids.iter() { let state = deal_states.get(*id).unwrap().unwrap(); @@ -260,32 +260,32 @@ fn terminate_sectors() { method: MinerMethod::TerminateSectors as u64, subinvocs: Some(vec![ ExpectInvocation { - to: *REWARD_ACTOR_ADDR, + to: REWARD_ACTOR_ADDR, method: RewardMethod::ThisEpochReward as u64, ..Default::default() }, ExpectInvocation { - to: *STORAGE_POWER_ACTOR_ADDR, + to: STORAGE_POWER_ACTOR_ADDR, method: PowerMethod::CurrentTotalPower as u64, ..Default::default() }, ExpectInvocation { - to: *BURNT_FUNDS_ACTOR_ADDR, + to: BURNT_FUNDS_ACTOR_ADDR, method: METHOD_SEND, ..Default::default() }, ExpectInvocation { - to: *STORAGE_POWER_ACTOR_ADDR, + to: STORAGE_POWER_ACTOR_ADDR, method: PowerMethod::UpdatePledgeTotal as u64, ..Default::default() }, ExpectInvocation { - to: *STORAGE_MARKET_ACTOR_ADDR, + to: STORAGE_MARKET_ACTOR_ADDR, method: MarketMethod::OnMinerSectorsTerminate as u64, ..Default::default() }, ExpectInvocation { - to: *STORAGE_POWER_ACTOR_ADDR, + to: STORAGE_POWER_ACTOR_ADDR, method: PowerMethod::UpdateClaimedPower as u64, ..Default::default() }, @@ -298,7 +298,7 @@ fn terminate_sectors() { assert!(miner_balances.initial_pledge.is_zero()); assert!(miner_balances.pre_commit_deposit.is_zero()); - let pow_st = v.get_state::(*STORAGE_POWER_ACTOR_ADDR).unwrap(); + let pow_st = v.get_state::(STORAGE_POWER_ACTOR_ADDR).unwrap(); assert_eq!(0, pow_st.miner_above_min_power_count); assert!(pow_st.total_raw_byte_power.is_zero()); assert!(pow_st.total_quality_adj_power.is_zero()); @@ -308,7 +308,7 @@ fn terminate_sectors() { // termination slashes deals in market state let termination_epoch = v.get_epoch(); - let st = v.get_state::(*STORAGE_MARKET_ACTOR_ADDR).unwrap(); + let st = v.get_state::(STORAGE_MARKET_ACTOR_ADDR).unwrap(); let deal_states = DealMetaArray::load(&st.states, v.store).unwrap(); for id in deal_ids.iter() { let state = deal_states.get(*id).unwrap().unwrap(); @@ -328,13 +328,13 @@ fn terminate_sectors() { apply_ok( &v, verified_client, - *STORAGE_MARKET_ACTOR_ADDR, + STORAGE_MARKET_ACTOR_ADDR, TokenAmount::zero(), MarketMethod::WithdrawBalance as u64, WithdrawBalanceParams { provider_or_client: verified_client, amount: withdrawal.clone() }, ); ExpectInvocation { - to: *STORAGE_MARKET_ACTOR_ADDR, + to: STORAGE_MARKET_ACTOR_ADDR, method: MarketMethod::WithdrawBalance as u64, subinvocs: Some(vec![ExpectInvocation { to: verified_client, @@ -349,7 +349,7 @@ fn terminate_sectors() { apply_ok( &v, worker, - *STORAGE_MARKET_ACTOR_ADDR, + STORAGE_MARKET_ACTOR_ADDR, TokenAmount::zero(), MarketMethod::WithdrawBalance as u64, WithdrawBalanceParams { provider_or_client: id_addr, amount: miner_collateral }, diff --git a/test_vm/tests/verifreg_remove_datacap_test.rs b/test_vm/tests/verifreg_remove_datacap_test.rs index f6ce95e74..95d10b313 100644 --- a/test_vm/tests/verifreg_remove_datacap_test.rs +++ b/test_vm/tests/verifreg_remove_datacap_test.rs @@ -43,14 +43,14 @@ fn remove_datacap_simple_successful_path() { apply_ok( &v, verifier1, - *VERIFIED_REGISTRY_ACTOR_ADDR, + VERIFIED_REGISTRY_ACTOR_ADDR, TokenAmount::zero(), VerifregMethod::AddVerifiedClient as u64, add_verified_client_params, ); ExpectInvocation { - to: *VERIFIED_REGISTRY_ACTOR_ADDR, + to: VERIFIED_REGISTRY_ACTOR_ADDR, method: VerifregMethod::AddVerifiedClient as u64, params: Some(add_verified_client_params_ser), subinvocs: Some(vec![]), @@ -59,7 +59,7 @@ fn remove_datacap_simple_successful_path() { .matches(v.take_invocations().last().unwrap()); // state checks on the 2 verifiers and the client - let mut v_st = v.get_state::(*VERIFIED_REGISTRY_ACTOR_ADDR).unwrap(); + let mut v_st = v.get_state::(VERIFIED_REGISTRY_ACTOR_ADDR).unwrap(); let verifiers = make_map_with_root_and_bitwidth::<_, BigIntDe>(&v_st.verifiers, &store, HAMT_BIT_WIDTH) .unwrap(); @@ -140,7 +140,7 @@ fn remove_datacap_simple_successful_path() { let remove_datacap_ret: RemoveDataCapReturn = apply_ok( &v, TEST_VERIFREG_ROOT_ADDR, - *VERIFIED_REGISTRY_ACTOR_ADDR, + VERIFIED_REGISTRY_ACTOR_ADDR, TokenAmount::zero(), VerifregMethod::RemoveVerifiedClientDataCap as u64, remove_datacap_params, @@ -149,7 +149,7 @@ fn remove_datacap_simple_successful_path() { .unwrap(); ExpectInvocation { - to: *VERIFIED_REGISTRY_ACTOR_ADDR, + to: VERIFIED_REGISTRY_ACTOR_ADDR, method: VerifregMethod::RemoveVerifiedClientDataCap as u64, params: Some(remove_datacap_params_ser), subinvocs: Some(vec![]), @@ -160,7 +160,7 @@ fn remove_datacap_simple_successful_path() { assert_eq!(verified_client_id_addr, remove_datacap_ret.verified_client); assert_eq!(allowance_to_remove, remove_datacap_ret.data_cap_removed); - v_st = v.get_state::(*VERIFIED_REGISTRY_ACTOR_ADDR).unwrap(); + v_st = v.get_state::(VERIFIED_REGISTRY_ACTOR_ADDR).unwrap(); // confirm client's allowance has fallen by half verified_clients = make_map_with_root_and_bitwidth::<_, BigIntDe>( @@ -234,7 +234,7 @@ fn remove_datacap_simple_successful_path() { let remove_datacap_ret: RemoveDataCapReturn = apply_ok( &v, TEST_VERIFREG_ROOT_ADDR, - *VERIFIED_REGISTRY_ACTOR_ADDR, + VERIFIED_REGISTRY_ACTOR_ADDR, TokenAmount::zero(), VerifregMethod::RemoveVerifiedClientDataCap as u64, remove_datacap_params, @@ -243,7 +243,7 @@ fn remove_datacap_simple_successful_path() { .unwrap(); ExpectInvocation { - to: *VERIFIED_REGISTRY_ACTOR_ADDR, + to: VERIFIED_REGISTRY_ACTOR_ADDR, method: VerifregMethod::RemoveVerifiedClientDataCap as u64, params: Some(remove_datacap_params_ser), subinvocs: Some(vec![]), @@ -256,7 +256,7 @@ fn remove_datacap_simple_successful_path() { // confirm client has been removed entirely - v_st = v.get_state::(*VERIFIED_REGISTRY_ACTOR_ADDR).unwrap(); + v_st = v.get_state::(VERIFIED_REGISTRY_ACTOR_ADDR).unwrap(); verified_clients = make_map_with_root_and_bitwidth::<_, BigIntDe>( &v_st.verified_clients, &store,