feat: limit PoSted partitions to 3
This commit is contained in:
parent
d09d549db7
commit
2a644e2c04
@ -622,7 +622,8 @@ func GetMaxPoStPartitions(nv network.Version, p abi.RegisteredPoStProof) (int, e
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
return int(uint64(maxSectors) / sectorsPerPart), nil
|
|
||||||
|
return min(miner12.PoStedPartitionsMax, int(uint64(maxSectors)/sectorsPerPart)), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetDefaultAggregationProof() abi.RegisteredAggregationProof {
|
func GetDefaultAggregationProof() abi.RegisteredAggregationProof {
|
||||||
@ -865,3 +866,10 @@ func AggregatePreCommitNetworkFee(nwVer network.Version, aggregateSize int, base
|
|||||||
return big.Zero(), xerrors.Errorf("unsupported network version")
|
return big.Zero(), xerrors.Errorf("unsupported network version")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func min(a, b int) int {
|
||||||
|
if a < b {
|
||||||
|
return a
|
||||||
|
}
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
@ -252,7 +252,8 @@ func GetMaxPoStPartitions(nv network.Version, p abi.RegisteredPoStProof) (int, e
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
return int(uint64(maxSectors) / sectorsPerPart), nil
|
|
||||||
|
return min(miner{{.latestVersion}}.PoStedPartitionsMax, int(uint64(maxSectors) / sectorsPerPart)), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetDefaultAggregationProof() abi.RegisteredAggregationProof {
|
func GetDefaultAggregationProof() abi.RegisteredAggregationProof {
|
||||||
@ -341,3 +342,10 @@ func AggregatePreCommitNetworkFee(nwVer network.Version, aggregateSize int, base
|
|||||||
return big.Zero(), xerrors.Errorf("unsupported network version")
|
return big.Zero(), xerrors.Errorf("unsupported network version")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func min(a, b int) int {
|
||||||
|
if a < b {
|
||||||
|
return a
|
||||||
|
}
|
||||||
|
return b
|
||||||
|
}
|
@ -7,7 +7,6 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/filecoin-project/go-state-types/network"
|
|
||||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||||
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||||
paych0 "github.com/filecoin-project/specs-actors/actors/builtin/paych"
|
paych0 "github.com/filecoin-project/specs-actors/actors/builtin/paych"
|
||||||
@ -74,13 +73,3 @@ func TestPartitionSizes(t *testing.T) {
|
|||||||
require.Equal(t, sizeOld, sizeNew)
|
require.Equal(t, sizeOld, sizeNew)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPoStSize(t *testing.T) {
|
|
||||||
//stm: @BLOCKCHAIN_POLICY_GET_MAX_POST_PARTITIONS_001
|
|
||||||
v12PoStSize, err := GetMaxPoStPartitions(network.Version12, abi.RegisteredPoStProof_StackedDrgWindow64GiBV1)
|
|
||||||
require.Equal(t, 4, v12PoStSize)
|
|
||||||
require.NoError(t, err)
|
|
||||||
v13PoStSize, err := GetMaxPoStPartitions(network.Version13, abi.RegisteredPoStProof_StackedDrgWindow64GiBV1)
|
|
||||||
require.NoError(t, err)
|
|
||||||
require.Equal(t, 10, v13PoStSize)
|
|
||||||
}
|
|
||||||
|
@ -427,13 +427,10 @@
|
|||||||
# env var: LOTUS_PROVING_DISABLEWDPOSTPRECHECKS
|
# env var: LOTUS_PROVING_DISABLEWDPOSTPRECHECKS
|
||||||
#DisableWDPoStPreChecks = false
|
#DisableWDPoStPreChecks = false
|
||||||
|
|
||||||
# Maximum number of partitions to prove in a single SubmitWindowPoSt messace. 0 = network limit (10 in nv16)
|
# Maximum number of partitions to prove in a single SubmitWindowPoSt messace. 0 = network limit (3 in nv21)
|
||||||
#
|
#
|
||||||
# A single partition may contain up to 2349 32GiB sectors, or 2300 64GiB sectors.
|
# A single partition may contain up to 2349 32GiB sectors, or 2300 64GiB sectors.
|
||||||
#
|
# //
|
||||||
# The maximum number of sectors which can be proven in a single PoSt message is 25000 in network version 16, which
|
|
||||||
# means that a single message can prove at most 10 partitions
|
|
||||||
#
|
|
||||||
# Note that setting this value lower may result in less efficient gas use - more messages will be sent,
|
# Note that setting this value lower may result in less efficient gas use - more messages will be sent,
|
||||||
# to prove each deadline, resulting in more total gas use (but each message will have lower gas limit)
|
# to prove each deadline, resulting in more total gas use (but each message will have lower gas limit)
|
||||||
#
|
#
|
||||||
|
2
go.mod
2
go.mod
@ -45,7 +45,7 @@ require (
|
|||||||
github.com/filecoin-project/go-jsonrpc v0.3.1
|
github.com/filecoin-project/go-jsonrpc v0.3.1
|
||||||
github.com/filecoin-project/go-padreader v0.0.1
|
github.com/filecoin-project/go-padreader v0.0.1
|
||||||
github.com/filecoin-project/go-paramfetch v0.0.4
|
github.com/filecoin-project/go-paramfetch v0.0.4
|
||||||
github.com/filecoin-project/go-state-types v0.12.4-0.20231002153316-c656c180c4d2
|
github.com/filecoin-project/go-state-types v0.12.4
|
||||||
github.com/filecoin-project/go-statemachine v1.0.3
|
github.com/filecoin-project/go-statemachine v1.0.3
|
||||||
github.com/filecoin-project/go-statestore v0.2.0
|
github.com/filecoin-project/go-statestore v0.2.0
|
||||||
github.com/filecoin-project/go-storedcounter v0.1.0
|
github.com/filecoin-project/go-storedcounter v0.1.0
|
||||||
|
4
go.sum
4
go.sum
@ -338,8 +338,8 @@ github.com/filecoin-project/go-state-types v0.1.0/go.mod h1:ezYnPf0bNkTsDibL/psS
|
|||||||
github.com/filecoin-project/go-state-types v0.1.6/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q=
|
github.com/filecoin-project/go-state-types v0.1.6/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q=
|
||||||
github.com/filecoin-project/go-state-types v0.1.10/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q=
|
github.com/filecoin-project/go-state-types v0.1.10/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q=
|
||||||
github.com/filecoin-project/go-state-types v0.11.2-0.20230712101859-8f37624fa540/go.mod h1:SyNPwTsU7I22gL2r0OAPcImvLoTVfgRwdK/Y5rR1zz8=
|
github.com/filecoin-project/go-state-types v0.11.2-0.20230712101859-8f37624fa540/go.mod h1:SyNPwTsU7I22gL2r0OAPcImvLoTVfgRwdK/Y5rR1zz8=
|
||||||
github.com/filecoin-project/go-state-types v0.12.4-0.20231002153316-c656c180c4d2 h1:eZvCTWl1Z3FxKB45gKN4RdDbaI0qBt+w2mG/lFEE3rs=
|
github.com/filecoin-project/go-state-types v0.12.4 h1:F1yQRCgFGvg+UmBGWxskHcvNswjh061Ok/kOk0OWhQY=
|
||||||
github.com/filecoin-project/go-state-types v0.12.4-0.20231002153316-c656c180c4d2/go.mod h1:iJTqGdWDvzXhuVf64Lw0hzt4TIoitMo0VgHdxdjNDZI=
|
github.com/filecoin-project/go-state-types v0.12.4/go.mod h1:iJTqGdWDvzXhuVf64Lw0hzt4TIoitMo0VgHdxdjNDZI=
|
||||||
github.com/filecoin-project/go-statemachine v0.0.0-20200925024713-05bd7c71fbfe/go.mod h1:FGwQgZAt2Gh5mjlwJUlVB62JeYdo+if0xWxSEfBD9ig=
|
github.com/filecoin-project/go-statemachine v0.0.0-20200925024713-05bd7c71fbfe/go.mod h1:FGwQgZAt2Gh5mjlwJUlVB62JeYdo+if0xWxSEfBD9ig=
|
||||||
github.com/filecoin-project/go-statemachine v1.0.3 h1:N07o6alys+V1tNoSTi4WuuoeNC4erS/6jE74+NsgQuk=
|
github.com/filecoin-project/go-statemachine v1.0.3 h1:N07o6alys+V1tNoSTi4WuuoeNC4erS/6jE74+NsgQuk=
|
||||||
github.com/filecoin-project/go-statemachine v1.0.3/go.mod h1:jZdXXiHa61n4NmgWFG4w8tnqgvZVHYbJ3yW7+y8bF54=
|
github.com/filecoin-project/go-statemachine v1.0.3/go.mod h1:jZdXXiHa61n4NmgWFG4w8tnqgvZVHYbJ3yW7+y8bF54=
|
||||||
|
@ -853,13 +853,10 @@ After changing this option, confirm that the new value works in your setup by in
|
|||||||
Name: "MaxPartitionsPerPoStMessage",
|
Name: "MaxPartitionsPerPoStMessage",
|
||||||
Type: "int",
|
Type: "int",
|
||||||
|
|
||||||
Comment: `Maximum number of partitions to prove in a single SubmitWindowPoSt messace. 0 = network limit (10 in nv16)
|
Comment: `Maximum number of partitions to prove in a single SubmitWindowPoSt messace. 0 = network limit (3 in nv21)
|
||||||
|
|
||||||
A single partition may contain up to 2349 32GiB sectors, or 2300 64GiB sectors.
|
A single partition may contain up to 2349 32GiB sectors, or 2300 64GiB sectors.
|
||||||
|
//
|
||||||
The maximum number of sectors which can be proven in a single PoSt message is 25000 in network version 16, which
|
|
||||||
means that a single message can prove at most 10 partitions
|
|
||||||
|
|
||||||
Note that setting this value lower may result in less efficient gas use - more messages will be sent,
|
Note that setting this value lower may result in less efficient gas use - more messages will be sent,
|
||||||
to prove each deadline, resulting in more total gas use (but each message will have lower gas limit)
|
to prove each deadline, resulting in more total gas use (but each message will have lower gas limit)
|
||||||
|
|
||||||
|
@ -290,13 +290,10 @@ type ProvingConfig struct {
|
|||||||
// 'lotus-miner proving compute window-post 0'
|
// 'lotus-miner proving compute window-post 0'
|
||||||
DisableWDPoStPreChecks bool
|
DisableWDPoStPreChecks bool
|
||||||
|
|
||||||
// Maximum number of partitions to prove in a single SubmitWindowPoSt messace. 0 = network limit (10 in nv16)
|
// Maximum number of partitions to prove in a single SubmitWindowPoSt messace. 0 = network limit (3 in nv21)
|
||||||
//
|
//
|
||||||
// A single partition may contain up to 2349 32GiB sectors, or 2300 64GiB sectors.
|
// A single partition may contain up to 2349 32GiB sectors, or 2300 64GiB sectors.
|
||||||
//
|
// //
|
||||||
// The maximum number of sectors which can be proven in a single PoSt message is 25000 in network version 16, which
|
|
||||||
// means that a single message can prove at most 10 partitions
|
|
||||||
//
|
|
||||||
// Note that setting this value lower may result in less efficient gas use - more messages will be sent,
|
// Note that setting this value lower may result in less efficient gas use - more messages will be sent,
|
||||||
// to prove each deadline, resulting in more total gas use (but each message will have lower gas limit)
|
// to prove each deadline, resulting in more total gas use (but each message will have lower gas limit)
|
||||||
//
|
//
|
||||||
|
@ -937,7 +937,8 @@ func (a *StateAPI) stateComputeDataCIDv1(ctx context.Context, maddr address.Addr
|
|||||||
To: market.Address,
|
To: market.Address,
|
||||||
From: maddr,
|
From: maddr,
|
||||||
Value: types.NewInt(0),
|
Value: types.NewInt(0),
|
||||||
Method: market.Methods.ComputeDataCommitment,
|
// Hard coded, because the method has since been deprecated
|
||||||
|
Method: 8,
|
||||||
Params: ccparams,
|
Params: ccparams,
|
||||||
}
|
}
|
||||||
r, err := a.StateCall(ctx, ccmt, tsk)
|
r, err := a.StateCall(ctx, ccmt, tsk)
|
||||||
@ -974,7 +975,8 @@ func (a *StateAPI) stateComputeDataCIDv2(ctx context.Context, maddr address.Addr
|
|||||||
To: market.Address,
|
To: market.Address,
|
||||||
From: maddr,
|
From: maddr,
|
||||||
Value: types.NewInt(0),
|
Value: types.NewInt(0),
|
||||||
Method: market.Methods.ComputeDataCommitment,
|
// Hard coded, because the method has since been deprecated
|
||||||
|
Method: 8,
|
||||||
Params: ccparams,
|
Params: ccparams,
|
||||||
}
|
}
|
||||||
r, err := a.StateCall(ctx, ccmt, tsk)
|
r, err := a.StateCall(ctx, ccmt, tsk)
|
||||||
|
@ -298,7 +298,7 @@ func TestWDPostDoPostPartLimitConfig(t *testing.T) {
|
|||||||
//stm: @CHAIN_SYNCER_COLLECT_CHAIN_001, @CHAIN_SYNCER_COLLECT_HEADERS_001, @CHAIN_SYNCER_VALIDATE_TIPSET_001
|
//stm: @CHAIN_SYNCER_COLLECT_CHAIN_001, @CHAIN_SYNCER_COLLECT_HEADERS_001, @CHAIN_SYNCER_VALIDATE_TIPSET_001
|
||||||
//stm: @CHAIN_SYNCER_NEW_PEER_HEAD_001, @CHAIN_SYNCER_VALIDATE_MESSAGE_META_001, @CHAIN_SYNCER_STOP_001
|
//stm: @CHAIN_SYNCER_NEW_PEER_HEAD_001, @CHAIN_SYNCER_VALIDATE_MESSAGE_META_001, @CHAIN_SYNCER_STOP_001
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
expectedMsgCount := 364
|
expectedMsgCount := 8
|
||||||
|
|
||||||
proofType := abi.RegisteredPoStProof_StackedDrgWindow2KiBV1
|
proofType := abi.RegisteredPoStProof_StackedDrgWindow2KiBV1
|
||||||
postAct := tutils.NewIDAddr(t, 100)
|
postAct := tutils.NewIDAddr(t, 100)
|
||||||
@ -318,15 +318,15 @@ func TestWDPostDoPostPartLimitConfig(t *testing.T) {
|
|||||||
partitionsPerMsg = minertypes.AddressedPartitionsMax
|
partitionsPerMsg = minertypes.AddressedPartitionsMax
|
||||||
}
|
}
|
||||||
|
|
||||||
partitionCount := 4 * partitionsPerMsg
|
partitionCount := 5 * partitionsPerMsg
|
||||||
|
|
||||||
// Assert that user config is less than network limit
|
// Assert that user config is less than network limit
|
||||||
userPartLimit := 33
|
userPartLimit := 2
|
||||||
lastMsgParts := 21
|
lastMsgParts := 1
|
||||||
require.Greater(t, partitionCount, userPartLimit)
|
require.Greater(t, partitionsPerMsg, userPartLimit)
|
||||||
|
|
||||||
// Assert that we consts are correct
|
// Assert that we consts are correct
|
||||||
require.Equal(t, (expectedMsgCount-1)*userPartLimit+lastMsgParts, 4*partitionsPerMsg)
|
require.Equal(t, (expectedMsgCount-1)*userPartLimit+lastMsgParts, partitionCount)
|
||||||
|
|
||||||
var partitions []api.Partition
|
var partitions []api.Partition
|
||||||
for p := 0; p < partitionCount; p++ {
|
for p := 0; p < partitionCount; p++ {
|
||||||
@ -398,7 +398,7 @@ func TestBatchPartitionsRecoverySectors(t *testing.T) {
|
|||||||
|
|
||||||
mockStgMinerAPI := newMockStorageMinerAPI()
|
mockStgMinerAPI := newMockStorageMinerAPI()
|
||||||
|
|
||||||
userPartLimit := 4
|
userPartLimit := 2
|
||||||
|
|
||||||
scheduler := &WindowPoStScheduler{
|
scheduler := &WindowPoStScheduler{
|
||||||
api: mockStgMinerAPI,
|
api: mockStgMinerAPI,
|
||||||
@ -426,12 +426,12 @@ func TestBatchPartitionsRecoverySectors(t *testing.T) {
|
|||||||
}
|
}
|
||||||
partitions = append(partitions, generatePartition(100, 10))
|
partitions = append(partitions, generatePartition(100, 10))
|
||||||
|
|
||||||
expectedBatchLens := []int{4, 1, 1, 4, 2, 1}
|
expectedBatchLens := []int{2, 2, 1, 1, 2, 2, 2, 1}
|
||||||
|
|
||||||
batches, err := scheduler.BatchPartitions(partitions, network.Version16)
|
batches, err := scheduler.BatchPartitions(partitions, network.Version21)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
require.Equal(t, len(batches), 6)
|
require.Equal(t, len(batches), len(expectedBatchLens))
|
||||||
|
|
||||||
for i, batch := range batches {
|
for i, batch := range batches {
|
||||||
require.Equal(t, len(batch), expectedBatchLens[i])
|
require.Equal(t, len(batch), expectedBatchLens[i])
|
||||||
|
Loading…
Reference in New Issue
Block a user