@@ -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 ,
@@ -4937,11 +4960,11 @@ impl ActorCode for Actor {
4937
4960
let res = Self :: control_addresses ( rt) ?;
4938
4961
Ok ( RawBytes :: serialize ( & res) ?)
4939
4962
}
4940
- Some ( Method :: ChangeWorkerAddress ) => {
4963
+ Some ( Method :: ChangeWorkerAddress ) | Some ( Method :: ChangeWorkerAddressExported ) => {
4941
4964
Self :: change_worker_address ( rt, cbor:: deserialize_params ( params) ?) ?;
4942
4965
Ok ( RawBytes :: default ( ) )
4943
4966
}
4944
- Some ( Method :: ChangePeerID ) => {
4967
+ Some ( Method :: ChangePeerID ) | Some ( Method :: ChangePeerIDExported ) => {
4945
4968
Self :: change_peer_id ( rt, cbor:: deserialize_params ( params) ?) ?;
4946
4969
Ok ( RawBytes :: default ( ) )
4947
4970
}
@@ -4989,15 +5012,15 @@ impl ActorCode for Actor {
4989
5012
Self :: report_consensus_fault ( rt, cbor:: deserialize_params ( params) ?) ?;
4990
5013
Ok ( RawBytes :: default ( ) )
4991
5014
}
4992
- Some ( Method :: WithdrawBalance ) => {
5015
+ Some ( Method :: WithdrawBalance ) | Some ( Method :: WithdrawBalanceExported ) => {
4993
5016
let res = Self :: withdraw_balance ( rt, cbor:: deserialize_params ( params) ?) ?;
4994
5017
Ok ( RawBytes :: serialize ( & res) ?)
4995
5018
}
4996
5019
Some ( Method :: ConfirmSectorProofsValid ) => {
4997
5020
Self :: confirm_sector_proofs_valid ( rt, cbor:: deserialize_params ( params) ?) ?;
4998
5021
Ok ( RawBytes :: default ( ) )
4999
5022
}
5000
- Some ( Method :: ChangeMultiaddrs ) => {
5023
+ Some ( Method :: ChangeMultiaddrs ) | Some ( Method :: ChangeMultiaddrsExported ) => {
5001
5024
Self :: change_multiaddresses ( rt, cbor:: deserialize_params ( params) ?) ?;
5002
5025
Ok ( RawBytes :: default ( ) )
5003
5026
}
@@ -5009,15 +5032,16 @@ impl ActorCode for Actor {
5009
5032
Self :: compact_sector_numbers ( rt, cbor:: deserialize_params ( params) ?) ?;
5010
5033
Ok ( RawBytes :: default ( ) )
5011
5034
}
5012
- Some ( Method :: ConfirmUpdateWorkerKey ) => {
5013
- Self :: confirm_update_worker_key ( rt) ?;
5035
+ Some ( Method :: ConfirmChangeWorkerAddress )
5036
+ | Some ( Method :: ConfirmChangeWorkerAddressExported ) => {
5037
+ Self :: confirm_change_worker_address ( rt) ?;
5014
5038
Ok ( RawBytes :: default ( ) )
5015
5039
}
5016
- Some ( Method :: RepayDebt ) => {
5040
+ Some ( Method :: RepayDebt ) | Some ( Method :: RepayDebtExported ) => {
5017
5041
Self :: repay_debt ( rt) ?;
5018
5042
Ok ( RawBytes :: default ( ) )
5019
5043
}
5020
- Some ( Method :: ChangeOwnerAddress ) => {
5044
+ Some ( Method :: ChangeOwnerAddress ) | Some ( Method :: ChangeOwnerAddressExported ) => {
5021
5045
Self :: change_owner_address ( rt, cbor:: deserialize_params ( params) ?) ?;
5022
5046
Ok ( RawBytes :: default ( ) )
5023
5047
}
@@ -5078,6 +5102,14 @@ impl ActorCode for Actor {
5078
5102
let res = Self :: get_vesting_funds ( rt) ?;
5079
5103
Ok ( RawBytes :: serialize ( res) ?)
5080
5104
}
5105
+ Some ( Method :: GetPeerIDExported ) => {
5106
+ let res = Self :: get_peer_id ( rt) ?;
5107
+ Ok ( RawBytes :: serialize ( res) ?)
5108
+ }
5109
+ Some ( Method :: GetMultiaddrsExported ) => {
5110
+ let res = Self :: get_multiaddresses ( rt) ?;
5111
+ Ok ( RawBytes :: serialize ( res) ?)
5112
+ }
5081
5113
}
5082
5114
}
5083
5115
}
0 commit comments