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 Batch Fee For Precommit and Lower BatchBalancer #1094

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

irenegia
Copy link
Contributor

We are proposing a FIP to support more batching/aggregation as low hanging fruit to give some onboarding gas saving in the short term

cc @AxCortesCubero @zixuanzh

We are proposing a FIP to support more batching/aggregation as low hanging fruit to give some onboarding gas saving in the short term

cc @AxCortesCubero @zixuanzh
Copy link
Contributor

@lanzafame lanzafame left a comment

Choose a reason for hiding this comment

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

Lacking some reasoning for the chosen numbers for the batchBalancer but otherwise seems good.

FIPS/fip-lowerbatchBal.md Outdated Show resolved Hide resolved
FIPS/fip-lowerbatchBal.md Outdated Show resolved Hide resolved
FIPS/fip-lowerbatchBal.md Outdated Show resolved Hide resolved
FIPS/fip-lowerbatchBal.md Outdated Show resolved Hide resolved
FIPS/fip-lowerbatchBal.md Outdated Show resolved Hide resolved
FIPS/fip-lowerbatchBal.md Outdated Show resolved Hide resolved
At precommit there are two options: (1) "simple" batching as in precommit (ie, one message for ≥ 2 sectors) where there is a porep proof for each sector in the batch, and (2) batching with aggregation, where there is one unique aggregated porep proof.
Batching for provecommit is already rational (cost-effective), as the batch fee applies only to aggregated proofs (opposed to precommit, where the batch balancer applies to batching).

On the other hand, aggregation is rational only when the base fee exceeds 0.065 nanoFIL. Lowering the value of `batchBalancer` from 5 to 2 nanoFIL will reduce the crossover point to 0.026 nanoFIL, making the aggregation rational across a broader range of base fee values.
Copy link
Contributor

Choose a reason for hiding this comment

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

Why 2 nanoFIL? And why 0.026 nanoFIL for the crossover? Any modelling to back these choices versus other values?

Copy link
Contributor Author

@irenegia irenegia Dec 23, 2024

Choose a reason for hiding this comment

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

FIPS/fip-lowerbatchBal.md Outdated Show resolved Hide resolved
FIPS/fip-lowerbatchBal.md Outdated Show resolved Hide resolved
FIPS/fip-lowerbatchBal.md Outdated Show resolved Hide resolved
FIPS/fip-lowerbatchBal.md Outdated Show resolved Hide resolved
@rvagg
Copy link
Member

rvagg commented Dec 20, 2024

@irenegia very tiny nit: it might be good to make the casing of "batchBalancer" more consistent across the doc. In the authoritative code (builtin-actors), it's BATCH_BALANCER, in go-state-types it's BatchBalancer. I don't think there's a good reason to camelCase it, perhaps "BatchBalancer" would be best. You do have aggregate_fee in there, which is from builtin-actors and matches.

@rvagg rvagg changed the title Create fip-lowerbatchBal.md Remove Batch Fee For Precommit and Lower BatchBalancer Dec 20, 2024
fip: "00XX"
title: Remove Batch Fee For Precommit and Lower batchBalancer
author: irene, ZX, AX
discussions-to: https://github.com/filecoin-project/FIPs/discussions/1092
Copy link
Member

Choose a reason for hiding this comment

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

Could you please create a separate discussion dedicated to this proposal - so that it is easier to capture a discussion that is specific to what is proposed here?

At precommit there are two options: (1) "simple" batching as in precommit (ie, one message for ≥ 2 sectors) where there is a porep proof for each sector in the batch, and (2) batching with aggregation, where there is one unique aggregated porep proof.
Batching for provecommit is already rational (cost-effective), as the batch fee applies only to aggregated proofs (opposed to precommit, where the batch balancer applies to batching).

