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

chore: remove PRE_COMMIT_SECTOR_BATCH_MAX_SIZE and other gas-limited parameters #1586

Open
wants to merge 10 commits into
base: feat/fip-0100
Choose a base branch
from

Conversation

kamuik16
Copy link
Contributor

Closes #1268

@rvagg
Copy link
Member

rvagg commented Oct 22, 2024

@kamuik16 make check is failing in CI, it runs clippy over the whole lot

@kamuik16
Copy link
Contributor Author

@kamuik16 make check is failing in CI, it runs clippy over the whole lot

CI is passing now.

@BigLep BigLep requested a review from rvagg October 22, 2024 14:21
Copy link
Member

@rvagg rvagg left a comment

Choose a reason for hiding this comment

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

Code seems good to me on a cursory review, but we need to draft a FIP for this because it's a protocol change, even though a minor one. There may be some unforeseen issues that come up during discussion in the FIP process.

@rvagg
Copy link
Member

rvagg commented Oct 23, 2024

So I bundled this up, modified some itest infra in lotus and ran an experiment and I could precommit a little above 1,000 sectors before hitting the message size limit. Gas is 514,759,261 when doing 1,000, although it's a new miner with minimal existing state to mutate so that's the cheapest case.

Which all means that this isn't really "gas limited", at least for precommit batching. We'll have to get feedback before proceeding with this. I'll ask on Slack, maybe consider a draft FIP to gather discussion.

Either way, @kamuik16, this one isn't going to get resolved very quickly. You might be best to pick another item off the possible list and move on to something productive while we figure this out. Thanks for the work so far (I can at least confirm that it works in for precommits when integrated into lotus).

@kamuik16
Copy link
Contributor Author

So I bundled this up, modified some itest infra in lotus and ran an experiment and I could precommit a little above 1,000 sectors before hitting the message size limit. Gas is 514,759,261 when doing 1,000, although it's a new miner with minimal existing state to mutate so that's the cheapest case.

Which all means that this isn't really "gas limited", at least for precommit batching. We'll have to get feedback before proceeding with this. I'll ask on Slack, maybe consider a draft FIP to gather discussion.

Either way, @kamuik16, this one isn't going to get resolved very quickly. You might be best to pick another item off the possible list and move on to something productive while we figure this out. Thanks for the work so far (I can at least confirm that it works in for precommits when integrated into lotus).

Ohh okay.

@Stebalien
Copy link
Member

We discussed this on slack (TL;DR: probably fine) but I wanted to followup here. At the end of the day:

  1. There are no concern with respect to message size as messages are included before they're even executed (size limits are applied at the message/block propagation layers via both protocol & gas restrictions).
  2. Gas should cover the compute time. If stuffing 1,000 pre-commits into a single message takes less gas than the gas allocated to a single block, then it should be fine. If it isn't, that means our gas model is wrong.

The only things to watch out for are:

  1. State written via the FVM. The maximum IPLD block size is 1MiB in the FVM but none of the built-in actors will ever create blocks this large due to other constraints. These large blocks are allowed because they should technically be fine, but I'd be uncomfortable going over ~256KiB without good reason until we get more edge-case testing.
  2. Syscalls into the FVM. Specifically crypto::compute_unsealed_sector_cid, crypto::verify_aggregate_seals, crypto::verify_replica_update, and crypto::batch_verify_seals because they read CBOR supplied by the actor and they don't apply any limits on said CBOR and assume reasonable limits are applied by the actors. These are "very special" syscalls that should really be replaced by, e.g., low-level BLS and/or snark syscalls.

@Stebalien Stebalien closed this Oct 23, 2024
@Stebalien Stebalien reopened this Oct 23, 2024
@Stebalien
Copy link
Member

To expand on my comment WRT syscalls like crypto::verify_replica_update, removing the limit on the number of updates is fine because each update is applied with a separate call to crypto::verify_replica_update. However, e.g., removing the check on the length of the proof of each update would not be fine.

@Stebalien
Copy link
Member

Also note, this is part of #1268 but doesn't fix it completely. E.g., there's no reason to check addressed_partitions_max and/or addressed_sectors_max in most cases.

@rvagg
Copy link
Member

rvagg commented Oct 29, 2024

We're going to let this PR sit until we've got a FIP in for the changes. It should be straightforward but there's some uncertainty about what the FIP process might throw up regarding this change.

@jennijuju
Copy link
Member

We're going to let this PR sit until we've got a FIP in for the changes. It should be straightforward but there's some uncertainty about what the FIP process might throw up regarding this change.

Why are we holding the FIP for this change? I think this is a straightforward protocol improvement.

@anorth
Copy link
Member

anorth commented Nov 20, 2024

