@@ -112,7 +112,7 @@ pub enum Method {
112112 ChangeMultiaddrs = 18 ,
113113 CompactPartitions = 19 ,
114114 CompactSectorNumbers = 20 ,
115- ConfirmUpdateWorkerKey = 21 ,
115+ ConfirmChangeWorkerAddress = 21 ,
116116 RepayDebt = 22 ,
117117 ChangeOwnerAddress = 23 ,
118118 DisputeWindowedPoSt = 24 ,
@@ -125,13 +125,22 @@ pub enum Method {
125125 GetBeneficiary = 31 ,
126126 ExtendSectorExpiration2 = 32 ,
127127 // 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" ) ,
128135 ChangeBenificiaryExported = frc42_dispatch:: method_hash!( "ChangeBeneficiary" ) ,
129136 GetBeneficiaryExported = frc42_dispatch:: method_hash!( "GetBeneficiary" ) ,
130137 GetOwnerExported = frc42_dispatch:: method_hash!( "GetOwner" ) ,
131138 IsControllingAddressExported = frc42_dispatch:: method_hash!( "IsControllingAddress" ) ,
132139 GetSectorSizeExported = frc42_dispatch:: method_hash!( "GetSectorSize" ) ,
133140 GetAvailableBalanceExported = frc42_dispatch:: method_hash!( "GetAvailableBalance" ) ,
134141 GetVestingFundsExported = frc42_dispatch:: method_hash!( "GetVestingFunds" ) ,
142+ GetPeerIDExported = frc42_dispatch:: method_hash!( "GetPeerID" ) ,
143+ GetMultiaddrsExported = frc42_dispatch:: method_hash!( "GetMultiaddrs" ) ,
135144}
136145
137146pub const ERR_BALANCE_INVARIANTS_BROKEN : ExitCode = ExitCode :: new ( 1000 ) ;
@@ -344,7 +353,7 @@ impl Actor {
344353 }
345354
346355 /// 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 > {
348357 rt. transaction ( |state : & mut State , rt| {
349358 let mut info = get_miner_info ( rt. store ( ) , state) ?;
350359
@@ -413,6 +422,13 @@ impl Actor {
413422 } )
414423 }
415424
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+
416432 fn change_peer_id ( rt : & mut impl Runtime , params : ChangePeerIDParams ) -> Result < ( ) , ActorError > {
417433 let policy = rt. policy ( ) ;
418434 check_peer_info ( policy, & params. new_id , & [ ] ) ?;
@@ -434,6 +450,13 @@ impl Actor {
434450 Ok ( ( ) )
435451 }
436452
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+
437460 fn change_multiaddresses (
438461 rt : & mut impl Runtime ,
439462 params : ChangeMultiaddrsParams ,
@@ -4937,11 +4960,11 @@ impl ActorCode for Actor {
49374960 let res = Self :: control_addresses ( rt) ?;
49384961 Ok ( RawBytes :: serialize ( & res) ?)
49394962 }
4940- Some ( Method :: ChangeWorkerAddress ) => {
4963+ Some ( Method :: ChangeWorkerAddress ) | Some ( Method :: ChangeWorkerAddressExported ) => {
49414964 Self :: change_worker_address ( rt, cbor:: deserialize_params ( params) ?) ?;
49424965 Ok ( RawBytes :: default ( ) )
49434966 }
4944- Some ( Method :: ChangePeerID ) => {
4967+ Some ( Method :: ChangePeerID ) | Some ( Method :: ChangePeerIDExported ) => {
49454968 Self :: change_peer_id ( rt, cbor:: deserialize_params ( params) ?) ?;
49464969 Ok ( RawBytes :: default ( ) )
49474970 }
@@ -4989,15 +5012,15 @@ impl ActorCode for Actor {
49895012 Self :: report_consensus_fault ( rt, cbor:: deserialize_params ( params) ?) ?;
49905013 Ok ( RawBytes :: default ( ) )
49915014 }
4992- Some ( Method :: WithdrawBalance ) => {
5015+ Some ( Method :: WithdrawBalance ) | Some ( Method :: WithdrawBalanceExported ) => {
49935016 let res = Self :: withdraw_balance ( rt, cbor:: deserialize_params ( params) ?) ?;
49945017 Ok ( RawBytes :: serialize ( & res) ?)
49955018 }
49965019 Some ( Method :: ConfirmSectorProofsValid ) => {
49975020 Self :: confirm_sector_proofs_valid ( rt, cbor:: deserialize_params ( params) ?) ?;
49985021 Ok ( RawBytes :: default ( ) )
49995022 }
5000- Some ( Method :: ChangeMultiaddrs ) => {
5023+ Some ( Method :: ChangeMultiaddrs ) | Some ( Method :: ChangeMultiaddrsExported ) => {
50015024 Self :: change_multiaddresses ( rt, cbor:: deserialize_params ( params) ?) ?;
50025025 Ok ( RawBytes :: default ( ) )
50035026 }
@@ -5009,15 +5032,16 @@ impl ActorCode for Actor {
50095032 Self :: compact_sector_numbers ( rt, cbor:: deserialize_params ( params) ?) ?;
50105033 Ok ( RawBytes :: default ( ) )
50115034 }
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) ?;
50145038 Ok ( RawBytes :: default ( ) )
50155039 }
5016- Some ( Method :: RepayDebt ) => {
5040+ Some ( Method :: RepayDebt ) | Some ( Method :: RepayDebtExported ) => {
50175041 Self :: repay_debt ( rt) ?;
50185042 Ok ( RawBytes :: default ( ) )
50195043 }
5020- Some ( Method :: ChangeOwnerAddress ) => {
5044+ Some ( Method :: ChangeOwnerAddress ) | Some ( Method :: ChangeOwnerAddressExported ) => {
50215045 Self :: change_owner_address ( rt, cbor:: deserialize_params ( params) ?) ?;
50225046 Ok ( RawBytes :: default ( ) )
50235047 }
@@ -5078,6 +5102,14 @@ impl ActorCode for Actor {
50785102 let res = Self :: get_vesting_funds ( rt) ?;
50795103 Ok ( RawBytes :: serialize ( res) ?)
50805104 }
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+ }
50815113 }
50825114 }
50835115}
0 commit comments