From 1bc55714edf12c0df593163b15fed7a8b0fdad3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Sat, 14 Mar 2020 03:44:05 +0100 Subject: [PATCH 1/4] Update to v24 params --- build/proof-params/parameters.json | 97 +++++++++++++++--------------- extern/filecoin-ffi | 2 +- go.mod | 2 +- go.sum | 4 +- 4 files changed, 52 insertions(+), 53 deletions(-) diff --git a/build/proof-params/parameters.json b/build/proof-params/parameters.json index 1a1b000c4..8591c1218 100644 --- a/build/proof-params/parameters.json +++ b/build/proof-params/parameters.json @@ -1,83 +1,82 @@ - { - "v23-proof-of-spacetime-election-PoseidonHasher-0b0b9781bcb153efbb3cab4be3a792c4f555d4ab6f8dd62b27e1dcad08a34f22.params": { - "cid": "Qmcqu1sgXs8p1mn8n9bCYovGgarCK5LvqFWbrCnYDxxjnq", - "digest": "558ff029bef32ed76d87f5e448a03bd3", + "v24-proof-of-spacetime-election-PoseidonHasher-0b0b9781bcb153efbb3cab4be3a792c4f555d4ab6f8dd62b27e1dcad08a34f22.params": { + "cid": "QmUonpeUaLD6G4byFdZAMzwXorD4Qs1XDjmdXFbWYCgvjW", + "digest": "19e50903e53c826ff66f360283f324c1", "sector_size": 34359738368 }, - "v23-proof-of-spacetime-election-PoseidonHasher-0b0b9781bcb153efbb3cab4be3a792c4f555d4ab6f8dd62b27e1dcad08a34f22.vk": { - "cid": "QmS1SdHpnipjjcbnEG6b9T2q4rF6h8hc1jtZgEn5XBXW4o", - "digest": "2eca950d71d47b54125446f58d997035", + "v24-proof-of-spacetime-election-PoseidonHasher-0b0b9781bcb153efbb3cab4be3a792c4f555d4ab6f8dd62b27e1dcad08a34f22.vk": { + "cid": "QmVXv4Q1T3FbiY5AUgWER11Lsrby9aUVJy2mgWDWrndFbq", + "digest": "223dd87c6161c45daf448ca9eda28298", "sector_size": 34359738368 }, - "v23-proof-of-spacetime-election-PoseidonHasher-0b499a953f1a9dcab420b3ba1e6b1f3952dc7f17cf67ed10406ae9a43e2b8ec5.params": { - "cid": "QmbuwgxzqLKKutGBR4ay7jfPWATNynYUMGrwj8jCMG2pwN", - "digest": "7f9c06a57c8f2c029de378d63ba0b4c8", + "v24-proof-of-spacetime-election-PoseidonHasher-0b499a953f1a9dcab420b3ba1e6b1f3952dc7f17cf67ed10406ae9a43e2b8ec5.params": { + "cid": "Qmea7VsrYnkrpdMnutkGKppX5finoDwCA2fP5Zg5bDuBQw", + "digest": "3de5b8738a2cd933c214fa2023e30909", "sector_size": 8388608 }, - "v23-proof-of-spacetime-election-PoseidonHasher-0b499a953f1a9dcab420b3ba1e6b1f3952dc7f17cf67ed10406ae9a43e2b8ec5.vk": { - "cid": "QmXt3hXJR4XjdE3uLyhTYvRuCLhCkmfGnK9sbYXmGZ4mgs", - "digest": "2565ed8c01783d1fc8c6b1814a84dfbb", + "v24-proof-of-spacetime-election-PoseidonHasher-0b499a953f1a9dcab420b3ba1e6b1f3952dc7f17cf67ed10406ae9a43e2b8ec5.vk": { + "cid": "QmavFXmf3jeacHKB6HoJH3gUqzmKnsDn5F5HSYfwPbDHRu", + "digest": "485b7eab4f70031fdda4eaeccfe4f26e", "sector_size": 8388608 }, - "v23-proof-of-spacetime-election-PoseidonHasher-27a7fc680a47e4821f40cf1676fb80b9888820ef6867a71a175b4c9ae068ad3f.params": { - "cid": "QmXn1SNAERUJWXkkdEUcYLTpsde6KStUPWpG5jCZNjDphy", - "digest": "21b612f054cead6cb7416932c98ad93d", + "v24-proof-of-spacetime-election-PoseidonHasher-27a7fc680a47e4821f40cf1676fb80b9888820ef6867a71a175b4c9ae068ad3f.params": { + "cid": "QmQrUjB9NSMuThe1JHoHfC7u1xdoLS6WLu15waWcnZ3tQT", + "digest": "7e6adc7cbf73db8c95a54e3c23bea1ae", "sector_size": 536870912 }, - "v23-proof-of-spacetime-election-PoseidonHasher-27a7fc680a47e4821f40cf1676fb80b9888820ef6867a71a175b4c9ae068ad3f.vk": { - "cid": "QmS2b2157k1MgyAtdC8cP4wAxau4PbJPCLzaqx9hxgpbe7", - "digest": "4a198ab9cf20245e1783d346d0ba7fe5", + "v24-proof-of-spacetime-election-PoseidonHasher-27a7fc680a47e4821f40cf1676fb80b9888820ef6867a71a175b4c9ae068ad3f.vk": { + "cid": "QmVPPk4fBcEero2GHsYuBoh97yhugTBWUp9yWSPPWjRWQ7", + "digest": "952b352d694d650e912b3b92ad63f7c9", "sector_size": 536870912 }, - "v23-proof-of-spacetime-election-PoseidonHasher-5916054ae98e28fc2f0470d1fb58eb875a6865be86f0b8c4e302d55f13217fef.params": { - "cid": "QmPY3BG7gZmQKnprsepGfgHdS5MwjV9Cqqi4YrYJZyvRuv", - "digest": "386a70fe0e4ce16942b99e0694a3ce84", + "v24-proof-of-spacetime-election-PoseidonHasher-5916054ae98e28fc2f0470d1fb58eb875a6865be86f0b8c4e302d55f13217fef.params": { + "cid": "QmSXMF85mdGLQfAY98zVL4dUBpGPFFUPDmFzdc1NZrVFdh", + "digest": "a93de0f8cfb04af5d21f66ef48ee59a8", "sector_size": 2048 }, - "v23-proof-of-spacetime-election-PoseidonHasher-5916054ae98e28fc2f0470d1fb58eb875a6865be86f0b8c4e302d55f13217fef.vk": { - "cid": "QmTikzLJfqC1izpbZP2BEw5GWAEJrUiKzWj4EyCPBtqgVT", - "digest": "c1750423edbd09ec94fcbc8538209f1a", + "v24-proof-of-spacetime-election-PoseidonHasher-5916054ae98e28fc2f0470d1fb58eb875a6865be86f0b8c4e302d55f13217fef.vk": { + "cid": "QmaTsAmbdnQtJoSpkWsXmvHPpMJinzFYTe6t5LLm7w5RtQ", + "digest": "e4d0575f119e3e7b42bc3e5b6bb35a0b", "sector_size": 2048 }, - "v23-stacked-proof-of-replication-PoseidonHasher-Sha256Hasher-49442c8ce7545579cbd689d578301d0cc1e46e94e2499a0ec36de7ff4f4694a2.params": { - "cid": "QmdkRUVf7iBA5qYv5WFKdBN5fzsmGrKLRJs3F8PtR3azAc", - "digest": "d8a4f1ff91b7b0395bae850d1277fc74", + "v24-stacked-proof-of-replication-PoseidonHasher-Sha256Hasher-49442c8ce7545579cbd689d578301d0cc1e46e94e2499a0ec36de7ff4f4694a2.params": { + "cid": "QmYCFrU4G2LakPngFXayX7afyondQbB9hfnVRz1ffWD9MS", + "digest": "d64e5d1bbb9120bea4c0cd8cdcdfb834", "sector_size": 8388608 }, - "v23-stacked-proof-of-replication-PoseidonHasher-Sha256Hasher-49442c8ce7545579cbd689d578301d0cc1e46e94e2499a0ec36de7ff4f4694a2.vk": { - "cid": "Qmdmrp75NToB9b6vxh5gZcECEHiGxxP8NRLhcVt7B9SjqQ", - "digest": "ad2d7a1931ffb996278245cda162a2ea", + "v24-stacked-proof-of-replication-PoseidonHasher-Sha256Hasher-49442c8ce7545579cbd689d578301d0cc1e46e94e2499a0ec36de7ff4f4694a2.vk": { + "cid": "QmfXAPtHKU2MJVJDwLTUCM4W2tYQ8biGq9cZaAnjtaZidZ", + "digest": "572536e8684454a5cd80361e5c952b38", "sector_size": 8388608 }, - "v23-stacked-proof-of-replication-PoseidonHasher-Sha256Hasher-d84aa4581c74190f845596893ebe5b71da32ecf16e1d151b9fff74ee8f94d77c.params": { - "cid": "QmcAn3A6iBPAcvHZWv4CG2KDg73T9kE5VvLYe9XrEmVQQd", - "digest": "dccdeb3bed61a7ca0184241c290970c9", + "v24-stacked-proof-of-replication-PoseidonHasher-Sha256Hasher-d84aa4581c74190f845596893ebe5b71da32ecf16e1d151b9fff74ee8f94d77c.params": { + "cid": "QmdXtQsLbBFmVxrd6kWKr2FYbQfhEdR6PinwrGBXhHmLdT", + "digest": "77cfafee088bd59411d766621df6de42", "sector_size": 536870912 }, - "v23-stacked-proof-of-replication-PoseidonHasher-Sha256Hasher-d84aa4581c74190f845596893ebe5b71da32ecf16e1d151b9fff74ee8f94d77c.vk": { - "cid": "QmWwLsV5wrkoWhrTmQCE62J5o3tmdvFDTznEy4N1Wsknqg", - "digest": "ce3d9951ebde0b10419339f26d604ba7", + "v24-stacked-proof-of-replication-PoseidonHasher-Sha256Hasher-d84aa4581c74190f845596893ebe5b71da32ecf16e1d151b9fff74ee8f94d77c.vk": { + "cid": "QmdE8oZJofaenThLi2TWXJPk9cExZgTA36TjrHeAC65BGA", + "digest": "30586a2396ef6b60b122ac5a2ba87681", "sector_size": 536870912 }, - "v23-stacked-proof-of-replication-PoseidonHasher-Sha256Hasher-fc32be6028c2398175466f36fa36810842ae8948fae15c84454af5b61ca99e15.params": { - "cid": "Qmama5rJYTHFQbjamAuv3nyrJ8TYwg38hyKTs5rHM4F1s5", - "digest": "d600e36f91e0ec5d1e44aa9de0cc2901", + "v24-stacked-proof-of-replication-PoseidonHasher-Sha256Hasher-fc32be6028c2398175466f36fa36810842ae8948fae15c84454af5b61ca99e15.params": { + "cid": "QmNqcqGxf7pJjipHNwcH44D5KgiTUNo3mK5HiSxBwYcjkx", + "digest": "25ea39db2a003c817113f6f2ea936b3d", "sector_size": 34359738368 }, - "v23-stacked-proof-of-replication-PoseidonHasher-Sha256Hasher-fc32be6028c2398175466f36fa36810842ae8948fae15c84454af5b61ca99e15.vk": { - "cid": "QmXnCBjLn8mJhQibrmdzwD8LKWVJf8MZvqTNSYYBZnfC7M", - "digest": "5fdf47c8b367f9dfa4d763eb70bef759", + "v24-stacked-proof-of-replication-PoseidonHasher-Sha256Hasher-fc32be6028c2398175466f36fa36810842ae8948fae15c84454af5b61ca99e15.vk": { + "cid": "QmWiaqy8hWshv2FsLDoZAtpJKZng5QN3x2X5C7xsPvSbFb", + "digest": "ab1239c802c480cf12f63d13fb2f620a", "sector_size": 34359738368 }, - "v23-stacked-proof-of-replication-PoseidonHasher-Sha256Hasher-fe437922fe766f61b112750506d6be0e4ad5daa85ff9ce96549d99253ba61cbe.params": { - "cid": "QmPUL7h51m671KGZaKB6nruAXtzFbMVwHousSnrPP4QtCH", - "digest": "fcd772f59cdb2d1124fe0edc8b402bda", + "v24-stacked-proof-of-replication-PoseidonHasher-Sha256Hasher-fe437922fe766f61b112750506d6be0e4ad5daa85ff9ce96549d99253ba61cbe.params": { + "cid": "QmbPk3fKKLjkm6pD1CzwGyTnMwNSSZVxVSMWEceqSv6LDW", + "digest": "76bd3702312cfe0d69bb5e0891c52615", "sector_size": 2048 }, - "v23-stacked-proof-of-replication-PoseidonHasher-Sha256Hasher-fe437922fe766f61b112750506d6be0e4ad5daa85ff9ce96549d99253ba61cbe.vk": { - "cid": "QmaBZ83AuRzWkAT3QNtt5H7kQMnf5YT66ah6Q7DDMy6N9K", - "digest": "4ce2e879f537d085d872cae46f0b3365", + "v24-stacked-proof-of-replication-PoseidonHasher-Sha256Hasher-fe437922fe766f61b112750506d6be0e4ad5daa85ff9ce96549d99253ba61cbe.vk": { + "cid": "QmPZ9bGSVs5GHQRRAtC1qv9eQ7GPoH8FWukjxAXtXXcTxg", + "digest": "4edb21b7b6d5787b646f3e336e06303e", "sector_size": 2048 } } diff --git a/extern/filecoin-ffi b/extern/filecoin-ffi index 4446ff8a1..f20cfbe28 160000 --- a/extern/filecoin-ffi +++ b/extern/filecoin-ffi @@ -1 +1 @@ -Subproject commit 4446ff8a1bb9115703010e6fa7e94b7f7dbf5618 +Subproject commit f20cfbe28d99beda69e5416c6829927945116428 diff --git a/go.mod b/go.mod index 9ed763841..7cf2b95ed 100644 --- a/go.mod +++ b/go.mod @@ -22,7 +22,7 @@ require ( github.com/filecoin-project/go-fil-markets v0.0.0-20200304003055-d449a980d4bd github.com/filecoin-project/go-padreader v0.0.0-20200210211231-548257017ca6 github.com/filecoin-project/go-paramfetch v0.0.2-0.20200218225740-47c639bab663 - github.com/filecoin-project/go-sectorbuilder v0.0.2-0.20200309211213-75e9124a1904 + github.com/filecoin-project/go-sectorbuilder v0.0.2-0.20200314022627-38af9db49ba2 github.com/filecoin-project/go-statemachine v0.0.0-20200226041606-2074af6d51d9 github.com/filecoin-project/go-statestore v0.1.0 github.com/filecoin-project/specs-actors v0.0.0-20200311215506-e95895452888 diff --git a/go.sum b/go.sum index 5a582e695..b24ce8be3 100644 --- a/go.sum +++ b/go.sum @@ -124,8 +124,8 @@ github.com/filecoin-project/go-padreader v0.0.0-20200210211231-548257017ca6/go.m github.com/filecoin-project/go-paramfetch v0.0.2-0.20200218225740-47c639bab663 h1:eYxi6vI5CyeXD15X1bB3bledDXbqKxqf0wQzTLgwYwA= github.com/filecoin-project/go-paramfetch v0.0.2-0.20200218225740-47c639bab663/go.mod h1:fZzmf4tftbwf9S37XRifoJlz7nCjRdIrMGLR07dKLCc= github.com/filecoin-project/go-sectorbuilder v0.0.2-0.20200226210935-4739f8749f56/go.mod h1:tzTc9BxxSbjlIzhFwm5h9oBkXKkRuLxeiWspntwnKyw= -github.com/filecoin-project/go-sectorbuilder v0.0.2-0.20200309211213-75e9124a1904 h1:yz9PqcRxTx3WsmbGoNRRvU2HfD5+B5YCxu2c3iFa6+o= -github.com/filecoin-project/go-sectorbuilder v0.0.2-0.20200309211213-75e9124a1904/go.mod h1:NcE+iL0bbYnamGmYQgCPVGbSaf8VF2/CLra/61B3I3I= +github.com/filecoin-project/go-sectorbuilder v0.0.2-0.20200314022627-38af9db49ba2 h1:4RjDynwobd/UYlZUprRg/GMEsMP6fAfVRTXgFs4XNfo= +github.com/filecoin-project/go-sectorbuilder v0.0.2-0.20200314022627-38af9db49ba2/go.mod h1:NcE+iL0bbYnamGmYQgCPVGbSaf8VF2/CLra/61B3I3I= github.com/filecoin-project/go-statemachine v0.0.0-20200226041606-2074af6d51d9 h1:k9qVR9ItcziSB2rxtlkN/MDWNlbsI6yzec+zjUatLW0= github.com/filecoin-project/go-statemachine v0.0.0-20200226041606-2074af6d51d9/go.mod h1:FGwQgZAt2Gh5mjlwJUlVB62JeYdo+if0xWxSEfBD9ig= github.com/filecoin-project/go-statestore v0.1.0 h1:t56reH59843TwXHkMcwyuayStBIiWBRilQjQ+5IiwdQ= From 630df050c0f6ad0e3ab0fd67c6d6a3e289afa12f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Sun, 15 Mar 2020 18:48:27 +0100 Subject: [PATCH 2/4] bench: Option to skip commit2 --- cmd/lotus-bench/main.go | 237 ++++++++++++++++++++++------------------ 1 file changed, 128 insertions(+), 109 deletions(-) diff --git a/cmd/lotus-bench/main.go b/cmd/lotus-bench/main.go index 1180a5723..80e58a48d 100644 --- a/cmd/lotus-bench/main.go +++ b/cmd/lotus-bench/main.go @@ -13,16 +13,17 @@ import ( "time" "github.com/docker/go-units" - paramfetch "github.com/filecoin-project/go-paramfetch" - "github.com/filecoin-project/go-sectorbuilder/fs" - "github.com/filecoin-project/specs-actors/actors/abi" logging "github.com/ipfs/go-log/v2" "github.com/mitchellh/go-homedir" "golang.org/x/xerrors" "gopkg.in/urfave/cli.v2" "github.com/filecoin-project/go-address" + paramfetch "github.com/filecoin-project/go-paramfetch" "github.com/filecoin-project/go-sectorbuilder" + "github.com/filecoin-project/go-sectorbuilder/fs" + "github.com/filecoin-project/specs-actors/actors/abi" + "github.com/filecoin-project/specs-storage/storage" lapi "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/build" @@ -102,6 +103,10 @@ func main() { Name: "json-out", Usage: "output results in json format", }, + &cli.BoolFlag{ + Name: "skip-commit2", + Usage: "skip the commit2 (snark) portion of the benchmark", + }, &cli.BoolFlag{ Name: "skip-unseal", Usage: "skip the unseal portion of the benchmark", @@ -174,8 +179,10 @@ func main() { } } - if err := paramfetch.GetParams(build.ParametersJson(), uint64(sectorSize)); err != nil { - return xerrors.Errorf("getting params: %w", err) + if !c.Bool("skip-commit2") { + if err := paramfetch.GetParams(build.ParametersJson(), uint64(sectorSize)); err != nil { + return xerrors.Errorf("getting params: %w", err) + } } sbfs := &fs.Basic{ @@ -269,41 +276,48 @@ func main() { } } - proof, err := sb.SealCommit2(context.TODO(), i, c1o) - if err != nil { - return err + var proof storage.Proof + if !c.Bool("skip-commit2") { + proof, err = sb.SealCommit2(context.TODO(), i, c1o) + if err != nil { + return err + } } sealcommit2 := time.Now() - svi := abi.SealVerifyInfo{ - SectorID: abi.SectorID{Miner: mid, Number: i}, - OnChain: abi.OnChainSealVerifyInfo{ - SealedCID: commR, - InteractiveEpoch: seed.Epoch, - RegisteredProof: spt, - Proof: proof, - DealIDs: nil, - SectorNumber: i, - SealRandEpoch: 0, - }, - Randomness: ticket, - InteractiveRandomness: seed.Value, - UnsealedCID: commD, - } + if !c.Bool("skip-commit2") { - ok, err := sectorbuilder.ProofVerifier.VerifySeal(svi) - if err != nil { - return err - } - if !ok { - return xerrors.Errorf("porep proof for sector %d was invalid", i) + svi := abi.SealVerifyInfo{ + SectorID: abi.SectorID{Miner: mid, Number: i}, + OnChain: abi.OnChainSealVerifyInfo{ + SealedCID: commR, + InteractiveEpoch: seed.Epoch, + RegisteredProof: spt, + Proof: proof, + DealIDs: nil, + SectorNumber: i, + SealRandEpoch: 0, + }, + Randomness: ticket, + InteractiveRandomness: seed.Value, + UnsealedCID: commD, + } + + ok, err := sectorbuilder.ProofVerifier.VerifySeal(svi) + if err != nil { + return err + } + if !ok { + return xerrors.Errorf("porep proof for sector %d was invalid", i) + } } verifySeal := time.Now() if !c.Bool("skip-unseal") { log.Info("Unsealing sector") + // TODO: RM unsealed sector first rc, err := sb.ReadPieceFromSealedSector(context.TODO(), 1, 0, abi.UnpaddedPieceSize(sectorSize), ticket, commD) if err != nil { return err @@ -359,84 +373,87 @@ func main() { } } - log.Info("generating election post candidates") - fcandidates, err := sb.GenerateEPostCandidates(sealedSectors, challenge[:], []abi.SectorNumber{}) - if err != nil { - return err - } - - var candidates []abi.PoStCandidate - for _, c := range fcandidates { - c.Candidate.RegisteredProof = ppt - candidates = append(candidates, c.Candidate) - } - - gencandidates := time.Now() - - log.Info("computing election post snark (cold)") - proof1, err := sb.ComputeElectionPoSt(sealedSectors, challenge[:], candidates[:1]) - if err != nil { - return err - } - - epost1 := time.Now() - - log.Info("computing election post snark (hot)") - proof2, err := sb.ComputeElectionPoSt(sealedSectors, challenge[:], candidates[:1]) - if err != nil { - return err - } - - epost2 := time.Now() - - ccount := sectorbuilder.ElectionPostChallengeCount(uint64(len(sealedSectors)), 0) - - pvi1 := abi.PoStVerifyInfo{ - Randomness: abi.PoStRandomness(challenge[:]), - Candidates: candidates[:1], - Proofs: proof1, - EligibleSectors: sealedSectors, - Prover: mid, - ChallengeCount: ccount, - } - ok, err := sectorbuilder.ProofVerifier.VerifyElectionPost(context.TODO(), pvi1) - if err != nil { - return err - } - if !ok { - log.Error("post verification failed") - } - - verifypost1 := time.Now() - - pvi2 := abi.PoStVerifyInfo{ - Randomness: abi.PoStRandomness(challenge[:]), - Candidates: candidates[:1], - Proofs: proof2, - EligibleSectors: sealedSectors, - Prover: mid, - ChallengeCount: ccount, - } - - ok, err = sectorbuilder.ProofVerifier.VerifyElectionPost(context.TODO(), pvi2) - if err != nil { - return err - } - if !ok { - log.Error("post verification failed") - } - verifypost2 := time.Now() - bo := BenchResults{ SectorSize: sectorSize, SealingResults: sealTimings, + } + + if !c.Bool("skip-commit2") { + log.Info("generating election post candidates") + fcandidates, err := sb.GenerateEPostCandidates(sealedSectors, challenge[:], []abi.SectorNumber{}) + if err != nil { + return err + } + + var candidates []abi.PoStCandidate + for _, c := range fcandidates { + c.Candidate.RegisteredProof = ppt + candidates = append(candidates, c.Candidate) + } + + gencandidates := time.Now() + + log.Info("computing election post snark (cold)") + proof1, err := sb.ComputeElectionPoSt(sealedSectors, challenge[:], candidates[:1]) + if err != nil { + return err + } + + epost1 := time.Now() + + log.Info("computing election post snark (hot)") + proof2, err := sb.ComputeElectionPoSt(sealedSectors, challenge[:], candidates[:1]) + if err != nil { + return err + } + + epost2 := time.Now() + + ccount := sectorbuilder.ElectionPostChallengeCount(uint64(len(sealedSectors)), 0) + + pvi1 := abi.PoStVerifyInfo{ + Randomness: abi.PoStRandomness(challenge[:]), + Candidates: candidates[:1], + Proofs: proof1, + EligibleSectors: sealedSectors, + Prover: mid, + ChallengeCount: ccount, + } + ok, err := sectorbuilder.ProofVerifier.VerifyElectionPost(context.TODO(), pvi1) + if err != nil { + return err + } + if !ok { + log.Error("post verification failed") + } + + verifypost1 := time.Now() + + pvi2 := abi.PoStVerifyInfo{ + Randomness: abi.PoStRandomness(challenge[:]), + Candidates: candidates[:1], + Proofs: proof2, + EligibleSectors: sealedSectors, + Prover: mid, + ChallengeCount: ccount, + } + + ok, err = sectorbuilder.ProofVerifier.VerifyElectionPost(context.TODO(), pvi2) + if err != nil { + return err + } + if !ok { + log.Error("post verification failed") + } + verifypost2 := time.Now() + + bo.PostGenerateCandidates = gencandidates.Sub(beforePost) + bo.PostEProofCold = epost1.Sub(gencandidates) + bo.PostEProofHot = epost2.Sub(epost1) + bo.VerifyEPostCold = verifypost1.Sub(epost2) + bo.VerifyEPostHot = verifypost2.Sub(verifypost1) + } - PostGenerateCandidates: gencandidates.Sub(beforePost), - PostEProofCold: epost1.Sub(gencandidates), - PostEProofHot: epost2.Sub(epost1), - VerifyEPostCold: verifypost1.Sub(epost2), - VerifyEPostHot: verifypost2.Sub(verifypost1), - } // TODO: optionally write this as json to a file if c.Bool("json-out") { data, err := json.MarshalIndent(bo, "", " ") @@ -446,7 +463,7 @@ func main() { fmt.Println(string(data)) } else { - fmt.Printf("----\nresults (v23) (%d)\n", sectorSize) + fmt.Printf("----\nresults (v24) (%d)\n", sectorSize) 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: preCommit phase 1: %s (%s)\n", bo.SealingResults[0].PreCommit1, bps(bo.SectorSize, bo.SealingResults[0].PreCommit1)) @@ -458,11 +475,13 @@ func main() { fmt.Printf("unseal: %s (%s)\n", bo.SealingResults[0].Unseal, bps(bo.SectorSize, bo.SealingResults[0].Unseal)) } } - fmt.Printf("generate candidates: %s (%s)\n", bo.PostGenerateCandidates, bps(bo.SectorSize*abi.SectorSize(len(bo.SealingResults)), bo.PostGenerateCandidates)) - fmt.Printf("compute epost proof (cold): %s\n", bo.PostEProofCold) - fmt.Printf("compute epost proof (hot): %s\n", bo.PostEProofHot) - fmt.Printf("verify epost proof (cold): %s\n", bo.VerifyEPostCold) - fmt.Printf("verify epost proof (hot): %s\n", bo.VerifyEPostHot) + if !c.Bool("skip-commit2") { + fmt.Printf("generate candidates: %s (%s)\n", bo.PostGenerateCandidates, bps(bo.SectorSize*abi.SectorSize(len(bo.SealingResults)), bo.PostGenerateCandidates)) + fmt.Printf("compute epost proof (cold): %s\n", bo.PostEProofCold) + fmt.Printf("compute epost proof (hot): %s\n", bo.PostEProofHot) + fmt.Printf("verify epost proof (cold): %s\n", bo.VerifyEPostCold) + fmt.Printf("verify epost proof (hot): %s\n", bo.VerifyEPostHot) + } } return nil }, From a71906525af1dc533a22bc2461cb9d7a71f469f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Sun, 15 Mar 2020 21:42:44 +0100 Subject: [PATCH 3/4] seed: Support parsing string sector-size --- cmd/lotus-seed/main.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/cmd/lotus-seed/main.go b/cmd/lotus-seed/main.go index 2daa83325..eb901cb43 100644 --- a/cmd/lotus-seed/main.go +++ b/cmd/lotus-seed/main.go @@ -4,6 +4,7 @@ import ( "encoding/hex" "encoding/json" "fmt" + "github.com/docker/go-units" "io/ioutil" "os" @@ -62,9 +63,9 @@ var preSealCmd = &cli.Command{ Value: "t01000", Usage: "specify the future address of your miner", }, - &cli.Uint64Flag{ + &cli.StringFlag{ Name: "sector-size", - Value: uint64(build.SectorSizes[0]), + Value: "2KiB", Usage: "specify size of sectors to pre-seal", }, &cli.StringFlag{ @@ -113,7 +114,13 @@ var preSealCmd = &cli.Command{ } } - rp, _, err := lapi.ProofTypeFromSectorSize(abi.SectorSize(c.Uint64("sector-size"))) + sectorSizeInt, err := units.RAMInBytes(c.String("sector-size")) + if err != nil { + return err + } + sectorSize := abi.SectorSize(sectorSizeInt) + + rp, _, err := lapi.ProofTypeFromSectorSize(sectorSize) if err != nil { return err } From 1f9fdf0c5c809355480bae2b3e9a9a04ded17eb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 16 Mar 2020 10:43:27 +0100 Subject: [PATCH 4/4] gofmt --- cmd/lotus-bench/main.go | 1 - 1 file changed, 1 deletion(-) diff --git a/cmd/lotus-bench/main.go b/cmd/lotus-bench/main.go index 80e58a48d..20ca2416b 100644 --- a/cmd/lotus-bench/main.go +++ b/cmd/lotus-bench/main.go @@ -454,7 +454,6 @@ func main() { bo.VerifyEPostHot = verifypost2.Sub(verifypost1) } - if c.Bool("json-out") { data, err := json.MarshalIndent(bo, "", " ") if err != nil {