Skip to content

Commit 63c5033

Browse files
authored
Change runtime address parameters to a reference (#581)
1 parent 3d98e82 commit 63c5033

File tree

14 files changed

+44
-43
lines changed

14 files changed

+44
-43
lines changed

actors/cron/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ impl Actor {
6565
for entry in st.entries {
6666
// Intentionally ignore any error when calling cron methods
6767
let res = rt.send(
68-
entry.receiver,
68+
&entry.receiver,
6969
entry.method_num,
7070
RawBytes::default(),
7171
TokenAmount::from(0u8),

actors/init/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ impl Actor {
9696

9797
// Invoke constructor
9898
rt.send(
99-
Address::new_id(id_address),
99+
&Address::new_id(id_address),
100100
METHOD_CONSTRUCTOR,
101101
params.constructor_params,
102102
rt.message().value_received(),

actors/market/src/lib.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ where
6161
RT: Runtime<BS>,
6262
{
6363
let ret = rt.send(
64-
Address::new_id(miner_id),
64+
&Address::new_id(miner_id),
6565
ext::miner::CONTROL_ADDRESSES_METHOD,
6666
RawBytes::default(),
6767
TokenAmount::zero(),
@@ -207,7 +207,7 @@ impl Actor {
207207
Ok(ex)
208208
})?;
209209

210-
rt.send(recipient, METHOD_SEND, RawBytes::default(), amount_extracted.clone())?;
210+
rt.send(&recipient, METHOD_SEND, RawBytes::default(), amount_extracted.clone())?;
211211

212212
Ok(WithdrawBalanceReturn { amount_withdrawn: amount_extracted })
213213
}
@@ -374,7 +374,7 @@ impl Actor {
374374
// drop deals with a DealSize that cannot be fully covered by VerifiedClient's available DataCap
375375
if deal.proposal.verified_deal {
376376
if let Err(e) = rt.send(
377-
*VERIFIED_REGISTRY_ACTOR_ADDR,
377+
&VERIFIED_REGISTRY_ACTOR_ADDR,
378378
crate::ext::verifreg::USE_BYTES_METHOD as u64,
379379
RawBytes::serialize(UseBytesParams {
380380
address: Address::new_id(client_id),
@@ -1028,7 +1028,7 @@ impl Actor {
10281028

10291029
for d in timed_out_verified_deals {
10301030
let res = rt.send(
1031-
*VERIFIED_REGISTRY_ACTOR_ADDR,
1031+
&VERIFIED_REGISTRY_ACTOR_ADDR,
10321032
ext::verifreg::RESTORE_BYTES_METHOD,
10331033
RawBytes::serialize(ext::verifreg::RestoreBytesParams {
10341034
address: d.client,
@@ -1050,7 +1050,7 @@ impl Actor {
10501050
}
10511051

10521052
if !amount_slashed.is_zero() {
1053-
rt.send(*BURNT_FUNDS_ACTOR_ADDR, METHOD_SEND, RawBytes::default(), amount_slashed)?;
1053+
rt.send(&BURNT_FUNDS_ACTOR_ADDR, METHOD_SEND, RawBytes::default(), amount_slashed)?;
10541054
}
10551055
Ok(())
10561056
}
@@ -1343,7 +1343,7 @@ where
13431343
RT: Runtime<BS>,
13441344
{
13451345
let rwret = rt.send(
1346-
*REWARD_ACTOR_ADDR,
1346+
&REWARD_ACTOR_ADDR,
13471347
ext::reward::THIS_EPOCH_REWARD_METHOD,
13481348
RawBytes::default(),
13491349
0.into(),
@@ -1362,7 +1362,7 @@ where
13621362
RT: Runtime<BS>,
13631363
{
13641364
let rwret = rt.send(
1365-
*STORAGE_POWER_ACTOR_ADDR,
1365+
&STORAGE_POWER_ACTOR_ADDR,
13661366
ext::power::CURRENT_TOTAL_POWER_METHOD,
13671367
RawBytes::default(),
13681368
0.into(),

actors/miner/src/lib.rs

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,7 +1053,7 @@ impl Actor {
10531053
}
10541054

10551055
let res = rt.send(
1056-
*STORAGE_MARKET_ACTOR_ADDR,
1056+
&STORAGE_MARKET_ACTOR_ADDR,
10571057
ext::market::ACTIVATE_DEALS_METHOD,
10581058
RawBytes::serialize(ext::market::ActivateDealsParams {
10591059
deal_ids: update.deals.clone(),
@@ -1583,7 +1583,8 @@ impl Actor {
15831583

15841584
request_update_power(rt, power_delta)?;
15851585
if !to_reward.is_zero() {
1586-
if let Err(e) = rt.send(reporter, METHOD_SEND, RawBytes::default(), to_reward.clone()) {
1586+
if let Err(e) = rt.send(&reporter, METHOD_SEND, RawBytes::default(), to_reward.clone())
1587+
{
15871588
error!("failed to send reward: {}", e);
15881589
to_burn += to_reward;
15891590
}
@@ -2028,7 +2029,7 @@ impl Actor {
20282029
)?;
20292030

20302031
rt.send(
2031-
*STORAGE_POWER_ACTOR_ADDR,
2032+
&STORAGE_POWER_ACTOR_ADDR,
20322033
ext::power::SUBMIT_POREP_FOR_BULK_VERIFY_METHOD,
20332034
RawBytes::serialize(&svi)?,
20342035
BigInt::zero(),
@@ -3221,7 +3222,7 @@ impl Actor {
32213222
Ok((burn_amount, reward_amount))
32223223
})?;
32233224

3224-
if let Err(e) = rt.send(reporter, METHOD_SEND, RawBytes::default(), reward_amount) {
3225+
if let Err(e) = rt.send(&reporter, METHOD_SEND, RawBytes::default(), reward_amount) {
32253226
error!("failed to send reward: {}", e);
32263227
}
32273228

@@ -3316,7 +3317,7 @@ impl Actor {
33163317
})?;
33173318

33183319
if amount_withdrawn.is_positive() {
3319-
rt.send(info.beneficiary, METHOD_SEND, RawBytes::default(), amount_withdrawn.clone())?;
3320+
rt.send(&info.beneficiary, METHOD_SEND, RawBytes::default(), amount_withdrawn.clone())?;
33203321
}
33213322

33223323
burn_funds(rt, fee_to_burn)?;
@@ -3927,7 +3928,7 @@ where
39273928
let ser_params =
39283929
serialize(&ext::power::EnrollCronEventParams { event_epoch, payload }, "cron params")?;
39293930
rt.send(
3930-
*STORAGE_POWER_ACTOR_ADDR,
3931+
&STORAGE_POWER_ACTOR_ADDR,
39313932
ext::power::ENROLL_CRON_EVENT_METHOD,
39323933
ser_params,
39333934
TokenAmount::zero(),
@@ -3948,7 +3949,7 @@ where
39483949
let delta_clone = delta.clone();
39493950

39503951
rt.send(
3951-
*STORAGE_POWER_ACTOR_ADDR,
3952+
&STORAGE_POWER_ACTOR_ADDR,
39523953
ext::power::UPDATE_CLAIMED_POWER_METHOD,
39533954
RawBytes::serialize(ext::power::UpdateClaimedPowerParams {
39543955
raw_byte_delta: delta.raw,
@@ -3974,7 +3975,7 @@ where
39743975

39753976
for chunk in deal_ids.chunks(MAX_LENGTH) {
39763977
rt.send(
3977-
*STORAGE_MARKET_ACTOR_ADDR,
3978+
&STORAGE_MARKET_ACTOR_ADDR,
39783979
ext::market::ON_MINER_SECTORS_TERMINATE_METHOD,
39793980
RawBytes::serialize(ext::market::OnMinerSectorsTerminateParamsRef {
39803981
epoch,
@@ -4120,7 +4121,7 @@ where
41204121
}
41214122

41224123
let serialized = rt.send(
4123-
*STORAGE_MARKET_ACTOR_ADDR,
4124+
&STORAGE_MARKET_ACTOR_ADDR,
41244125
ext::market::VERIFY_DEALS_FOR_ACTIVATION_METHOD,
41254126
RawBytes::serialize(ext::market::VerifyDealsForActivationParamsRef { sectors })?,
41264127
TokenAmount::zero(),
@@ -4140,7 +4141,7 @@ where
41404141
{
41414142
let ret = rt
41424143
.send(
4143-
*REWARD_ACTOR_ADDR,
4144+
&REWARD_ACTOR_ADDR,
41444145
ext::reward::THIS_EPOCH_REWARD_METHOD,
41454146
Default::default(),
41464147
TokenAmount::zero(),
@@ -4161,7 +4162,7 @@ where
41614162
{
41624163
let ret = rt
41634164
.send(
4164-
*STORAGE_POWER_ACTOR_ADDR,
4165+
&STORAGE_POWER_ACTOR_ADDR,
41654166
ext::power::CURRENT_TOTAL_POWER_METHOD,
41664167
Default::default(),
41674168
TokenAmount::zero(),
@@ -4227,7 +4228,7 @@ where
42274228

42284229
if raw.protocol() != Protocol::BLS {
42294230
let ret = rt.send(
4230-
Address::new_id(resolved),
4231+
&Address::new_id(resolved),
42314232
ext::account::PUBKEY_ADDRESS_METHOD,
42324233
RawBytes::default(),
42334234
TokenAmount::zero(),
@@ -4252,7 +4253,7 @@ where
42524253
{
42534254
log::debug!("storage provder {} burning {}", rt.message().receiver(), amount);
42544255
if amount.is_positive() {
4255-
rt.send(*BURNT_FUNDS_ACTOR_ADDR, METHOD_SEND, RawBytes::default(), amount)?;
4256+
rt.send(&BURNT_FUNDS_ACTOR_ADDR, METHOD_SEND, RawBytes::default(), amount)?;
42564257
}
42574258
Ok(())
42584259
}
@@ -4264,7 +4265,7 @@ where
42644265
{
42654266
if !pledge_delta.is_zero() {
42664267
rt.send(
4267-
*STORAGE_POWER_ACTOR_ADDR,
4268+
&STORAGE_POWER_ACTOR_ADDR,
42684269
ext::power::UPDATE_PLEDGE_TOTAL_METHOD,
42694270
RawBytes::serialize(BigIntSer(pledge_delta))?,
42704271
TokenAmount::zero(),
@@ -4554,7 +4555,7 @@ where
45544555
let deal_weights = if !pre_commit.info.deal_ids.is_empty() {
45554556
// Check (and activate) storage deals associated to sector. Abort if checks failed.
45564557
let res = rt.send(
4557-
*STORAGE_MARKET_ACTOR_ADDR,
4558+
&STORAGE_MARKET_ACTOR_ADDR,
45584559
ext::market::ACTIVATE_DEALS_METHOD,
45594560
RawBytes::serialize(ext::market::ActivateDealsParams {
45604561
deal_ids: pre_commit.info.deal_ids.clone(),

actors/multisig/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ where
561561
st.check_available(rt.current_balance(), &txn.value, rt.curr_epoch())
562562
.map_err(|e| actor_error!(insufficient_funds, "insufficient funds unlocked: {}", e))?;
563563

564-
match rt.send(txn.to, txn.method, txn.params.clone(), txn.value.clone()) {
564+
match rt.send(&txn.to, txn.method, txn.params.clone(), txn.value.clone()) {
565565
Ok(ser) => {
566566
out = ser;
567567
}

actors/paych/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ impl Actor {
176176
}
177177

178178
if let Some(extra) = &sv.extra {
179-
rt.send(extra.actor, extra.method, extra.data.clone(), TokenAmount::from(0u8))
179+
rt.send(&extra.actor, extra.method, extra.data.clone(), TokenAmount::from(0u8))
180180
.map_err(|e| e.wrap("spend voucher verification failed"))?;
181181
}
182182

@@ -313,7 +313,7 @@ impl Actor {
313313
}
314314

315315
// send ToSend to `to`
316-
rt.send(st.to, METHOD_SEND, RawBytes::default(), st.to_send)
316+
rt.send(&st.to, METHOD_SEND, RawBytes::default(), st.to_send)
317317
.map_err(|e| e.wrap("Failed to send funds to `to` address"))?;
318318

319319
// the remaining balance will be returned to "From" upon deletion.

actors/power/src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ impl Actor {
107107
let miner_actor_code_cid = rt.get_code_cid_for_type(Type::Miner);
108108
let ext::init::ExecReturn { id_address, robust_address } = rt
109109
.send(
110-
*INIT_ACTOR_ADDR,
110+
&INIT_ACTOR_ADDR,
111111
ext::init::EXEC_METHOD,
112112
RawBytes::serialize(init::ExecParams {
113113
code_cid: miner_actor_code_cid,
@@ -253,7 +253,7 @@ impl Actor {
253253

254254
let rewret: ThisEpochRewardReturn = rt
255255
.send(
256-
*REWARD_ACTOR_ADDR,
256+
&REWARD_ACTOR_ADDR,
257257
ext::reward::Method::ThisEpochReward as MethodNum,
258258
RawBytes::default(),
259259
TokenAmount::zero(),
@@ -279,7 +279,7 @@ impl Actor {
279279

280280
// Update network KPA in reward actor
281281
rt.send(
282-
*REWARD_ACTOR_ADDR,
282+
&REWARD_ACTOR_ADDR,
283283
ext::reward::UPDATE_NETWORK_KPI,
284284
this_epoch_raw_byte_power?,
285285
TokenAmount::from(0_u32),
@@ -513,7 +513,7 @@ impl Actor {
513513
continue;
514514
}
515515
if let Err(e) = rt.send(
516-
m,
516+
&m,
517517
ext::miner::CONFIRM_SECTOR_PROOFS_VALID_METHOD,
518518
RawBytes::serialize(&ext::miner::ConfirmSectorProofsParams {
519519
sectors: successful,
@@ -608,7 +608,7 @@ impl Actor {
608608
quality_adj_power_smoothed: st.this_epoch_qa_power_smoothed.clone(),
609609
})?;
610610
let res = rt.send(
611-
event.miner_addr,
611+
&event.miner_addr,
612612
ext::miner::ON_DEFERRED_CRON_EVENT_METHOD,
613613
params,
614614
Default::default(),

actors/reward/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ impl Actor {
159159
// if this fails, we can assume the miner is responsible and avoid failing here.
160160
let reward_params = ext::miner::ApplyRewardParams { reward: total_reward.clone(), penalty };
161161
let res = rt.send(
162-
Address::new_id(miner_id),
162+
&Address::new_id(miner_id),
163163
ext::miner::APPLY_REWARDS_METHOD,
164164
RawBytes::serialize(&reward_params)?,
165165
total_reward.clone(),
@@ -171,7 +171,7 @@ impl Actor {
171171
e.exit_code()
172172
);
173173
let res =
174-
rt.send(*BURNT_FUNDS_ACTOR_ADDR, METHOD_SEND, RawBytes::default(), total_reward);
174+
rt.send(&BURNT_FUNDS_ACTOR_ADDR, METHOD_SEND, RawBytes::default(), total_reward);
175175
if let Err(e) = res {
176176
error!(
177177
"failed to send unsent reward to the burnt funds actor, code: {:?}",

runtime/src/builtin/shared.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ where
3131
}
3232

3333
// send 0 balance to the account so an ID address for it is created and then try to resolve
34-
rt.send(*address, METHOD_SEND, Default::default(), Default::default())
34+
rt.send(address, METHOD_SEND, Default::default(), Default::default())
3535
.map_err(|e| e.wrap(&format!("failed to send zero balance to address {}", address)))?;
3636

3737
if let Some(id) = rt.resolve_address(address) {

runtime/src/runtime/fvm.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,15 +281,15 @@ where
281281

282282
fn send(
283283
&self,
284-
to: Address,
284+
to: &Address,
285285
method: MethodNum,
286286
params: RawBytes,
287287
value: TokenAmount,
288288
) -> Result<RawBytes, ActorError> {
289289
if self.in_transaction {
290290
return Err(actor_error!(assertion_failed; "send is not allowed during transaction"));
291291
}
292-
match fvm::send::send(&to, method, params, value) {
292+
match fvm::send::send(to, method, params, value) {
293293
Ok(ret) => {
294294
if ret.exit_code.is_success() {
295295
Ok(ret.return_data)

0 commit comments

Comments
 (0)