Skip to content

Commit

Permalink
Merge pull request #688 from ipfs-force-community/cherry-pick-685-686…
Browse files Browse the repository at this point in the history
…-687-to-release-v0.5

Cherry pick #685 #686 #687 to release v0.5
  • Loading branch information
LinZexiao authored Apr 18, 2023
2 parents ae71ce1 + 4772618 commit 02ad353
Show file tree
Hide file tree
Showing 53 changed files with 1,571 additions and 3,104 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/vc-processors-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ name: vc-processors-publish

on:
push:
tags: [vc-processors/v**]

tags: ["vc-processors/v**"]

jobs:
publish:
Expand All @@ -12,16 +11,20 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: read rust toolchain
id: read-rust-toolchain
run: |
echo "toolchain=$(cat ./rust-toolchain)" >> "$GITHUB_OUTPUT"
- name: setup rust
uses: actions-rs/toolchain@v1
with:
toolchain: '1.60.0'
toolchain: ${{ steps.read-rust-toolchain.outputs.toolchain }}

- name: dependencies
run: sudo apt update && sudo apt install --reinstall ocl-icd-opencl-dev libhwloc-dev -y

- name: cargo-publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_CRATES_IO_API_TOKEN }}
run:
make -C ./venus-worker/ publish-vc-processors
run: make -C ./venus-worker/ publish-vc-processors
29 changes: 18 additions & 11 deletions .github/workflows/venus-sector-manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@ name: venus-sector-manager

