Skip to content

Commit 57d6769

Browse files
authored
docs(api): document 10% overestimation in collateral/pledge APIs (#12922)
docs(api): document 10% overestimation in collateral/pledge APIs
1 parent 746995e commit 57d6769

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

api/api_full.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,20 +439,26 @@ type FullNode interface {
439439
// StateMinerRecoveries returns a bitfield indicating the recovering sectors of the given miner
440440
StateMinerRecoveries(context.Context, address.Address, types.TipSetKey) (bitfield.BitField, error) //perm:read
441441
// StateMinerPreCommitDepositForPower returns the precommit deposit for the specified miner's sector
442+
// Note: The value returned is overestimated by 10% (multiplied by 110/100).
443+
// See: node/impl/full/state.go StateMinerPreCommitDepositForPower implementation.
442444
StateMinerPreCommitDepositForPower(context.Context, address.Address, miner.SectorPreCommitInfo, types.TipSetKey) (types.BigInt, error) //perm:read
443445
// StateMinerInitialPledgeCollateral attempts to calculate the initial pledge collateral based on a SectorPreCommitInfo.
444446
// This method uses the DealIDs field in SectorPreCommitInfo to determine the amount of verified
445447
// deal space in the sector in order to perform a QAP calculation. Since network version 22 and
446448
// the introduction of DDO, the DealIDs field can no longer be used to reliably determine verified
447449
// deal space; therefore, this method is deprecated. Use StateMinerInitialPledgeForSector instead
448450
// and pass in the verified deal space directly.
451+
// Note: The value returned is overestimated by 10% (multiplied by 110/100).
452+
// See: node/impl/full/state.go StateMinerInitialPledgeCollateral implementation.
449453
//
450454
// Deprecated: Use StateMinerInitialPledgeForSector instead.
451455
StateMinerInitialPledgeCollateral(context.Context, address.Address, miner.SectorPreCommitInfo, types.TipSetKey) (types.BigInt, error) //perm:read
452456
// StateMinerInitialPledgeForSector returns the initial pledge collateral for a given sector
453457
// duration, size, and combined size of any verified pieces within the sector. This calculation
454458
// depends on current network conditions (total power, total pledge and current rewards) at the
455459
// given tipset.
460+
// Note: The value returned is overestimated by 10% (multiplied by 110/100).
461+
// See: node/impl/full/state.go StateMinerInitialPledgeForSector implementation.
456462
StateMinerInitialPledgeForSector(ctx context.Context, sectorDuration abi.ChainEpoch, sectorSize abi.SectorSize, verifiedSize uint64, tsk types.TipSetKey) (types.BigInt, error) //perm:read
457463
// StateMinerAvailableBalance returns the portion of a miner's balance that can be withdrawn or spent
458464
StateMinerAvailableBalance(context.Context, address.Address, types.TipSetKey) (types.BigInt, error) //perm:read
@@ -600,6 +606,8 @@ type FullNode interface {
600606
StateVerifiedRegistryRootKey(ctx context.Context, tsk types.TipSetKey) (address.Address, error) //perm:read
601607
// StateDealProviderCollateralBounds returns the min and max collateral a storage provider
602608
// can issue. It takes the deal size and verified status as parameters.
609+
// Note: The min value returned is overestimated by 10% (multiplied by 110/100).
610+
// See: node/impl/full/state.go StateDealProviderCollateralBounds implementation.
603611
StateDealProviderCollateralBounds(context.Context, abi.PaddedPieceSize, bool, types.TipSetKey) (DealCollateralBounds, error) //perm:read
604612

605613
// StateCirculatingSupply returns the exact circulating supply of Filecoin at the given tipset.

build/openrpc/full.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18656,7 +18656,7 @@
1865618656
{
1865718657
"name": "Filecoin.StateDealProviderCollateralBounds",
1865818658
"description": "```go\nfunc (s *FullNodeStruct) StateDealProviderCollateralBounds(p0 context.Context, p1 abi.PaddedPieceSize, p2 bool, p3 types.TipSetKey) (DealCollateralBounds, error) {\n\tif s.Internal.StateDealProviderCollateralBounds == nil {\n\t\treturn *new(DealCollateralBounds), ErrNotSupported\n\t}\n\treturn s.Internal.StateDealProviderCollateralBounds(p0, p1, p2, p3)\n}\n```",
18659-
"summary": "StateDealProviderCollateralBounds returns the min and max collateral a storage provider\ncan issue. It takes the deal size and verified status as parameters.\n",
18659+
"summary": "StateDealProviderCollateralBounds returns the min and max collateral a storage provider\ncan issue. It takes the deal size and verified status as parameters.\nNote: The min value returned is overestimated by 10% (multiplied by 110/100).\nSee: node/impl/full/state.go StateDealProviderCollateralBounds implementation.\n",
1866018660
"paramStructure": "by-position",
1866118661
"params": [
1866218662
{
@@ -22086,7 +22086,7 @@
2208622086
{
2208722087
"name": "Filecoin.StateMinerInitialPledgeCollateral",
2208822088
"description": "```go\nfunc (s *FullNodeStruct) StateMinerInitialPledgeCollateral(p0 context.Context, p1 address.Address, p2 miner.SectorPreCommitInfo, p3 types.TipSetKey) (types.BigInt, error) {\n\tif s.Internal.StateMinerInitialPledgeCollateral == nil {\n\t\treturn *new(types.BigInt), ErrNotSupported\n\t}\n\treturn s.Internal.StateMinerInitialPledgeCollateral(p0, p1, p2, p3)\n}\n```",
22089-
"summary": "StateMinerInitialPledgeCollateral attempts to calculate the initial pledge collateral based on a SectorPreCommitInfo.\nThis method uses the DealIDs field in SectorPreCommitInfo to determine the amount of verified\ndeal space in the sector in order to perform a QAP calculation. Since network version 22 and\nthe introduction of DDO, the DealIDs field can no longer be used to reliably determine verified\ndeal space; therefore, this method is deprecated. Use StateMinerInitialPledgeForSector instead\nand pass in the verified deal space directly.\n\nDeprecated: Use StateMinerInitialPledgeForSector instead.\n",
22089+
"summary": "StateMinerInitialPledgeCollateral attempts to calculate the initial pledge collateral based on a SectorPreCommitInfo.\nThis method uses the DealIDs field in SectorPreCommitInfo to determine the amount of verified\ndeal space in the sector in order to perform a QAP calculation. Since network version 22 and\nthe introduction of DDO, the DealIDs field can no longer be used to reliably determine verified\ndeal space; therefore, this method is deprecated. Use StateMinerInitialPledgeForSector instead\nand pass in the verified deal space directly.\nNote: The value returned is overestimated by 10% (multiplied by 110/100).\nSee: node/impl/full/state.go StateMinerInitialPledgeCollateral implementation.\n\nDeprecated: Use StateMinerInitialPledgeForSector instead.\n",
2209022090
"paramStructure": "by-position",
2209122091
"params": [
2209222092
{
@@ -22218,7 +22218,7 @@
2221822218
{
2221922219
"name": "Filecoin.StateMinerInitialPledgeForSector",
2222022220
"description": "```go\nfunc (s *FullNodeStruct) StateMinerInitialPledgeForSector(p0 context.Context, p1 abi.ChainEpoch, p2 abi.SectorSize, p3 uint64, p4 types.TipSetKey) (types.BigInt, error) {\n\tif s.Internal.StateMinerInitialPledgeForSector == nil {\n\t\treturn *new(types.BigInt), ErrNotSupported\n\t}\n\treturn s.Internal.StateMinerInitialPledgeForSector(p0, p1, p2, p3, p4)\n}\n```",
22221-
"summary": "StateMinerInitialPledgeForSector returns the initial pledge collateral for a given sector\nduration, size, and combined size of any verified pieces within the sector. This calculation\ndepends on current network conditions (total power, total pledge and current rewards) at the\ngiven tipset.\n",
22221+
"summary": "StateMinerInitialPledgeForSector returns the initial pledge collateral for a given sector\nduration, size, and combined size of any verified pieces within the sector. This calculation\ndepends on current network conditions (total power, total pledge and current rewards) at the\ngiven tipset.\nNote: The value returned is overestimated by 10% (multiplied by 110/100).\nSee: node/impl/full/state.go StateMinerInitialPledgeForSector implementation.\n",
2222222222
"paramStructure": "by-position",
2222322223
"params": [
2222422224
{
@@ -22569,7 +22569,7 @@
2256922569
{
2257022570
"name": "Filecoin.StateMinerPreCommitDepositForPower",
2257122571
"description": "```go\nfunc (s *FullNodeStruct) StateMinerPreCommitDepositForPower(p0 context.Context, p1 address.Address, p2 miner.SectorPreCommitInfo, p3 types.TipSetKey) (types.BigInt, error) {\n\tif s.Internal.StateMinerPreCommitDepositForPower == nil {\n\t\treturn *new(types.BigInt), ErrNotSupported\n\t}\n\treturn s.Internal.StateMinerPreCommitDepositForPower(p0, p1, p2, p3)\n}\n```",
22572-
"summary": "StateMinerPreCommitDepositForPower returns the precommit deposit for the specified miner's sector\n",
22572+
"summary": "StateMinerPreCommitDepositForPower returns the precommit deposit for the specified miner's sector\nNote: The value returned is overestimated by 10% (multiplied by 110/100).\nSee: node/impl/full/state.go StateMinerPreCommitDepositForPower implementation.\n",
2257322573
"paramStructure": "by-position",
2257422574
"params": [
2257522575
{

documentation/en/api-v1-unstable-methods.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6430,6 +6430,8 @@ Response:
64306430
### StateDealProviderCollateralBounds
64316431
StateDealProviderCollateralBounds returns the min and max collateral a storage provider
64326432
can issue. It takes the deal size and verified status as parameters.
6433+
Note: The min value returned is overestimated by 10% (multiplied by 110/100).
6434+
See: node/impl/full/state.go StateDealProviderCollateralBounds implementation.
64336435

64346436

64356437
Perms: read
@@ -7476,6 +7478,8 @@ deal space in the sector in order to perform a QAP calculation. Since network ve
74767478
the introduction of DDO, the DealIDs field can no longer be used to reliably determine verified
74777479
deal space; therefore, this method is deprecated. Use StateMinerInitialPledgeForSector instead
74787480
and pass in the verified deal space directly.
7481+
Note: The value returned is overestimated by 10% (multiplied by 110/100).
7482+
See: node/impl/full/state.go StateMinerInitialPledgeCollateral implementation.
74797483

74807484
Deprecated: Use StateMinerInitialPledgeForSector instead.
74817485

@@ -7519,6 +7523,8 @@ StateMinerInitialPledgeForSector returns the initial pledge collateral for a giv
75197523
duration, size, and combined size of any verified pieces within the sector. This calculation
75207524
depends on current network conditions (total power, total pledge and current rewards) at the
75217525
given tipset.
7526+
Note: The value returned is overestimated by 10% (multiplied by 110/100).
7527+
See: node/impl/full/state.go StateMinerInitialPledgeForSector implementation.
75227528

75237529

75247530
Perms: read
@@ -7630,6 +7636,8 @@ Response:
76307636

76317637
### StateMinerPreCommitDepositForPower
76327638
StateMinerPreCommitDepositForPower returns the precommit deposit for the specified miner's sector
7639+
Note: The value returned is overestimated by 10% (multiplied by 110/100).
7640+
See: node/impl/full/state.go StateMinerPreCommitDepositForPower implementation.
76337641

76347642

76357643
Perms: read

0 commit comments

Comments
 (0)