Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement the calculate spower offchain feature (#944)
Implement the feature to support spower calculation offchain, this needs to work together with the crust-spower service https://github.com/crustio/crust-spower. Main changes: swork::report_works doesn't invoke market::upsert_replicas and market::delete_replicas anymore. The crust-spower service will index the work reports from chain, and aggregate multiple work reports, then call the newly added market::update_replicas extrinsic to update the replicas data in batch. Update the market::calculate_rewards extrinsic to only liquidate, renew, or close file, but do not update replicas and spower anymore. The crust-spower service will index the market::FilesV2 data from chain, and perform spower calculation for changed files in batch, then call the newly added swork::update_spower extrinsic to update the sworker spower and file spower. The newly added market::update_replicas extrinsic and swork::update_spower extrinsic can only be called by specific register spower superior account, the account need to be set Unit tests have been updated per these changes.
- Loading branch information