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

Remove the market actor state mutation pattern #734

Conversation

shamb0
Copy link
Contributor

@shamb0 shamb0 commented Oct 4, 2022

Fixes #656 | Remove the market actor state mutation pattern

Hello @anorth,

Took state mutation pattern of fil_actor_miner as reference,
and modified the fil_actor_market mutation pattern. following things are verified on proposed patch & ready for review.

  • State mutation refactor on state.rs - Done
  • Integration to struct Actor - Done
  • Status of existing Unittest - all OK

Signed-off-by: shamb0 <r.raajey@gmail.com>
@codecov-commenter
Copy link

codecov-commenter commented Oct 4, 2022

Codecov Report

Merging #734 (7e954fa) into master (890ed9f) will increase coverage by 0.49%.
The diff coverage is 94.01%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #734      +/-   ##
==========================================
+ Coverage   88.20%   88.69%   +0.49%     
==========================================
  Files          95       95              
  Lines       19628    19650      +22     
==========================================
+ Hits        17312    17429     +117     
+ Misses       2316     2221      -95     
Impacted Files Coverage Δ
actors/market/src/lib.rs 89.98% <91.75%> (+5.07%) ⬆️
actors/market/src/state.rs 92.58% <94.41%> (+8.90%) ⬆️
actors/power/src/lib.rs 83.62% <0.00%> (-0.65%) ⬇️
actors/datacap/src/lib.rs 76.30% <0.00%> (-0.35%) ⬇️
state/src/check.rs 86.66% <0.00%> (-0.27%) ⬇️
test_vm/src/lib.rs 88.91% <0.00%> (-0.12%) ⬇️

@anorth
Copy link
Member

anorth commented Oct 4, 2022

Thanks for rebasing this. We'll take a look in a week or so after we're confident that nv17 has settled on master

@shamb0
Copy link
Contributor Author

shamb0 commented Oct 5, 2022

Thanks @anorth,

One observation from my perspective is ...

Storage of state instances, gets loaded frequently.
wondering about the overhead cost associated with it.

In current patch, this overhead is due to, most of the states
are muted inside the loop context, I hope this can be
refactored and optimized in better way.

To make review simpler, Can I take the optimization
as separate PR ?

@anorth
Copy link
Member

anorth commented Oct 6, 2022

Yes please defer any optimisations to a later PR. This one should be as much as possible a mechanical change.

Signed-off-by: shamb0 <r.raajey@gmail.com>
Signed-off-by: shamb0 <r.raajey@gmail.com>
Copy link
Member

@anorth anorth left a comment

Choose a reason for hiding this comment

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

This looks great. Nice batching of updates – thanks.

I'm so sorry this took so long to review. Would you please rebase and update for feedback, and then I will make sure to re-review quickly so we can land this.

cc @ZenGround0 @arajasek

actors/market/src/lib.rs Outdated Show resolved Hide resolved
actors/market/src/lib.rs Outdated Show resolved Hide resolved
actors/market/src/lib.rs Outdated Show resolved Hide resolved
actors/market/src/lib.rs Outdated Show resolved Hide resolved
actors/market/src/lib.rs Show resolved Hide resolved
actors/market/src/state.rs Outdated Show resolved Hide resolved
actors/market/src/state.rs Outdated Show resolved Hide resolved
actors/market/src/state.rs Outdated Show resolved Hide resolved
actors/market/src/state.rs Outdated Show resolved Hide resolved
actors/market/src/state.rs Outdated Show resolved Hide resolved
Signed-off-by: shamb0 <r.raajey@gmail.com>
Signed-off-by: shamb0 <r.raajey@gmail.com>
Copy link
Member

@anorth anorth left a comment

Choose a reason for hiding this comment

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

Awesome. I've a few naming nits, but otherwise this looks great. I want to give an opportunity for @ZenGround0 and/or @arajasek to skim this before merging, but LGTM.

actors/market/src/lib.rs Outdated Show resolved Hide resolved
actors/market/src/state.rs Show resolved Hide resolved
actors/market/src/state.rs Outdated Show resolved Hide resolved
actors/market/src/state.rs Outdated Show resolved Hide resolved
actors/market/src/state.rs Outdated Show resolved Hide resolved
actors/market/src/state.rs Outdated Show resolved Hide resolved
@anorth anorth changed the title #656 Fix | actor market | refactor state mutation #726 Remove the market actor state mutation pattern Dec 1, 2022
Copy link
Contributor

@arajasek arajasek left a comment

Choose a reason for hiding this comment

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

Thanks, this looks great -- just a couple nits.

actors/market/src/state.rs Show resolved Hide resolved
actors/market/src/lib.rs Outdated Show resolved Hide resolved
shamb0 and others added 5 commits December 3, 2022 15:31
Co-authored-by: Alex <445306+anorth@users.noreply.github.com>
Signed-off-by: shamb0 <r.raajey@gmail.com>
Signed-off-by: shamb0 <r.raajey@gmail.com>
Signed-off-by: shamb0 <r.raajey@gmail.com>
@shamb0
Copy link
Contributor Author

shamb0 commented Dec 5, 2022

Thanks @anorth & @arajasek, All the nits are closed now.
PR is in-sync with latest master branch commits & ready for intake.

@anorth anorth merged commit dc8077c into filecoin-project:master Dec 5, 2022
vyzo pushed a commit that referenced this pull request Dec 7, 2022
* Remove the market actor state mutation pattern (#734)

Fixes #656

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

* Export stable methods for public access (#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 (#809)

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

* Power actor: Add exported getters for raw power (#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 (#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 (#818)

* Call exported authenticate method from PSD (#829)


Co-authored-by: zenground0 <ZenGround0@users.noreply.github.com>

* Drop CALLER_TYPES_SIGNABLE and signable caller validation (#821)

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

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

* Market actor: Export getter for deal total price

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

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

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

* Address review

* Address review

* Account actor: Deprecate AuthenticateMessage (#856)

* Market actor: Export PublishStorageDeals (#857)

* Miner: Export several more methods (#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 (#868)

* Power: Export CreateMiner

* Power Actor: Export MinerCount and MinerConsensusCount

* Update actors/power/src/lib.rs

Co-authored-by: Alex <445306+anorth@users.noreply.github.com>

Co-authored-by: Alex <445306+anorth@users.noreply.github.com>

* Verifreg: Export AddVerifiedClient and GetClaims (#873)

* Verifreg: Rename AddVerifierClientParams to AddVerifiedClientParams

* Verifreg: Export AddVerifiedClient and GetClaims

* Datacap actor: Modify exported methods (#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 (#910)

Co-authored-by: RK <r.raajey@gmail.com>
Co-authored-by: Alex <445306+anorth@users.noreply.github.com>
Co-authored-by: ZenGround0 <5515260+ZenGround0@users.noreply.github.com>
Co-authored-by: zenground0 <ZenGround0@users.noreply.github.com>
shamb0 added a commit to shamb0/builtin-actors that referenced this pull request Jan 31, 2023
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.

Remove the market actor state mutation pattern
4 participants