Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIP-0050: API between user-programmed actors and built-in actors #1004

Merged
merged 26 commits into from
Jan 12, 2023

Conversation

arajasek
Copy link
Contributor

@arajasek arajasek commented Jan 9, 2023

This PR lands the implementation of FIP-0050 into master, now that the FIP has been Accepted.

All the work in this PR has already been reviewed in individual PRs (see commits), but a comprehensive examination may still be warranted.

anorth and others added 25 commits December 11, 2022 10:37
* Export Datacap Actor methods

* Export Init Actor methods

* Export Market Actor methods

* Export Miner Actor methods

* Export Multisig Actor methods

* Export Verifreg Actor methods

* Address review
* Power actor: Add exported getters for raw power

* FRC-XXXX is FRC-0042

* Power actor: network_raw_power: Return this_epoch_raw_byte_power

* Power actor: miner_raw_power: Return whether above consensus min power

* Power actor: types: serialize one-element structs transparently

* Address review

* Miner actor: Add exported getters for info and monies (#811)

* Miner actor: Add exported getters for info and monies

* Tweak comment

* Miner actor: Replace GetWorker and GetControls with IsControllingAddress

* Miner actor: Add exported GetAvailableBalance

* Miner actor: Add exported GetVestingFunds

* Miner actor: Remove exported monies getters

* Miner actor: types: serialize one-element structs transparently

* Address review

* Address review
* Market actor: GetDealTermExported: Return (start_epoch, duration)

* Market actor: Export getter for deal total price
…#824)

* Paych actor: Drop account req, use AuthenticateMessage to verify sigs

* Address review

* Address review
* Miner: Export ChangeWorkerAddress

* Miner: Export ChangePeerID

* Miner: Export WithdrawBalance

* Miner: Export ChangeMultiaddrs

* Miner: Export ConfirmUpdateWorkerKey

* Miner: Export RepayDebt

* Miner: Export ChangeOwnerAddress

* Miner: Add exported getters for PeerID & multiaddrs

* Miner: Refactor: Rename ConfirmUpdateWorkerKey to ConfirmChangeWorkerAddress
* Power: Export CreateMiner

* Power Actor: Export MinerCount and MinerConsensusCount

* Update actors/power/src/lib.rs

Co-authored-by: Alex <[email protected]>

Co-authored-by: Alex <[email protected]>
* Verifreg: Rename AddVerifierClientParams to AddVerifiedClientParams

* Verifreg: Export AddVerifiedClient and GetClaims
* Datacap: Export Mint and Destroy

* Datacap actor: Deprecate all internal methods

* Datacap actor: Rename BalanceOf to Balance

* Datacap actor: Add Granularity method
Co-authored-by: zenground0 <[email protected]>
@arajasek arajasek requested a review from anorth January 9, 2023 23:08
@anorth anorth requested a review from ZenGround0 January 9, 2023 23:40
actors/account/tests/account_actor_test.rs Outdated Show resolved Hide resolved
actors/account/src/lib.rs Show resolved Hide resolved
actors/datacap/src/lib.rs Outdated Show resolved Hide resolved
actors/datacap/tests/datacap_actor_test.rs Show resolved Hide resolved
// Method numbers derived from FRC-0042 standards
AddBalanceExported = frc42_dispatch::method_hash!("AddBalance"),
WithdrawBalanceExported = frc42_dispatch::method_hash!("WithdrawBalance"),
PublishStorageDealsExported = frc42_dispatch::method_hash!("PublishStorageDeals"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flagging the same thing from a previous review that people will probably try to use this in the wrong way if it remains exported. This can only be called by a control address of the provider SP. This can be forced to work in user-contract accessible ways since control addresses can be evm actors but the constraints are weird and not good UX.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, but I think it's a result of the system being somewhat confusing (eg. clients not being able to PSDs today). I'd rather document the gotcha-UX and export the functionality, than keep it unexported for now.

One concern I have with our circumspect approach to exporting methods in this FIP is that we might be stifling innovation before it can begin. I agree that people are going to be confused by the behaviour here (even if we document it well), but my thought is that we need to hear that feedback, have a dialogue with users, and receive suggestions in order to drive the improvements we need.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having a dialogue with builders is obviously an essential thing that's going to drive builtin actor api design. But we should consider not starting the dialogue with phrases that we agree are going to confuse them.

actors/market/tests/deal_api_test.rs Outdated Show resolved Hide resolved
actors/market/tests/deal_api_test.rs Outdated Show resolved Hide resolved
actors/market/tests/market_actor_test.rs Show resolved Hide resolved
@codecov-commenter
Copy link

Codecov Report

Merging #1004 (d0b8828) into master (feaeea1) will decrease coverage by 0.02%.
The diff coverage is 94.66%.

❗ Current head d0b8828 differs from pull request most recent head 7dd4eb6. Consider uploading reports for the commit 7dd4eb6 to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1004      +/-   ##
==========================================
- Coverage   89.20%   89.17%   -0.03%     
==========================================
  Files          92       93       +1     
  Lines       19580    19565      -15     
==========================================
- Hits        17466    17448      -18     
- Misses       2114     2117       +3     
Impacted Files Coverage Δ
actors/market/src/ext.rs 100.00% <ø> (ø)
actors/power/src/ext.rs 83.33% <ø> (ø)
actors/verifreg/src/types.rs 100.00% <ø> (ø)
runtime/src/lib.rs 88.00% <ø> (ø)
runtime/src/test_utils.rs 81.78% <77.27%> (-1.39%) ⬇️
actors/power/src/state.rs 83.49% <79.16%> (+4.73%) ⬆️
actors/miner/src/lib.rs 82.95% <87.15%> (-0.47%) ⬇️
actors/miner/src/types.rs 95.83% <87.50%> (-1.05%) ⬇️
runtime/src/builtin/shared.rs 89.18% <87.50%> (-3.12%) ⬇️
test_vm/src/lib.rs 88.91% <92.85%> (-0.03%) ⬇️
... and 46 more

actors/paych/src/lib.rs Outdated Show resolved Hide resolved
@@ -932,7 +935,8 @@ impl<BS: Blockstore> Runtime for MockRuntime<BS> {
&& expected_msg.value == value,
"message sent does not match expectation.\n\
message - to: {:?}, method: {:?}, value: {:?}, params: {:?}\n\
expected - to: {:?}, method: {:?}, value: {:?}, params: {:?}",
expected - to: {:?}, method: {:?}, value: {:?}, params: {:?}\n\
method match {}, params match {}, value match {}",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was something I left over while debugging. We should remove it.

@arajasek arajasek enabled auto-merge (squash) January 12, 2023 15:57
@arajasek arajasek merged commit b84d38c into master Jan 12, 2023
shamb0 pushed a commit to shamb0/builtin-actors that referenced this pull request Jan 31, 2023
…ecoin-project#1004)

* Proof of concept exported API for Account actor (filecoin-project#797)

* Export stable methods for public access (filecoin-project#807)

* Export Datacap Actor methods

* Export Init Actor methods

* Export Market Actor methods

* Export Miner Actor methods

* Export Multisig Actor methods

* Export Verifreg Actor methods

* Address review

* Restrict internal APIs of all actors (filecoin-project#809)

* Exported API method for market actor escrow/locked balance (filecoin-project#812)

* Power actor: Add exported getters for raw power (filecoin-project#810)

* Power actor: Add exported getters for raw power

* FRC-XXXX is FRC-0042

* Power actor: network_raw_power: Return this_epoch_raw_byte_power

* Power actor: miner_raw_power: Return whether above consensus min power

* Power actor: types: serialize one-element structs transparently

* Address review

* Miner actor: Add exported getters for info and monies (filecoin-project#811)

* Miner actor: Add exported getters for info and monies

* Tweak comment

* Miner actor: Replace GetWorker and GetControls with IsControllingAddress

* Miner actor: Add exported GetAvailableBalance

* Miner actor: Add exported GetVestingFunds

* Miner actor: Remove exported monies getters

* Miner actor: types: serialize one-element structs transparently

* Address review

* Address review

* Built-in market API for deal proposal metadata (filecoin-project#818)

* Call exported authenticate method from PSD (filecoin-project#829)

Co-authored-by: zenground0 <[email protected]>

* Drop CALLER_TYPES_SIGNABLE and signable caller validation (filecoin-project#821)

* Market actor: Minor improvements to two exported getters (filecoin-project#826)

* Market actor: GetDealTermExported: Return (start_epoch, duration)

* Market actor: Export getter for deal total price

* Exported API for market deal activation state (filecoin-project#819)

* Paych actor: Drop account req, use AuthenticateMessage to verify sigs (filecoin-project#824)

* Paych actor: Drop account req, use AuthenticateMessage to verify sigs

* Address review

* Address review

* Account actor: Deprecate AuthenticateMessage (filecoin-project#856)

* Market actor: Export PublishStorageDeals (filecoin-project#857)

* Miner: Export several more methods (filecoin-project#863)

* Miner: Export ChangeWorkerAddress

* Miner: Export ChangePeerID

* Miner: Export WithdrawBalance

* Miner: Export ChangeMultiaddrs

* Miner: Export ConfirmUpdateWorkerKey

* Miner: Export RepayDebt

* Miner: Export ChangeOwnerAddress

* Miner: Add exported getters for PeerID & multiaddrs

* Miner: Refactor: Rename ConfirmUpdateWorkerKey to ConfirmChangeWorkerAddress

* Power actor: Export methods to CreateMiner and get miner counts (filecoin-project#868)

* Power: Export CreateMiner

* Power Actor: Export MinerCount and MinerConsensusCount

* Update actors/power/src/lib.rs

Co-authored-by: Alex <[email protected]>

Co-authored-by: Alex <[email protected]>

* Verifreg: Export AddVerifiedClient and GetClaims (filecoin-project#873)

* Verifreg: Rename AddVerifierClientParams to AddVerifiedClientParams

* Verifreg: Export AddVerifiedClient and GetClaims

* Datacap actor: Modify exported methods (filecoin-project#909)

* Datacap: Export Mint and Destroy

* Datacap actor: Deprecate all internal methods

* Datacap actor: Rename BalanceOf to Balance

* Datacap actor: Add Granularity method

* fix: comments on newly exported methods (filecoin-project#910)

* Miner: Export method to GetPendingOwner

* MarketNotifyDeal (filecoin-project#944)

Co-authored-by: zenground0 <[email protected]>

* Verifreg: Call AuthenticateMessage instead of validating siggys

* Multisig: Do not export any functionality (filecoin-project#967)

* use const for EX_DEAL_EXPIRED (filecoin-project#954)

* Address review

Co-authored-by: Alex <[email protected]>
Co-authored-by: ZenGround0 <[email protected]>
Co-authored-by: zenground0 <[email protected]>
Co-authored-by: Shashank <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants