-
Notifications
You must be signed in to change notification settings - Fork 79
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
Reduce gas costs associated with publishing storage deals #1020
Comments
One of the challenges here has been lack of tooling (re: filecoin-project/ref-fvm#1080). Without tooling we don't understand where the costs are coming from. I have been working on FVM instrumentation and analysis tooling in https://github.com/anorth/fvm-workbench. While not yet ready for general use yet (depends on some unreleased changes to FVM and actors), I do have some early results. One small part of deal publishing is the datacap transfer (including receiver hook call). I have instrumented a VM test just of this function. In the very basic case of an initially empty state (no existing allocations), here's a breakdown of gas usage:
The Root span gives the totals, with breakdown by the label attached to each gas charge: 9.5M gas total, with 3.9M attributed to block link (writing new blocks to store), 2.3M for block open (reading), and <2M WASM execution. The gas charge of block link is dominated by a fixed per-block charge, rather than per-byte increment. The subsequent spans show smaller areas of the code:
The receiver hook in this case creates the verified registry allocation record, to be later claimed by the provider for QAP. I'm investigating opportunities to reduce costs here, but we should also investigate the entire PublishStorageDeals flow. |
The HAMT implementation redundantly writes the root node to storage when flushed, even if unchanged (filecoin-project/ref-fvm#1443). This happens in the verified registry actor when receiving tokens for a new allocation or claim (but not both at the same time). Fixed in #1030. |
chore: update hamt & kamt Replaces #1020
I have completed a trace of a simple PublishStorageDeals method. This message carries 5 deals but is against an otherwise empty state.
Some notable points:
There's most investigation to do to find which storage and execution operations are most expensive. |
The datacap actor writes multiple blocks when processing a TransferFrom operation. We can probably significantly reduce the gas costs associated with datacap by restructuring that state. See #1101 (a tracking issue for filecoin-project/actors-utils#188) |
With #722 merged, I've an updated trace of publishing verified deals.
So a total of 103M -> 63M 🎉 |
chore: update hamt & kamt Replaces filecoin-project#1020
This issue is now just a tracking issue for a set of mitigations, each written up separately. I think we can close this now as it's not actionable. FYI @jennijuju |
We optimised much more here, primarily through batching. The changes will land in nv21. |
This is a discussion and tracking issue for improvements to deal-related gas costs. The background is filecoin-project/FIPs#535
Changes:
The text was updated successfully, but these errors were encountered: