@@ -112,7 +112,7 @@ pub enum Method {
112
112
ChangeMultiaddrs = 18 ,
113
113
CompactPartitions = 19 ,
114
114
CompactSectorNumbers = 20 ,
115
- ConfirmUpdateWorkerKey = 21 ,
115
+ ConfirmChangeWorkerAddress = 21 ,
116
116
RepayDebt = 22 ,
117
117
ChangeOwnerAddress = 23 ,
118
118
DisputeWindowedPoSt = 24 ,
@@ -125,13 +125,22 @@ pub enum Method {
125
125
GetBeneficiary = 31 ,
126
126
ExtendSectorExpiration2 = 32 ,
127
127
// Method numbers derived from FRC-0042 standards
128
+ ChangeWorkerAddressExported = frc42_dispatch:: method_hash!( "ChangeWorkerAddress" ) ,
129
+ ChangePeerIDExported = frc42_dispatch:: method_hash!( "ChangePeerID" ) ,
130
+ WithdrawBalanceExported = frc42_dispatch:: method_hash!( "WithdrawBalance" ) ,
131
+ ChangeMultiaddrsExported = frc42_dispatch:: method_hash!( "ChangeMultiaddrs" ) ,
132
+ ConfirmChangeWorkerAddressExported = frc42_dispatch:: method_hash!( "ConfirmChangeWorkerAddress" ) ,
133
+ RepayDebtExported = frc42_dispatch:: method_hash!( "RepayDebt" ) ,
134
+ ChangeOwnerAddressExported = frc42_dispatch:: method_hash!( "ChangeOwnerAddress" ) ,
128
135
ChangeBenificiaryExported = frc42_dispatch:: method_hash!( "ChangeBeneficiary" ) ,
129
136
GetBeneficiaryExported = frc42_dispatch:: method_hash!( "GetBeneficiary" ) ,
130
137
GetOwnerExported = frc42_dispatch:: method_hash!( "GetOwner" ) ,
131
138
IsControllingAddressExported = frc42_dispatch:: method_hash!( "IsControllingAddress" ) ,
132
139
GetSectorSizeExported = frc42_dispatch:: method_hash!( "GetSectorSize" ) ,
133
140
GetAvailableBalanceExported = frc42_dispatch:: method_hash!( "GetAvailableBalance" ) ,
134
141
GetVestingFundsExported = frc42_dispatch:: method_hash!( "GetVestingFunds" ) ,
142
+ GetPeerIDExported = frc42_dispatch:: method_hash!( "GetPeerID" ) ,
143
+ GetMultiaddrsExported = frc42_dispatch:: method_hash!( "GetMultiaddrs" ) ,
135
144
}
136
145
137
146
pub const ERR_BALANCE_INVARIANTS_BROKEN : ExitCode = ExitCode :: new ( 1000 ) ;
@@ -344,7 +353,7 @@ impl Actor {
344
353
}
345
354
346
355
/// Triggers a worker address change if a change has been requested and its effective epoch has arrived.
347
- fn confirm_update_worker_key ( rt : & mut impl Runtime ) -> Result < ( ) , ActorError > {
356
+ fn confirm_change_worker_address ( rt : & mut impl Runtime ) -> Result < ( ) , ActorError > {
348
357
rt. transaction ( |state : & mut State , rt| {
349
358
let mut info = get_miner_info ( rt. store ( ) , state) ?;
350
359
@@ -413,6 +422,13 @@ impl Actor {
413
422
} )
414
423
}
415
424
425
+ fn get_peer_id ( rt : & mut impl Runtime ) -> Result < GetPeerIDReturn , ActorError > {
426
+ rt. validate_immediate_caller_accept_any ( ) ?;
427
+ let state: State = rt. state ( ) ?;
428
+ let peer_id = get_miner_info ( rt. store ( ) , & state) ?. peer_id ;
429
+ Ok ( GetPeerIDReturn { peer_id } )
430
+ }
431
+
416
432
fn change_peer_id ( rt : & mut impl Runtime , params : ChangePeerIDParams ) -> Result < ( ) , ActorError > {
417
433
let policy = rt. policy ( ) ;
418
434
check_peer_info ( policy, & params. new_id , & [ ] ) ?;
@@ -434,6 +450,13 @@ impl Actor {
434
450
Ok ( ( ) )
435
451
}
436
452
453
+ fn get_multiaddresses ( rt : & mut impl Runtime ) -> Result < GetMultiaddrsReturn , ActorError > {
454
+ rt. validate_immediate_caller_accept_any ( ) ?;
455
+ let state: State = rt. state ( ) ?;
456
+ let multi_addrs = get_miner_info ( rt. store ( ) , & state) ?. multi_address ;
457
+ Ok ( GetMultiaddrsReturn { multi_addrs } )
458
+ }
459
+
437
460
fn change_multiaddresses (
438
461
rt : & mut impl Runtime ,
439
462
params : ChangeMultiaddrsParams ,
@@ -4936,11 +4959,11 @@ impl ActorCode for Actor {
4936
4959
let res = Self :: control_addresses ( rt) ?;
4937
4960
Ok ( RawBytes :: serialize ( & res) ?)
4938
4961
}
4939
- Some ( Method :: ChangeWorkerAddress ) => {
4962
+ Some ( Method :: ChangeWorkerAddress ) | Some ( Method :: ChangeWorkerAddressExported ) => {
4940
4963
Self :: change_worker_address ( rt, cbor:: deserialize_params ( params) ?) ?;
4941
4964
Ok ( RawBytes :: default ( ) )
4942
4965
}
4943
- Some ( Method :: ChangePeerID ) => {
4966
+ Some ( Method :: ChangePeerID ) | Some ( Method :: ChangePeerIDExported ) => {
4944
4967
Self :: change_peer_id ( rt, cbor:: deserialize_params ( params) ?) ?;
4945
4968
Ok ( RawBytes :: default ( ) )
4946
4969
}
@@ -4988,15 +5011,15 @@ impl ActorCode for Actor {
4988
5011
Self :: report_consensus_fault ( rt, cbor:: deserialize_params ( params) ?) ?;
4989
5012
Ok ( RawBytes :: default ( ) )
4990
5013
}
4991
- Some ( Method :: WithdrawBalance ) => {
5014
+ Some ( Method :: WithdrawBalance ) | Some ( Method :: WithdrawBalanceExported ) => {
4992
5015
let res = Self :: withdraw_balance ( rt, cbor:: deserialize_params ( params) ?) ?;
4993
5016
Ok ( RawBytes :: serialize ( & res) ?)
4994
5017
}
4995
5018
Some ( Method :: ConfirmSectorProofsValid ) => {
4996
5019
Self :: confirm_sector_proofs_valid ( rt, cbor:: deserialize_params ( params) ?) ?;
4997
5020
Ok ( RawBytes :: default ( ) )
4998
5021
}
4999
- Some ( Method :: ChangeMultiaddrs ) => {
5022
+ Some ( Method :: ChangeMultiaddrs ) | Some ( Method :: ChangeMultiaddrsExported ) => {
5000
5023
Self :: change_multiaddresses ( rt, cbor:: deserialize_params ( params) ?) ?;
5001
5024
Ok ( RawBytes :: default ( ) )
5002
5025
}
@@ -5008,15 +5031,16 @@ impl ActorCode for Actor {
5008
5031
Self :: compact_sector_numbers ( rt, cbor:: deserialize_params ( params) ?) ?;
5009
5032
Ok ( RawBytes :: default ( ) )
5010
5033
}
5011
- Some ( Method :: ConfirmUpdateWorkerKey ) => {
5012
- Self :: confirm_update_worker_key ( rt) ?;
5034
+ Some ( Method :: ConfirmChangeWorkerAddress )
5035
+ | Some ( Method :: ConfirmChangeWorkerAddressExported ) => {
5036
+ Self :: confirm_change_worker_address ( rt) ?;
5013
5037
Ok ( RawBytes :: default ( ) )
5014
5038
}
5015
- Some ( Method :: RepayDebt ) => {
5039
+ Some ( Method :: RepayDebt ) | Some ( Method :: RepayDebtExported ) => {
5016
5040
Self :: repay_debt ( rt) ?;
5017
5041
Ok ( RawBytes :: default ( ) )
5018
5042
}
5019
- Some ( Method :: ChangeOwnerAddress ) => {
5043
+ Some ( Method :: ChangeOwnerAddress ) | Some ( Method :: ChangeOwnerAddressExported ) => {
5020
5044
Self :: change_owner_address ( rt, cbor:: deserialize_params ( params) ?) ?;
5021
5045
Ok ( RawBytes :: default ( ) )
5022
5046
}
@@ -5077,6 +5101,14 @@ impl ActorCode for Actor {
5077
5101
let res = Self :: get_vesting_funds ( rt) ?;
5078
5102
Ok ( RawBytes :: serialize ( res) ?)
5079
5103
}
5104
+ Some ( Method :: GetPeerIDExported ) => {
5105
+ let res = Self :: get_peer_id ( rt) ?;
5106
+ Ok ( RawBytes :: serialize ( res) ?)
5107
+ }
5108
+ Some ( Method :: GetMultiaddrsExported ) => {
5109
+ let res = Self :: get_multiaddresses ( rt) ?;
5110
+ Ok ( RawBytes :: serialize ( res) ?)
5111
+ }
5080
5112
}
5081
5113
}
5082
5114
}
0 commit comments