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

update specactors #4469

Merged
merged 1 commit into from
Jun 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions app/client/v0api/full.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ import (
"io"
"time"

"github.com/ipfs/go-cid"
ipld "github.com/ipfs/go-ipld-format"
"github.com/libp2p/go-libp2p-core/metrics"
"github.com/libp2p/go-libp2p-core/peer"
ma "github.com/multiformats/go-multiaddr"

"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-bitfield"
"github.com/filecoin-project/go-jsonrpc/auth"
Expand All @@ -24,11 +30,6 @@ import (
pstate "github.com/filecoin-project/venus/pkg/state"
"github.com/filecoin-project/venus/pkg/types"
"github.com/filecoin-project/venus/pkg/wallet"
"github.com/ipfs/go-cid"
ipld "github.com/ipfs/go-ipld-format"
"github.com/libp2p/go-libp2p-core/metrics"
"github.com/libp2p/go-libp2p-core/peer"
ma "github.com/multiformats/go-multiaddr"
)

type FullNodeStruct struct {
Expand Down
5 changes: 1 addition & 4 deletions app/submodule/apiface/multisig.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@ import (
)

type IMultiSig interface {
// MsigCreate creates a multisig wallet
// It takes the following params: <required number of senders>, <approving addresses>, <unlock duration>
//<initial balance>, <sender address of the create msg>, <gas price>
// Rule[perm:read]
MsigCreate(context.Context, uint64, []address.Address, abi.ChainEpoch, types.BigInt, address.Address, types.BigInt) (*apitypes.MessagePrototype, error)
MsigCreate(ctx context.Context, req uint64, addrs []address.Address, duration abi.ChainEpoch, val types.BigInt, src address.Address, gp types.BigInt) (*apitypes.MessagePrototype, error)
// Rule[perm:read]
MsigPropose(ctx context.Context, msig address.Address, to address.Address, amt types.BigInt, src address.Address, method uint64, params []byte) (*apitypes.MessagePrototype, error)
// Rule[perm:read]
Expand Down
6 changes: 3 additions & 3 deletions pkg/specactors/policy/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,13 +278,13 @@ func GetMaxSectorExpirationExtension() abi.ChainEpoch {
return miner5.MaxSectorExpirationExtension
}

// TODO: we'll probably need to abstract over this better in the future.
func GetMaxPoStPartitions(p abi.RegisteredPoStProof) (int, error) {
func GetMaxPoStPartitions(nv network.Version, p abi.RegisteredPoStProof) (int, error) {
sectorsPerPart, err := builtin5.PoStProofWindowPoStPartitionSectors(p)
if err != nil {
return 0, err
}
return int(miner5.AddressedSectorsMax / sectorsPerPart), nil
maxSectors := uint64(GetAddressedSectorsMax(nv))
return int(maxSectors / sectorsPerPart), nil
}

func GetDefaultSectorSize() abi.SectorSize {
Expand Down
6 changes: 3 additions & 3 deletions pkg/specactors/policy/policy.go.template
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,13 @@ func GetMaxSectorExpirationExtension() abi.ChainEpoch {
return miner{{.latestVersion}}.MaxSectorExpirationExtension
}

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

func GetDefaultSectorSize() abi.SectorSize {
Expand Down
10 changes: 10 additions & 0 deletions pkg/specactors/policy/policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"testing"

"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"
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
paych0 "github.com/filecoin-project/specs-actors/actors/builtin/paych"
Expand Down Expand Up @@ -72,3 +73,12 @@ func TestPartitionSizes(t *testing.T) {
require.Equal(t, sizeOld, sizeNew)
}
}

func TestPoStSize(t *testing.T) {
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)
}