On the other hand, aggregation is rational only when the base fee exceeds 0.065 nanoFIL. Lowering the value of `batchBalancer` from 5 to 2 nanoFIL will reduce the crossover point to 0.026 nanoFIL, making the aggregation rational across a broader range of base fee values.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
On the other hand, aggregation is rational only when the base fee exceeds 0.065 nanoFIL. Lowering the value of `batchBalancer` from 5 to 2 nanoFIL will reduce the crossover point to 0.026 nanoFIL, making the aggregation rational across a broader range of base fee values.
On the other hand, aggregation is rational only when the base fee exceeds 0.065 nanoFIL today. Lowering the value of `batchBalancer` from 5 to 2 nanoFIL will reduce the crossover point to 0.026 nanoFIL, making the aggregation rational across a broader range of base fee values.

Copy link
Member

@jennijuju jennijuju Dec 21, 2024

Choose a reason for hiding this comment

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

Can you specify how you get the 0.065 nanoFIL number? If this is true - it sounds like SP client like lotus-miner should change their default immediately or miners should manually update their cocnfig so that aggregation is enabled whenever base fee is higher than 0.065 nanoFIL and start saving (and the network does have >0.065nanoFIL base fee sometimes atm).
image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The value 0.065 nanoFIL was computed by @zixuanzh using the new cost (gas units) of PCS3, more details can be found here

- [Msg 2](https://www.filutils.com/en/message/bafy2bzaceah7m6jzravjoswo2pljzit36euu3sgz5jzbnpkcfp23b76texiv6): ProveCommitSectors3 for 4 sectors, batched (no aggregation): 96.M/4 = 24M per sector
- [Msg 3](https://www.filutils.com/en/message/bafy2bzacedeh74ds4x4l5nlfahmlvwn4obfukhgqnf6rxlaargvsm56sljune): ProveCommitSectors3 for 4 sectors, aggregated[^*]: 217M/4 = 54M per sector

[^*]: In practice, aggregation is currently giving less gas saving respect to batching due to a bug causing single proofs to be charged an incorrect amount of gas units. So currently, batching is to be preferred with respect to aggregation. Once this code bug is fixed, batching will cost more gas units and aggregation would be the option with the largest gas unit saving per sector.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
[^*]: In practice, aggregation is currently giving less gas saving respect to batching due to a bug causing single proofs to be charged an incorrect amount of gas units. So currently, batching is to be preferred with respect to aggregation. Once this code bug is fixed, batching will cost more gas units and aggregation would be the option with the largest gas unit saving per sector.
[^*]: In practice, aggregation is currently giving less gas saving respect to batching due to a bug causing single proofs to be charged an incorrect amount of gas units. So currently, batching is to be preferred with respect to aggregation. Once this bug in the ref-fvm implementation is addressed, proof aggregation will be the most gas-efficient approach if one can onboard 4 or more sectors at the same time.

Copy link
Member

@jennijuju jennijuju Dec 21, 2024

Choose a reason for hiding this comment

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

can onboard 4 or more sectors at the same time.

technical: @irenegia can you confirm whether this is still correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ack, working on that

@jennijuju
Copy link
Member

On a high level, this FIP is technically sound. However, I think it needs to document how the authors are getting/choosing the numbers mentioned in this FIP better & some editorial fixes.

irenegia and others added 4 commits December 23, 2024 13:54
Co-authored-by: Adrian Lanzafame <[email protected]>
Co-authored-by: Jiaying Wang <[email protected]>
Co-authored-by: Rod Vagg <[email protected]>
Co-authored-by: Adrian Lanzafame <[email protected]>
Co-authored-by: Rod Vagg <[email protected]>
Co-authored-by: Adrian Lanzafame <[email protected]>
Co-authored-by: Jiaying Wang <[email protected]>
Co-authored-by: Adrian Lanzafame <[email protected]>
@irenegia
Copy link
Contributor Author

@irenegia very tiny nit: it might be good to make the casing of "batchBalancer" more consistent across the doc. In the authoritative code (builtin-actors), it's BATCH_BALANCER, in go-state-types it's BatchBalancer. I don't think there's a good reason to camelCase it, perhaps "BatchBalancer" would be best. You do have aggregate_fee in there, which is from builtin-actors and matches.

Changed to BatchBalancer everywhere

editorial changes + added links to precommit and provecommit msgs with deals
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.

4 participants