We're going to let this PR sit until we've got a FIP in for the changes. It should be straightforward but there's some uncertainty about what the FIP process might throw up regarding this change.

Why are we holding the FIP for this change? I think this is a straightforward protocol improvement.

I think you've misunderstood. The PR is being held for the introduction of a FIP specifying the changes. It is straightforward, but does have functional effects so needs to follow the process.

@BigLep
Copy link
Member

BigLep commented Jan 6, 2025

I'm moving this back to draft given it needs the corresponding FIP. We can mark ready for review/merge once the FIP is there. I don't have confirmation, but I heard discussion of doing the FIP work as part of filecoin-project/FIPs#1094

@rvagg
Copy link
Member

rvagg commented Jan 7, 2025

See filecoin-project/FIPs#1098

@rvagg
Copy link
Member

rvagg commented Jan 8, 2025

let's make sure we tie this with #1584 and close them both when we get it finally resolved

irenegia pushed a commit to filecoin-project/FIPs that referenced this pull request Jan 15, 2025
* Add removal of gas-limited constraints to gas-savings proposal

Ref: #1094
Ref: filecoin-project/builtin-actors#1586
Ref: filecoin-project/builtin-actors#1268
Ref: filecoin-project/lotus#10612

* fixup! Add removal of gas-limited constraints to gas-savings proposal
@BigLep
Copy link
Member

BigLep commented Feb 14, 2025

Given we have https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0100.md , I'll mark this ready for review

@BigLep BigLep marked this pull request as ready for review February 14, 2025 03:36
@rvagg rvagg changed the base branch from master to feat/fip-0100 February 14, 2025 05:42
@rvagg
Copy link
Member

rvagg commented Feb 14, 2025

Retargeting this to the feat/fip-0100 branch and we'll bundle with that. I've also closed #1584 which was a dupe but has less dead-code removal than this one.

Just type changes and tests for their serialization forms so far.

* `Deadline`
  - Add `total_power: PowerPair`
  - Add `daily_fee: TokenAmount`
* `SectorOnChainInfo`
  - Add `daily_fee: TokenAmount` as an optional field
  - Tests that it can load both 15 and 16 field forms but always saves 16 field form
* `ExpirationSet`
  - Add `fee_deduction: TokenAmount` as an optional field
  - Tests that it can load both 5 and 6 field forms but always save 6 field form

Closes: filecoin-project#1613
Closes: filecoin-project#1614
Closes: filecoin-project#1615
rvagg and others added 5 commits February 19, 2025 15:08
)

* Adds a `daily_proof_fee(policy: &Policy, circulating_supply: TokenAmount)` for the miner actor
* Adds `DAILY_FEE_CIRCULATING_SUPPLY_MULTIPLIER_NUM` and `DAILY_FEE_CIRCULATING_SUPPLY_MULTIPLIER_DENOM` for a 7.4e-15 multiplier as per the FIP: https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0100.md#per-sector-fee-added

Added a test to sanity check, it also ~matches what was given as a current-day estimate [here](filecoin-project/FIPs#1105 (comment)).

Closes: filecoin-project#1612
* fip-0100: initial pass at daily_fee accounting

* fip-0100: handle sector termination and expiration

* fip-0100: update total power and record a TODO

1. We need to add to the total power when adding sectors, and deduct
when deleting partitions.
2. We're going to need to figure out some way to handle fees when we
compact partitions.

* update the daily fee when faulting/recovering

I'm using a negative delta in the recover case because that's what we do
elsewhere in that function, but I'm not super happy about it.

* fip-0100: remove fees when removing faulty sectors from the expiration queue

* fip-0100: make clippy happy, fix bad arg order in ExpirationQueue#remove

* fip-0100: account for fee adjustment for fault reschedules

* fip-0100: add invariant for fees

* fip-0100: more invariants, handle partition removal/compaction cases

* fip-0100: document return values

* fip-0100: account for power changes when extending/snapping sectors

* fip-0100: add state invariant for live deadline power

* fip-0100: handle unproven power on termination

* fip-0100: handle remaining todos

* fip-0100: rename total_power to live_power

To match our other power variable names.

---------

Co-authored-by: Steven Allen <[email protected]>
…ct#1627)

* fip-0100: move compact_partitions logic into deadline
* fip-0100: remove sectors in AMT not state
* fip-0100: Deadline::add_sectors flag to optionally accumulate fees
If we snap/extend across multiple deadlines (which appears to be
untested), we would have summed up the power from all proceeding deadlines.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✔️ Approved by reviewer
Status: ✔️ Approved by reviewer
Development

Successfully merging this pull request may close these issues.

Remove PRE_COMMIT_SECTOR_BATCH_MAX_SIZE and other gas-limited parameters
6 participants