on:
pull_request:
branches: [ main, release/**, dev/coop/** ]
branches: ["main", "release/**", "dev/coop/**"]
paths-ignore: ["*.md", "docs/**"]

# push:
# branches: [ main, release/** ]
push:
branches: ["main", "release/**", "dev/coop/**"]
paths-ignore: ["*.md", "docs/**"]

jobs:
build:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2

Expand All @@ -20,19 +21,26 @@ jobs:
- name: setup go
uses: actions/setup-go@v2
with:
go-version: '1.18'
go-version: "1.18"

- name: install golangci-lint
run: go install github.com/golangci/golangci-lint/cmd/[email protected]
- name: cache paths
id: cache-paths
run: |
echo "go-build=$(go env GOCACHE)" >> $GITHUB_OUTPUT
echo "go-mod=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT
- name: setup build cache
- name: setup go cache
uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cache/go-build
~/go/pkg/mod
${{ steps.cache-paths.outputs.go-build }}
${{ steps.cache-paths.outputs.go-mod }}
key: ${{ runner.os }}-go-${{ hashFiles('venus-sector-manager/go.sum') }}
restore-keys: ${{ runner.os }}-go-

- name: install golangci-lint
run: go install github.com/golangci/golangci-lint/cmd/[email protected]

- name: test venus-sector-manager
run: make test-smgr
Expand All @@ -49,7 +57,6 @@ jobs:
- name: show bins
run: ls -lha ./dist/bin/


# - name: upload venus-sector-manager
# uses: actions/upload-artifact@v2
# with:
Expand Down
16 changes: 11 additions & 5 deletions .github/workflows/venus-worker-util.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,31 @@ name: venus-worker-util

on:
pull_request:
branches: [ main, release/**, dev/coop/** ]
branches: ["main", "release/**", "dev/coop/**"]
paths-ignore: ["*.md", "docs/**"]

# push:
# branches: [ main, release/** ]
push:
branches: ["main", "release/**", "dev/coop/**"]
paths-ignore: ["*.md", "docs/**"]

jobs:
build:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2

- name: dependencies
run: sudo apt update && sudo apt install --reinstall ocl-icd-opencl-dev libhwloc-dev -y

- name: read rust toolchain
id: read-rust-toolchain
run: |
echo "toolchain=$(cat ./rust-toolchain)" >> "$GITHUB_OUTPUT"
- name: setup rust
uses: actions-rs/toolchain@v1
with:
toolchain: '1.60.0'
toolchain: ${{ steps.read-rust-toolchain.outputs.toolchain }}
override: true
components: rustfmt, clippy

Expand Down
15 changes: 11 additions & 4 deletions .github/workflows/venus-worker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ name: venus-worker

on:
pull_request:
branches: [ main, release/**, dev/coop/** ]
branches: ["main", "release/**", "dev/coop/**"]
paths-ignore: ["*.md", "docs/**"]

# push:
# branches: [ main, release/** ]
push:
branches: ["main", "release/**", "dev/coop/**"]
paths-ignore: ["*.md", "docs/**"]

jobs:
build:
Expand All @@ -17,10 +19,15 @@ jobs:
- name: dependencies
run: sudo apt update && sudo apt install --reinstall ocl-icd-opencl-dev libhwloc-dev -y

- name: read rust toolchain
id: read-rust-toolchain
run: |
echo "toolchain=$(cat ./rust-toolchain)" >> "$GITHUB_OUTPUT"
- name: setup rust
uses: actions-rs/toolchain@v1
with:
toolchain: '1.60.0'
toolchain: ${{ steps.read-rust-toolchain.outputs.toolchain }}
override: true
components: rustfmt, clippy

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,6 @@ var utilMinerCreateCmd = &cli.Command{
return fmt.Errorf("invalid sector size %d: %w", ssize, err)
}

postProof, err := sealProof.RegisteredWindowPoStProof()
if err != nil {
return fmt.Errorf("invalid seal proof type %d: %w", sealProof, err)
}

ts, err := api.Chain.ChainHead(gctx)
if err != nil {
return fmt.Errorf("get chain head: %w", err)
Expand Down Expand Up @@ -216,6 +211,15 @@ var utilMinerCreateCmd = &cli.Command{
multiaddrs = append(multiaddrs, maddrNop2p.Bytes())
}

nv, err := api.Chain.StateNetworkVersion(gctx, tsk)
if err != nil {
return fmt.Errorf("get network version: %w", err)
}
postProof, err := sealProof.RegisteredWindowPoStProofByNetworkVersion(nv)
if err != nil {
return fmt.Errorf("invalid seal proof type %d: %w", sealProof, err)
}

params, err := actors.SerializeParams(&core.CreateMinerParams{
Owner: owner,
Worker: worker,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ import (
"github.com/filecoin-project/go-state-types/big"
stbuiltin "github.com/filecoin-project/go-state-types/builtin"
miner8 "github.com/filecoin-project/go-state-types/builtin/v9/miner"
cbor "github.com/ipfs/go-ipld-cbor"

"github.com/filecoin-project/venus/pkg/chain"
"github.com/filecoin-project/venus/venus-shared/actors"
"github.com/filecoin-project/venus/venus-shared/actors/adt"
"github.com/filecoin-project/venus/venus-shared/actors/builtin"
"github.com/filecoin-project/venus/venus-shared/actors/builtin/miner"
"github.com/filecoin-project/venus/venus-shared/types"
Expand All @@ -32,7 +33,7 @@ import (
"github.com/ipfs-force-community/venus-cluster/venus-sector-manager/modules/impl/prover"
"github.com/ipfs-force-community/venus-cluster/venus-sector-manager/modules/policy"
"github.com/ipfs-force-community/venus-cluster/venus-sector-manager/modules/util"
chain2 "github.com/ipfs-force-community/venus-cluster/venus-sector-manager/pkg/chain"
chainAPI "github.com/ipfs-force-community/venus-cluster/venus-sector-manager/pkg/chain"
"github.com/ipfs-force-community/venus-cluster/venus-sector-manager/pkg/messager"
)

Expand Down Expand Up @@ -102,7 +103,7 @@ var utilSealerProvingInfoCmd = &cli.Command{
return err
}

stor := chain.ActorStore(actx, chain2.NewAPIBlockstore(api.Chain))
stor := adt.WrapStore(actx, cbor.NewCborStore(chainAPI.NewAPIBlockstore(api.Chain)))

mas, err := miner.Load(stor, mact)
if err != nil {
Expand Down Expand Up @@ -196,7 +197,7 @@ var utilSealerProvingFaultsCmd = &cli.Command{
}
defer stop()

stor := chain.ActorStore(ctx, chain2.NewAPIBlockstore(api.Chain))
stor := adt.WrapStore(ctx, cbor.NewCborStore(chainAPI.NewAPIBlockstore(api.Chain)))

maddr, err := ShouldAddress(cctx.String("miner"), true, true)
if err != nil {
Expand Down Expand Up @@ -559,6 +560,12 @@ var utilSealerProvingCheckProvableCmd = &cli.Command{
_, _ = fmt.Fprintln(tw, "deadline\tpartition\tsector\tstatus")

var filter map[abi.SectorID]struct{}

nv, err := api.Chain.StateNetworkVersion(ctx, types.EmptyTSK)
if err != nil {
return fmt.Errorf("failed to load network version: %w", err)
}

for parIdx, par := range partitions {
sectors := make(map[abi.SectorNumber]struct{})

Expand All @@ -584,7 +591,15 @@ var utilSealerProvingCheckProvableCmd = &cli.Command{
tocheck = append(tocheck, util.SectorOnChainInfoToExtended(info))
}

bad, err := api.Sealer.CheckProvable(ctx, abi.ActorID(mid), tocheck, cctx.Bool("slow"))
if len(tocheck) == 0 {
continue
}

postProofType, err := tocheck[0].SealProof.RegisteredWindowPoStProofByNetworkVersion(nv)
if err != nil {
return fmt.Errorf("invalid seal proof type %d: %w", tocheck[0].SealProof, err)
}
bad, err := api.Sealer.CheckProvable(ctx, abi.ActorID(mid), postProofType, tocheck, cctx.Bool("slow"))
if err != nil {
return err
}
Expand Down Expand Up @@ -692,7 +707,20 @@ var utilSealerProvingSimulateWdPoStCmd = &cli.Command{
rand = append(rand, 0)
}

err = api.Sealer.SimulateWdPoSt(ctx, maddr, proofSectors, rand)
if len(proofSectors) == 0 {
return fmt.Errorf("no lived sector in that partition")
}

nv, err := api.Chain.StateNetworkVersion(ctx, ts.Key())
if err != nil {
return fmt.Errorf("getting network version: %w", err)
}
ppt, err := proofSectors[0].SealProof.RegisteredWindowPoStProofByNetworkVersion(nv)
if err != nil {
return fmt.Errorf("convert to winning post proof: %w", err)
}

err = api.Sealer.SimulateWdPoSt(ctx, maddr, ppt, proofSectors, rand)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions venus-sector-manager/core/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ type SealerCliAPI interface {

RestoreSector(ctx context.Context, sid abi.SectorID, forced bool) (Meta, error)

CheckProvable(ctx context.Context, mid abi.ActorID, sectors []builtin.ExtendedSectorInfo, strict bool) (map[abi.SectorNumber]string, error)
CheckProvable(ctx context.Context, mid abi.ActorID, postProofType abi.RegisteredPoStProof, sectors []builtin.ExtendedSectorInfo, strict bool) (map[abi.SectorNumber]string, error)

SimulateWdPoSt(context.Context, address.Address, []builtin.ExtendedSectorInfo, abi.PoStRandomness) error
SimulateWdPoSt(context.Context, address.Address, abi.RegisteredPoStProof, []builtin.ExtendedSectorInfo, abi.PoStRandomness) error

SnapUpPreFetch(ctx context.Context, mid abi.ActorID, dlindex *uint64) (*SnapUpFetchResult, error)

Expand Down
8 changes: 4 additions & 4 deletions venus-sector-manager/core/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ var UnavailableSealerCliClient = SealerCliClient{

ReportAborted: func(context.Context, abi.SectorID, string) (Meta, error) { panic("sealer client unavailable") },

CheckProvable: func(ctx context.Context, mid abi.ActorID, sectors []builtin.ExtendedSectorInfo, strict bool) (map[abi.SectorNumber]string, error) {
CheckProvable: func(ctx context.Context, mid abi.ActorID, postProofType abi.RegisteredPoStProof, sectors []builtin.ExtendedSectorInfo, strict bool) (map[abi.SectorNumber]string, error) {
panic("sealer client unavailable")
},

SimulateWdPoSt: func(context.Context, address.Address, []builtin.ExtendedSectorInfo, abi.PoStRandomness) error {
SimulateWdPoSt: func(context.Context, address.Address, abi.RegisteredPoStProof, []builtin.ExtendedSectorInfo, abi.PoStRandomness) error {
panic("sealer client unavailable")
},

Expand Down Expand Up @@ -120,9 +120,9 @@ type SealerCliClient struct {

ReportAborted func(context.Context, abi.SectorID, string) (Meta, error)

CheckProvable func(ctx context.Context, mid abi.ActorID, sectors []builtin.ExtendedSectorInfo, strict bool) (map[abi.SectorNumber]string, error)
CheckProvable func(ctx context.Context, mid abi.ActorID, postProofType abi.RegisteredPoStProof, sectors []builtin.ExtendedSectorInfo, strict bool) (map[abi.SectorNumber]string, error)

SimulateWdPoSt func(context.Context, address.Address, []builtin.ExtendedSectorInfo, abi.PoStRandomness) error
SimulateWdPoSt func(context.Context, address.Address, abi.RegisteredPoStProof, []builtin.ExtendedSectorInfo, abi.PoStRandomness) error

SnapUpPreFetch func(ctx context.Context, mid abi.ActorID, dlindex *uint64) (*SnapUpFetchResult, error)

Expand Down
6 changes: 3 additions & 3 deletions venus-sector-manager/core/ifaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ type SectorIndexer interface {
type SectorTracker interface {
SinglePubToPrivateInfo(ctx context.Context, mid abi.ActorID, sectorInfo builtin.ExtendedSectorInfo, locator SectorLocator) (PrivateSectorInfo, error)
SinglePrivateInfo(ctx context.Context, sref SectorRef, upgrade bool, locator SectorLocator) (PrivateSectorInfo, error)
SingleProvable(ctx context.Context, sref SectorRef, upgrade bool, locator SectorLocator, strict bool) error
Provable(ctx context.Context, mid abi.ActorID, sectors []builtin.ExtendedSectorInfo, strict bool) (map[abi.SectorNumber]string, error)
PubToPrivate(ctx context.Context, mid abi.ActorID, sectorInfo []builtin.ExtendedSectorInfo, typer SectorPoStTyper) ([]FFIPrivateSectorInfo, error)
SingleProvable(ctx context.Context, postProofType abi.RegisteredPoStProof, sref SectorRef, upgrade bool, locator SectorLocator, strict bool) error
Provable(ctx context.Context, mid abi.ActorID, postProofType abi.RegisteredPoStProof, sectors []builtin.ExtendedSectorInfo, strict bool) (map[abi.SectorNumber]string, error)
PubToPrivate(ctx context.Context, mid abi.ActorID, postProofType abi.RegisteredPoStProof, sectorInfo []builtin.ExtendedSectorInfo) ([]FFIPrivateSectorInfo, error)
}

type SnapUpSectorManager interface {
Expand Down
10 changes: 0 additions & 10 deletions venus-sector-manager/core/types_sector_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,6 @@ type SectorStateChangeHook func(st *SectorState) (bool, error)
// returns the persist instance name, existence
type SectorLocator func(ctx context.Context, sid abi.SectorID) (SectorAccessStores, bool, error)

type SectorPoStTyper func(proofType abi.RegisteredSealProof) (abi.RegisteredPoStProof, error)

func SectorWindowPoSt(proofType abi.RegisteredSealProof) (abi.RegisteredPoStProof, error) {
return proofType.RegisteredWindowPoStProof()
}

func SectorWinningPoSt(proofType abi.RegisteredSealProof) (abi.RegisteredPoStProof, error) {
return proofType.RegisteredWinningPoStProof()
}

type SectorFinalized bool
type SectorUpgraded bool
type SectorRemoved bool
Expand Down
Loading

0 comments on commit 02ad353

Please sign in to comment.