Skip to content

Commit 8eeb804

Browse files
authored
update specactors (#4469)
1 parent db726fe commit 8eeb804

File tree

5 files changed

+23
-15
lines changed

5 files changed

+23
-15
lines changed

app/client/v0api/full.go

+6-5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ import (
55
"io"
66
"time"
77

8+
"github.com/ipfs/go-cid"
9+
ipld "github.com/ipfs/go-ipld-format"
10+
"github.com/libp2p/go-libp2p-core/metrics"
11+
"github.com/libp2p/go-libp2p-core/peer"
12+
ma "github.com/multiformats/go-multiaddr"
13+
814
"github.com/filecoin-project/go-address"
915
"github.com/filecoin-project/go-bitfield"
1016
"github.com/filecoin-project/go-jsonrpc/auth"
@@ -24,11 +30,6 @@ import (
2430
pstate "github.com/filecoin-project/venus/pkg/state"
2531
"github.com/filecoin-project/venus/pkg/types"
2632
"github.com/filecoin-project/venus/pkg/wallet"
27-
"github.com/ipfs/go-cid"
28-
ipld "github.com/ipfs/go-ipld-format"
29-
"github.com/libp2p/go-libp2p-core/metrics"
30-
"github.com/libp2p/go-libp2p-core/peer"
31-
ma "github.com/multiformats/go-multiaddr"
3233
)
3334

3435
type FullNodeStruct struct {

app/submodule/apiface/multisig.go

+1-4
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,8 @@ import (
1010
)
1111

1212
type IMultiSig interface {
13-
// MsigCreate creates a multisig wallet
14-
// It takes the following params: <required number of senders>, <approving addresses>, <unlock duration>
15-
//<initial balance>, <sender address of the create msg>, <gas price>
1613
// Rule[perm:read]
17-
MsigCreate(context.Context, uint64, []address.Address, abi.ChainEpoch, types.BigInt, address.Address, types.BigInt) (*apitypes.MessagePrototype, error)
14+
MsigCreate(ctx context.Context, req uint64, addrs []address.Address, duration abi.ChainEpoch, val types.BigInt, src address.Address, gp types.BigInt) (*apitypes.MessagePrototype, error)
1815
// Rule[perm:read]
1916
MsigPropose(ctx context.Context, msig address.Address, to address.Address, amt types.BigInt, src address.Address, method uint64, params []byte) (*apitypes.MessagePrototype, error)
2017
// Rule[perm:read]

pkg/specactors/policy/policy.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -278,13 +278,13 @@ func GetMaxSectorExpirationExtension() abi.ChainEpoch {
278278
return miner5.MaxSectorExpirationExtension
279279
}
280280

281-
// TODO: we'll probably need to abstract over this better in the future.
282-
func GetMaxPoStPartitions(p abi.RegisteredPoStProof) (int, error) {
281+
func GetMaxPoStPartitions(nv network.Version, p abi.RegisteredPoStProof) (int, error) {
283282
sectorsPerPart, err := builtin5.PoStProofWindowPoStPartitionSectors(p)
284283
if err != nil {
285284
return 0, err
286285
}
287-
return int(miner5.AddressedSectorsMax / sectorsPerPart), nil
286+
maxSectors := uint64(GetAddressedSectorsMax(nv))
287+
return int(maxSectors / sectorsPerPart), nil
288288
}
289289

290290
func GetDefaultSectorSize() abi.SectorSize {

pkg/specactors/policy/policy.go.template

+3-3
Original file line numberDiff line numberDiff line change
@@ -182,13 +182,13 @@ func GetMaxSectorExpirationExtension() abi.ChainEpoch {
182182
return miner{{.latestVersion}}.MaxSectorExpirationExtension
183183
}
184184

185-
// TODO: we'll probably need to abstract over this better in the future.
186-
func GetMaxPoStPartitions(p abi.RegisteredPoStProof) (int, error) {
185+
func GetMaxPoStPartitions(nv network.Version, p abi.RegisteredPoStProof) (int, error) {
187186
sectorsPerPart, err := builtin{{.latestVersion}}.PoStProofWindowPoStPartitionSectors(p)
188187
if err != nil {
189188
return 0, err
190189
}
191-
return int(miner{{.latestVersion}}.AddressedSectorsMax / sectorsPerPart), nil
190+
maxSectors := uint64(GetAddressedSectorsMax(nv))
191+
return int(maxSectors / sectorsPerPart), nil
192192
}
193193

194194
func GetDefaultSectorSize() abi.SectorSize {

pkg/specactors/policy/policy_test.go

+10
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"testing"
55

66
"github.com/filecoin-project/go-state-types/abi"
7+
"github.com/filecoin-project/go-state-types/network"
78
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
89
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
910
paych0 "github.com/filecoin-project/specs-actors/actors/builtin/paych"
@@ -72,3 +73,12 @@ func TestPartitionSizes(t *testing.T) {
7273
require.Equal(t, sizeOld, sizeNew)
7374
}
7475
}
76+
77+
func TestPoStSize(t *testing.T) {
78+
v12PoStSize, err := GetMaxPoStPartitions(network.Version12, abi.RegisteredPoStProof_StackedDrgWindow64GiBV1)
79+
require.Equal(t, 4, v12PoStSize)
80+
require.NoError(t, err)
81+
v13PoStSize, err := GetMaxPoStPartitions(network.Version13, abi.RegisteredPoStProof_StackedDrgWindow64GiBV1)
82+
require.NoError(t, err)
83+
require.Equal(t, 10, v13PoStSize)
84+
}

0 commit comments

Comments
 (0)