4-stage v23 lotus-bench
This commit is contained in:
parent
d5b8defcbb
commit
5a4f917c60
@ -7,8 +7,6 @@ import (
|
|||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-sectorbuilder"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// alias because cbor-gen doesn't like non-alias types
|
// alias because cbor-gen doesn't like non-alias types
|
||||||
@ -105,12 +103,35 @@ type StorageMiner interface {
|
|||||||
|
|
||||||
SectorsUpdate(context.Context, abi.SectorNumber, SectorState) error
|
SectorsUpdate(context.Context, abi.SectorNumber, SectorState) error
|
||||||
|
|
||||||
WorkerStats(context.Context) (sectorbuilder.WorkerStats, error)
|
WorkerStats(context.Context) (WorkerStats, error)
|
||||||
|
|
||||||
// WorkerQueue registers a remote worker
|
// WorkerQueue registers a remote worker
|
||||||
WorkerQueue(context.Context, sectorbuilder.WorkerCfg) (<-chan sectorbuilder.WorkerTask, error)
|
WorkerQueue(context.Context, WorkerCfg) (<-chan WorkerTask, error)
|
||||||
|
|
||||||
WorkerDone(ctx context.Context, task uint64, res sectorbuilder.SealRes) error
|
WorkerDone(ctx context.Context, task uint64, res SealRes) error
|
||||||
|
}
|
||||||
|
|
||||||
|
type WorkerStats struct {
|
||||||
|
Total int
|
||||||
|
Free int
|
||||||
|
|
||||||
|
AddPieceWait int
|
||||||
|
PreCommitWait int
|
||||||
|
CommitWait int
|
||||||
|
UnsealWait int
|
||||||
|
}
|
||||||
|
|
||||||
|
type WorkerTask struct {
|
||||||
|
}
|
||||||
|
type WorkerCfg struct {
|
||||||
|
NoPreCommit bool
|
||||||
|
NoCommit bool
|
||||||
|
}
|
||||||
|
type SealRes struct {
|
||||||
|
Err string
|
||||||
|
GoErr error `json:"-"`
|
||||||
|
|
||||||
|
Proof []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
type SectorLog struct {
|
type SectorLog struct {
|
||||||
|
@ -101,7 +101,7 @@ type FullNodeStruct struct {
|
|||||||
ClientGetDealInfo func(context.Context, cid.Cid) (*api.DealInfo, error) `perm:"read"`
|
ClientGetDealInfo func(context.Context, cid.Cid) (*api.DealInfo, error) `perm:"read"`
|
||||||
ClientListDeals func(ctx context.Context) ([]api.DealInfo, error) `perm:"write"`
|
ClientListDeals func(ctx context.Context) ([]api.DealInfo, error) `perm:"write"`
|
||||||
ClientRetrieve func(ctx context.Context, order api.RetrievalOrder, path string) error `perm:"admin"`
|
ClientRetrieve func(ctx context.Context, order api.RetrievalOrder, path string) error `perm:"admin"`
|
||||||
ClientQueryAsk func(ctx context.Context, p peer.ID, miner address.Address) (*storagemarket.SignedStorageAsk, error) `perm:"read"`
|
ClientQueryAsk func(ctx context.Context, p peer.ID, miner address.Address) (*storagemarket.SignedStorageAsk, error) `perm:"read"`
|
||||||
|
|
||||||
StateMinerSectors func(context.Context, address.Address, types.TipSetKey) ([]*api.ChainSectorInfo, error) `perm:"read"`
|
StateMinerSectors func(context.Context, address.Address, types.TipSetKey) ([]*api.ChainSectorInfo, error) `perm:"read"`
|
||||||
StateMinerProvingSet func(context.Context, address.Address, types.TipSetKey) ([]*api.ChainSectorInfo, error) `perm:"read"`
|
StateMinerProvingSet func(context.Context, address.Address, types.TipSetKey) ([]*api.ChainSectorInfo, error) `perm:"read"`
|
||||||
@ -144,7 +144,7 @@ type FullNodeStruct struct {
|
|||||||
PaychVoucherCheckValid func(context.Context, address.Address, *paych.SignedVoucher) error `perm:"read"`
|
PaychVoucherCheckValid func(context.Context, address.Address, *paych.SignedVoucher) error `perm:"read"`
|
||||||
PaychVoucherCheckSpendable func(context.Context, address.Address, *paych.SignedVoucher, []byte, []byte) (bool, error) `perm:"read"`
|
PaychVoucherCheckSpendable func(context.Context, address.Address, *paych.SignedVoucher, []byte, []byte) (bool, error) `perm:"read"`
|
||||||
PaychVoucherAdd func(context.Context, address.Address, *paych.SignedVoucher, []byte, types.BigInt) (types.BigInt, error) `perm:"write"`
|
PaychVoucherAdd func(context.Context, address.Address, *paych.SignedVoucher, []byte, types.BigInt) (types.BigInt, error) `perm:"write"`
|
||||||
PaychVoucherCreate func(context.Context, address.Address, big.Int, uint64) (*paych.SignedVoucher, error) `perm:"sign"`
|
PaychVoucherCreate func(context.Context, address.Address, big.Int, uint64) (*paych.SignedVoucher, error) `perm:"sign"`
|
||||||
PaychVoucherList func(context.Context, address.Address) ([]*paych.SignedVoucher, error) `perm:"write"`
|
PaychVoucherList func(context.Context, address.Address) ([]*paych.SignedVoucher, error) `perm:"write"`
|
||||||
PaychVoucherSubmit func(context.Context, address.Address, *paych.SignedVoucher) (cid.Cid, error) `perm:"sign"`
|
PaychVoucherSubmit func(context.Context, address.Address, *paych.SignedVoucher) (cid.Cid, error) `perm:"sign"`
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package types
|
package types
|
||||||
|
|
||||||
import(
|
import (
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
|
|
||||||
"github.com/filecoin-project/specs-actors/actors/builtin/paych"
|
"github.com/filecoin-project/specs-actors/actors/builtin/paych"
|
||||||
|
@ -14,8 +14,8 @@ import (
|
|||||||
|
|
||||||
"github.com/docker/go-units"
|
"github.com/docker/go-units"
|
||||||
paramfetch "github.com/filecoin-project/go-paramfetch"
|
paramfetch "github.com/filecoin-project/go-paramfetch"
|
||||||
|
"github.com/filecoin-project/go-sectorbuilder/fs"
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
"github.com/ipfs/go-datastore"
|
|
||||||
logging "github.com/ipfs/go-log/v2"
|
logging "github.com/ipfs/go-log/v2"
|
||||||
"github.com/mitchellh/go-homedir"
|
"github.com/mitchellh/go-homedir"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
@ -23,6 +23,7 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/go-sectorbuilder"
|
"github.com/filecoin-project/go-sectorbuilder"
|
||||||
|
|
||||||
lapi "github.com/filecoin-project/lotus/api"
|
lapi "github.com/filecoin-project/lotus/api"
|
||||||
"github.com/filecoin-project/lotus/build"
|
"github.com/filecoin-project/lotus/build"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
@ -44,11 +45,13 @@ type BenchResults struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type SealingResult struct {
|
type SealingResult struct {
|
||||||
AddPiece time.Duration
|
AddPiece time.Duration
|
||||||
PreCommit time.Duration
|
PreCommit1 time.Duration
|
||||||
Commit time.Duration
|
PreCommit2 time.Duration
|
||||||
Verify time.Duration
|
Commit1 time.Duration
|
||||||
Unseal time.Duration
|
Commit2 time.Duration
|
||||||
|
Verify time.Duration
|
||||||
|
Unseal time.Duration
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -70,7 +73,7 @@ func main() {
|
|||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "sector-size",
|
Name: "sector-size",
|
||||||
Value: "1GiB",
|
Value: "512MiB",
|
||||||
Usage: "size of the sectors in bytes, i.e. 32GiB",
|
Usage: "size of the sectors in bytes, i.e. 32GiB",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
&cli.BoolFlag{
|
||||||
@ -80,7 +83,7 @@ func main() {
|
|||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "miner-addr",
|
Name: "miner-addr",
|
||||||
Usage: "pass miner address (only necessary if using existing sectorbuilder)",
|
Usage: "pass miner address (only necessary if using existing sectorbuilder)",
|
||||||
Value: "t0101",
|
Value: "t01000",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "benchmark-existing-sectorbuilder",
|
Name: "benchmark-existing-sectorbuilder",
|
||||||
@ -146,13 +149,10 @@ func main() {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
mds := datastore.NewMapDatastore()
|
|
||||||
cfg := §orbuilder.Config{
|
cfg := §orbuilder.Config{
|
||||||
Miner: maddr,
|
Miner: maddr,
|
||||||
SealProofType: spt,
|
SealProofType: spt,
|
||||||
PoStProofType: ppt,
|
PoStProofType: ppt,
|
||||||
WorkerThreads: 2,
|
|
||||||
Paths: sectorbuilder.SimplePath(sbdir),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if robench == "" {
|
if robench == "" {
|
||||||
@ -164,7 +164,14 @@ func main() {
|
|||||||
if err := paramfetch.GetParams(build.ParametersJson(), uint64(sectorSize)); err != nil {
|
if err := paramfetch.GetParams(build.ParametersJson(), uint64(sectorSize)); err != nil {
|
||||||
return xerrors.Errorf("getting params: %w", err)
|
return xerrors.Errorf("getting params: %w", err)
|
||||||
}
|
}
|
||||||
sb, err := sectorbuilder.New(cfg, mds)
|
|
||||||
|
sbfs := &fs.Basic{
|
||||||
|
Miner: maddr,
|
||||||
|
NextID: 1,
|
||||||
|
Root: sbdir,
|
||||||
|
}
|
||||||
|
|
||||||
|
sb, err := sectorbuilder.New(sbfs, cfg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -195,14 +202,22 @@ func main() {
|
|||||||
trand := sha256.Sum256([]byte(c.String("ticket-preimage")))
|
trand := sha256.Sum256([]byte(c.String("ticket-preimage")))
|
||||||
ticket := abi.SealRandomness(trand[:])
|
ticket := abi.SealRandomness(trand[:])
|
||||||
|
|
||||||
log.Info("Running replication...")
|
log.Info("Running replication(1)...")
|
||||||
pieces := []abi.PieceInfo{pi}
|
pieces := []abi.PieceInfo{pi}
|
||||||
commR, commD, err := sb.SealPreCommit(context.TODO(), i, ticket, pieces)
|
pc1o, err := sb.SealPreCommit1(context.TODO(), i, ticket, pieces)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("commit: %w", err)
|
return xerrors.Errorf("commit: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
precommit := time.Now()
|
precommit1 := time.Now()
|
||||||
|
|
||||||
|
log.Info("Running replication(2)...")
|
||||||
|
commR, commD, err := sb.SealPreCommit2(context.TODO(), i, pc1o)
|
||||||
|
if err != nil {
|
||||||
|
return xerrors.Errorf("commit: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
precommit2 := time.Now()
|
||||||
|
|
||||||
sealedSectors = append(sealedSectors, abi.SectorInfo{
|
sealedSectors = append(sealedSectors, abi.SectorInfo{
|
||||||
RegisteredProof: ppt,
|
RegisteredProof: ppt,
|
||||||
@ -215,13 +230,22 @@ func main() {
|
|||||||
Value: []byte{1, 2, 3, 4, 5},
|
Value: []byte{1, 2, 3, 4, 5},
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Info("Generating PoRep for sector")
|
log.Info("Generating PoRep for sector (1)")
|
||||||
proof, err := sb.SealCommit(context.TODO(), i, ticket, seed.Value, pieces, commR, commD)
|
c1o, err := sb.SealCommit1(context.TODO(), i, ticket, seed.Value, pieces, commR, commD)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
sealcommit := time.Now()
|
sealcommit1 := time.Now()
|
||||||
|
|
||||||
|
log.Info("Generating PoRep for sector (2)")
|
||||||
|
|
||||||
|
proof, err := sb.SealCommit2(context.TODO(), i, c1o)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
sealcommit2 := time.Now()
|
||||||
|
|
||||||
svi := abi.SealVerifyInfo{
|
svi := abi.SealVerifyInfo{
|
||||||
SectorID: abi.SectorID{Miner: abi.ActorID(mid), Number: i},
|
SectorID: abi.SectorID{Miner: abi.ActorID(mid), Number: i},
|
||||||
@ -263,11 +287,13 @@ func main() {
|
|||||||
unseal := time.Now()
|
unseal := time.Now()
|
||||||
|
|
||||||
sealTimings = append(sealTimings, SealingResult{
|
sealTimings = append(sealTimings, SealingResult{
|
||||||
AddPiece: addpiece.Sub(start),
|
AddPiece: addpiece.Sub(start),
|
||||||
PreCommit: precommit.Sub(addpiece),
|
PreCommit1: precommit1.Sub(addpiece),
|
||||||
Commit: sealcommit.Sub(precommit),
|
PreCommit2: precommit2.Sub(precommit1),
|
||||||
Verify: verifySeal.Sub(sealcommit),
|
Commit1: sealcommit1.Sub(precommit2),
|
||||||
Unseal: unseal.Sub(verifySeal),
|
Commit2: sealcommit2.Sub(sealcommit1),
|
||||||
|
Verify: verifySeal.Sub(sealcommit2),
|
||||||
|
Unseal: unseal.Sub(verifySeal),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -390,11 +416,13 @@ func main() {
|
|||||||
|
|
||||||
fmt.Println(string(data))
|
fmt.Println(string(data))
|
||||||
} else {
|
} else {
|
||||||
fmt.Printf("results (%d)\n", sectorSize)
|
fmt.Printf("----\nresults (v23) (%d)\n", sectorSize)
|
||||||
if robench == "" {
|
if robench == "" {
|
||||||
fmt.Printf("seal: addPiece: %s (%s)\n", bo.SealingResults[0].AddPiece, bps(bo.SectorSize, bo.SealingResults[0].AddPiece)) // TODO: average across multiple sealings
|
fmt.Printf("seal: addPiece: %s (%s)\n", bo.SealingResults[0].AddPiece, bps(bo.SectorSize, bo.SealingResults[0].AddPiece)) // TODO: average across multiple sealings
|
||||||
fmt.Printf("seal: preCommit: %s (%s)\n", bo.SealingResults[0].PreCommit, bps(bo.SectorSize, bo.SealingResults[0].PreCommit))
|
fmt.Printf("seal: preCommit phase 1: %s (%s)\n", bo.SealingResults[0].PreCommit1, bps(bo.SectorSize, bo.SealingResults[0].PreCommit1))
|
||||||
fmt.Printf("seal: commit: %s (%s)\n", bo.SealingResults[0].Commit, bps(bo.SectorSize, bo.SealingResults[0].Commit))
|
fmt.Printf("seal: preCommit phase 2: %s (%s)\n", bo.SealingResults[0].PreCommit2, bps(bo.SectorSize, bo.SealingResults[0].PreCommit2))
|
||||||
|
fmt.Printf("seal: commit phase 1: %s (%s)\n", bo.SealingResults[0].Commit1, bps(bo.SectorSize, bo.SealingResults[0].Commit1))
|
||||||
|
fmt.Printf("seal: commit phase 2: %s (%s)\n", bo.SealingResults[0].Commit2, bps(bo.SectorSize, bo.SealingResults[0].Commit2))
|
||||||
fmt.Printf("seal: verify: %s\n", bo.SealingResults[0].Verify)
|
fmt.Printf("seal: verify: %s\n", bo.SealingResults[0].Verify)
|
||||||
if !c.Bool("skip-unseal") {
|
if !c.Bool("skip-unseal") {
|
||||||
fmt.Printf("unseal: %s (%s)\n", bo.SealingResults[0].Unseal, bps(bo.SectorSize, bo.SealingResults[0].Unseal))
|
fmt.Printf("unseal: %s (%s)\n", bo.SealingResults[0].Unseal, bps(bo.SectorSize, bo.SealingResults[0].Unseal))
|
||||||
|
@ -198,7 +198,7 @@ func (sb *SBMock) SealCommit1(ctx context.Context, sid abi.SectorNumber, ticket
|
|||||||
|
|
||||||
var out [32]byte
|
var out [32]byte
|
||||||
for i := range out {
|
for i := range out {
|
||||||
out[i] = unsealed.Bytes()[i] + sealedCid.Bytes()[31-i] - ticket[i]*seed[i] ^ byte(sid & 0xff)
|
out[i] = unsealed.Bytes()[i] + sealedCid.Bytes()[31-i] - ticket[i]*seed[i] ^ byte(sid&0xff)
|
||||||
}
|
}
|
||||||
|
|
||||||
return out[:], nil
|
return out[:], nil
|
||||||
@ -207,7 +207,7 @@ func (sb *SBMock) SealCommit1(ctx context.Context, sid abi.SectorNumber, ticket
|
|||||||
func (sb *SBMock) SealCommit2(ctx context.Context, sectorNum abi.SectorNumber, phase1Out []byte) (proof []byte, err error) {
|
func (sb *SBMock) SealCommit2(ctx context.Context, sectorNum abi.SectorNumber, phase1Out []byte) (proof []byte, err error) {
|
||||||
var out [32]byte
|
var out [32]byte
|
||||||
for i := range out {
|
for i := range out {
|
||||||
out[i] = phase1Out[i] ^ byte(sectorNum & 0xff)
|
out[i] = phase1Out[i] ^ byte(sectorNum&0xff)
|
||||||
}
|
}
|
||||||
|
|
||||||
return out[:], nil
|
return out[:], nil
|
||||||
|
Loading…
Reference in New Issue
Block a user