Skip to content

Conversation

@jennijuju
Copy link

@jennijuju jennijuju commented Apr 23, 2025

source https://github.com/lucaniz/pdp-gas-calculator by @ lucaniz

Changes from the source:

  • improvement: updated the UI to align with the rest of the explorer & clarity
  • feat: more flexible proving frequency, instead of only allowing users to set X proof per day, they can now set. X proof per Y day

See a preview here
image

Copy link
Collaborator

@silent-cipher silent-cipher left a comment

Choose a reason for hiding this comment

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

Everything else LGTM!

for (const tier in baseFees) {
const baseFee = baseFees[tier as keyof typeof baseFees]

const gasFeeSingle = baseFee * gasUnits + 1e-7 * Math.log10(gasUnits / roots)
Copy link
Collaborator

Choose a reason for hiding this comment

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

In latest source implementation, log term is removed and fixed gas for nextProvingPeriod is taken into account. So, as per source gas fee calculation for a proof can be replaced with ->
const nextProvingPeriodGas = 55000000
const gasFeeSingle = ( gasUnits + nextProvingPeriodGas ) * baseFee

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for looking into this @silent-cipher. I think that what you are saying doesn't quite apply because this calculator is looking at the proof fee itself, not total gas spent on maintaining a proofset. The proof fee introspects on the gas it takes to run most of the way through a provePossession message and then discounts from the fee if the total base fee burn is too high.

This calculator is limited in that its missing observability on gas data for adding roots and the fixed cost of nextProvingPeriod and the base fee burn from provePossession. But that's a bigger issue for another day.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually I'm glad you brought this up because the "gas fee per day column is misleading" as is

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok I see what we're doing with log_10 now, this is taking the logarithmic scaling of gas with roots. I guess this is good enough for a rough calculator.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we actually should do part of what @silent-cipher is suggesting. We need to provePossession single gas fee separate like this for calculating the pdp proof fee. However we should also add a fixed cost of 55M gas for every proof message.

Copy link
Contributor

Choose a reason for hiding this comment

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

The other thing that's a bit misleading is that all of the data in the gasUnits table is actually for messages with 5 proofs. I guess we can say proofMessage or proofCall throughout to make that a bit clearer?

<td className="p-2 border-b text-xs text-gray-800">
{proofCount === 1 && dayCount === 1
? "Daily PDP proof fee (FIL)"
: `PDP proof fee per day (FIL, for ${proofCount} proof${proofCount > 1 ? 's' : ''} per ${dayCount} day${dayCount > 1 ? 's' : ''})`}
Copy link
Contributor

Choose a reason for hiding this comment

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

The default of 1 proof per 7 days should be 5 proofs per 1 day since that is the default in practice.

Copy link
Contributor

Choose a reason for hiding this comment

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

Scratch that -- now that I know that "1 proof" really means 1 message with 5 proofs this default should be 1 proof per 1 day.

@ZenGround0
Copy link
Contributor

A few small details to make the calculator more accurate and user friendly. The website change looks good -- deployed it to testing setup here: http://explore-pdp.xyz:5173/gas-calculator

@rjan90 rjan90 linked an issue May 21, 2025 that may be closed by this pull request
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.

add pdp cost calculator to the explorer

4 participants