diff --git a/.github/workflows/docker_image.yml b/.github/workflows/docker_image.yml index fb01aeec..9a38d4e1 100644 --- a/.github/workflows/docker_image.yml +++ b/.github/workflows/docker_image.yml @@ -7,7 +7,46 @@ on: jobs: + + # build_docker_image: + # uses: filecoin-project/venus/.github/workflows/common_docker_image.yml@master + # secrets: + # DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}} + + # todo: replace this job with action from venus build_docker_image: - uses: filecoin-project/venus/.github/workflows/common_docker_image.yml@master - secrets: - DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}} + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v3 + - name: Create vars + id: vars + run: | + export github_tag=${{ github.ref_name }} + export repo_name=${GITHUB_REPOSITORY##*/} + export is_tag_create=false + export docker_user_name='filvenus' + + export rx_tag='^refs\/tags\/.*' + export rx_version_tag='^v([0-9]+\.){0,2}(\*|[0-9]+)(-rc[0-9]*){0,1}$' + if [[ "${{github.ref}}" =~ $rx_tag ]]; then + export is_tag_create=true + fi + + echo "::set-output name=github_tag::$github_tag" + echo "::set-output name=repo_name::$repo_name" + echo "::set-output name=is_tag_create::$is_tag_create" + echo "::set-output name=docker_user_name::$docker_user_name" + + - name: Show environment + run: | + echo is_tag_create = ${{ steps.vars.outputs.is_tag_create }} + echo github_tag = ${{ steps.vars.outputs.github_tag }} + echo repo_name = ${{ steps.vars.outputs.repo_name }} + echo docker_user_name = ${{steps.vars.outputs.docker_user_name}} + echo docker_password = ${{secrets.DOCKER_PASSWORD}} + + - name: Build the Docker image + if: ${{ steps.vars.outputs.is_tag_create == 'true' }} + run: | + docker login --username=${{steps.vars.outputs.docker_user_name}} --password ${{ secrets.DOCKER_PASSWORD }} + make docker-push TAG=${{ steps.vars.outputs.github_tag }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 29f06c0d..a3e5bde9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # droplet changelog +## v2.8.0 + +* fix: repo compatibility for cli [[#348](https://github.com/ipfs-force-community/droplet/pull/348)] +* chore: output piece size to log [[#351](https://github.com/ipfs-force-community/droplet/pull/351)] +* fix: use old client repo when create market client[[#353](https://github.com/ipfs-force-community/droplet/pull/353)] + ## v2.8.0-rc1 * feat: set address.CurrentNetwork when launch up [[#321](https://github.com/ipfs-force-community/droplet/pull/321)] diff --git a/Makefile b/Makefile index 0fbf49f1..10259218 100644 --- a/Makefile +++ b/Makefile @@ -101,5 +101,14 @@ endif docker-push: docker +ifdef PRIVATE_REGISTRY docker push $(PRIVATE_REGISTRY)/filvenus/droplet:$(TAG) docker push $(PRIVATE_REGISTRY)/filvenus/droplet-client:$(TAG) +else + docker tag droplet filvenus/droplet:latest + docker tag droplet-client filvenus/droplet-client:latest + docker push filvenus/droplet:latest + docker push filvenus/droplet-client:latest + docker push filvenus/droplet:$(TAG) + docker push filvenus/droplet-client:$(TAG) +endif diff --git a/cli/actor.go b/cli/actor.go index 15ad2aa1..7568ceb1 100644 --- a/cli/actor.go +++ b/cli/actor.go @@ -172,7 +172,7 @@ var actorSetAddrsCmd = &cli.Command{ } defer closer() - api, acloser, err := NewFullNode(cctx) + api, acloser, err := NewFullNode(cctx, OldMarketRepoPath) if err != nil { return err } @@ -256,7 +256,7 @@ var actorSetPeeridCmd = &cli.Command{ } defer closer() - api, acloser, err := NewFullNode(cctx) + api, acloser, err := NewFullNode(cctx, OldMarketRepoPath) if err != nil { return err } @@ -323,7 +323,7 @@ var actorInfoCmd = &cli.Command{ } defer closer() - api, acloser, err := NewFullNode(cctx) + api, acloser, err := NewFullNode(cctx, OldMarketRepoPath) if err != nil { return err } diff --git a/cli/market_funds.go b/cli/market_funds.go index 7a1df78b..e53f2d9c 100644 --- a/cli/market_funds.go +++ b/cli/market_funds.go @@ -30,7 +30,7 @@ var marketBalancesCmd = &cli.Command{ Usage: "Print storage market client balances", Flags: []cli.Flag{}, Action: func(cctx *cli.Context) error { - fapi, fcloser, err := NewFullNode(cctx) + fapi, fcloser, err := NewFullNode(cctx, OldMarketRepoPath) if err != nil { return err } @@ -184,7 +184,7 @@ var walletMarketWithdraw = &cli.Command{ }, }, Action: func(cctx *cli.Context) error { - api, acloser, err := NewFullNode(cctx) + api, acloser, err := NewFullNode(cctx, OldMarketRepoPath) if err != nil { return err } diff --git a/cli/retrieval-deals.go b/cli/retrieval-deals.go index 8dcbe2ff..80bd64a9 100644 --- a/cli/retrieval-deals.go +++ b/cli/retrieval-deals.go @@ -209,7 +209,7 @@ var queryProtocols = &cli.Command{ return fmt.Errorf("must pass miner") } - api, closer, err := NewFullNode(cctx) + api, closer, err := NewFullNode(cctx, OldMarketRepoPath) if err != nil { return err } diff --git a/cli/stats.go b/cli/stats.go index 7a754123..fbe4e327 100644 --- a/cli/stats.go +++ b/cli/stats.go @@ -59,7 +59,7 @@ var StatsPowerCmd = &cli.Command{ log.SetOutput(bytes.NewBuffer(nil)) } - api, acloser, err := NewFullNode(cctx) + api, acloser, err := NewFullNode(cctx, OldMarketRepoPath) if err != nil { return fmt.Errorf("setting up venus node connection: %w", err) } @@ -259,7 +259,7 @@ var StatsDealsCmd = &cli.Command{ Description: "Statistics on active market deals", Action: func(cctx *cli.Context) error { ctx := ReqContext(cctx) - api, closer, err := NewFullNode(cctx) + api, closer, err := NewFullNode(cctx, OldMarketRepoPath) if err != nil { return err } diff --git a/cli/storage-ask.go b/cli/storage-ask.go index 2c2f1cad..d1f17c78 100644 --- a/cli/storage-ask.go +++ b/cli/storage-ask.go @@ -158,7 +158,7 @@ var getStorageAskCmd = &cli.Command{ Action: func(cctx *cli.Context) error { ctx := DaemonContext(cctx) - fnapi, closer, err := NewFullNode(cctx) + fnapi, closer, err := NewFullNode(cctx, OldMarketRepoPath) if err != nil { return err } @@ -218,7 +218,7 @@ var listStorageAsksCmd = &cli.Command{ Action: func(cctx *cli.Context) error { ctx := DaemonContext(cctx) - fnapi, closer, err := NewFullNode(cctx) + fnapi, closer, err := NewFullNode(cctx, OldMarketRepoPath) if err != nil { return err } diff --git a/cli/storage-deals.go b/cli/storage-deals.go index bcaaf346..d7520fc9 100644 --- a/cli/storage-deals.go +++ b/cli/storage-deals.go @@ -230,7 +230,7 @@ part states: } defer closer() - fapi, fcloser, err := NewFullNode(cctx) + fapi, fcloser, err := NewFullNode(cctx, OldMarketRepoPath) if err != nil { return err } diff --git a/cli/util.go b/cli/util.go index da4e9631..20f1024d 100644 --- a/cli/util.go +++ b/cli/util.go @@ -59,6 +59,16 @@ const ( API_NAMESPACE_MARKET_CLIENT = "VENUS_MARKET_CLIENT" //nolint ) +const ( + OldMarketRepoPath = "~/.venusmarket" + DefMarketRepoPath = "~/.droplet" +) + +const ( + OldClientRepoPath = "~/.marketclient" + DefClientRepoPath = "~/.droplet-client" +) + // GetCidEncoder returns an encoder using the `cid-base` flag if provided, or // the default (Base32) encoder if not. func GetCidEncoder(cctx *cli.Context) (cidenc.Encoder, error) { @@ -82,7 +92,7 @@ var minerFlag = &cli.StringFlag{ } func NewMarketNode(cctx *cli.Context) (marketapi.IMarket, jsonrpc.ClientCloser, error) { - homePath, err := homedir.Expand(cctx.String("repo")) + homePath, err := GetRepoPath(cctx, "repo", OldMarketRepoPath) if err != nil { return nil, nil, err } @@ -106,7 +116,7 @@ func NewMarketNode(cctx *cli.Context) (marketapi.IMarket, jsonrpc.ClientCloser, } func NewMarketClientNode(cctx *cli.Context) (clientapi.IMarketClient, jsonrpc.ClientCloser, error) { - homePath, err := homedir.Expand(cctx.String("repo")) + homePath, err := GetRepoPath(cctx, "repo", OldClientRepoPath) if err != nil { return nil, nil, err } @@ -128,10 +138,14 @@ func NewMarketClientNode(cctx *cli.Context) (clientapi.IMarketClient, jsonrpc.Cl return clientapi.NewIMarketClientRPC(cctx.Context, addr, apiInfo.AuthHeader()) } -func NewFullNode(cctx *cli.Context) (v1api.FullNode, jsonrpc.ClientCloser, error) { - cfgPath := path.Join(cctx.String("repo"), "config.toml") +func NewFullNode(cctx *cli.Context, legacyRepo string) (v1api.FullNode, jsonrpc.ClientCloser, error) { + repoPath, err := GetRepoPath(cctx, "repo", legacyRepo) + if err != nil { + return nil, nil, err + } + cfgPath := path.Join(repoPath, "config.toml") marketCfg := config.DefaultMarketConfig - err := config.LoadConfig(cfgPath, marketCfg) + err = config.LoadConfig(cfgPath, marketCfg) if err != nil { return nil, nil, err } @@ -555,3 +569,45 @@ func getPayloadSizeFunc(dirs []string) func(pieceCID cid.Cid) uint64 { return sizes[pieceCID] } } + +// todo: remove legacy repo path after v1.13 +func GetRepoPath(cctx *cli.Context, repoFlagName, oldRepoPath string) (string, error) { + repoPath, err := homedir.Expand(cctx.String(repoFlagName)) + if err != nil { + return "", err + } + has, err := exist(repoPath) + if err != nil { + return "", err + } + if !has { + oldRepoPath, err = homedir.Expand(oldRepoPath) + if err != nil { + return "", err + } + has, err = exist(oldRepoPath) + if err != nil { + return "", err + } + if has { + return oldRepoPath, nil + } + } + + return repoPath, nil +} + +func exist(path string) (bool, error) { + f, err := os.Stat(path) + if err != nil { + if os.IsNotExist(err) { + return false, nil + } + return false, err + } + if !f.IsDir() { + return false, fmt.Errorf("%s not a file directory", path) + } + + return true, nil +} diff --git a/cmd/droplet-client/actor-funds.go b/cmd/droplet-client/actor-funds.go index e2584a11..de258e31 100644 --- a/cmd/droplet-client/actor-funds.go +++ b/cmd/droplet-client/actor-funds.go @@ -37,7 +37,7 @@ var actorFundsBalancesCmd = &cli.Command{ }, }, Action: func(cctx *cli.Context) error { - fapi, fcloser, err := cli2.NewFullNode(cctx) + fapi, fcloser, err := cli2.NewFullNode(cctx, cli2.OldClientRepoPath) if err != nil { return err } @@ -191,7 +191,7 @@ var actorFundsWithdrawCmd = &cli.Command{ defer closer() ctx := cli2.ReqContext(cctx) - fapi, fcloser, err := cli2.NewFullNode(cctx) + fapi, fcloser, err := cli2.NewFullNode(cctx, cli2.OldClientRepoPath) if err != nil { return err } diff --git a/cmd/droplet-client/datacap.go b/cmd/droplet-client/datacap.go index e33940aa..1d3f4ce9 100644 --- a/cmd/droplet-client/datacap.go +++ b/cmd/droplet-client/datacap.go @@ -71,7 +71,7 @@ var datacapExtendCmd = &cli.Command{ defer closer() ctx := cli2.ReqContext(cliCtx) - fapi, fcloser, err := cli2.NewFullNode(cliCtx) + fapi, fcloser, err := cli2.NewFullNode(cliCtx, cli2.OldClientRepoPath) if err != nil { return err } @@ -286,7 +286,7 @@ var datacapClaimsListCmd = &cli.Command{ return fmt.Errorf("must pass provider address") } - fapi, fcloser, err := cli2.NewFullNode(cliCtx) + fapi, fcloser, err := cli2.NewFullNode(cliCtx, cli2.OldClientRepoPath) if err != nil { return err } @@ -368,7 +368,7 @@ var datacapAllocationListCmd = &cli.Command{ return fmt.Errorf("must pass client address") } - fapi, fcloser, err := cli2.NewFullNode(cliCtx) + fapi, fcloser, err := cli2.NewFullNode(cliCtx, cli2.OldClientRepoPath) if err != nil { return err } diff --git a/cmd/droplet-client/main.go b/cmd/droplet-client/main.go index 3df42b9e..883d6d7e 100644 --- a/cmd/droplet-client/main.go +++ b/cmd/droplet-client/main.go @@ -40,11 +40,6 @@ import ( "github.com/filecoin-project/venus/venus-shared/api/permission" ) -const ( - oldRepoPath = "~/.marketclient" - defRepoPath = "~/.droplet-client" -) - var ( ExtractApiKey = builder.NextInvoke() log = logging.Logger("main") @@ -54,7 +49,7 @@ var ( RepoFlag = &cli.StringFlag{ Name: "repo", EnvVars: []string{"DROPLET_CLIENT_PATH", "VENUS_MARKET_CLIENT_PATH"}, - Value: defRepoPath, + Value: cli2.DefClientRepoPath, } APIListenFlag = &cli.StringFlag{ @@ -225,7 +220,7 @@ func flagData(cctx *cli.Context, cfg *config.MarketClientConfig) error { func prepare(cctx *cli.Context) (*config.MarketClientConfig, error) { var err error cfg := config.DefaultMarketClientConfig - cfg.HomeDir, err = cmd.GetRepoPath(cctx, RepoFlag.Name, oldRepoPath) + cfg.HomeDir, err = cli2.GetRepoPath(cctx, RepoFlag.Name, cli2.OldClientRepoPath) if err != nil { return nil, err } diff --git a/cmd/droplet-client/paych.go b/cmd/droplet-client/paych.go index 16e607aa..2af416cc 100644 --- a/cmd/droplet-client/paych.go +++ b/cmd/droplet-client/paych.go @@ -69,7 +69,7 @@ var paychAddFundsCmd = &cli.Command{ return cli2.ShowHelp(cctx, fmt.Errorf("parsing amount failed: %s", err)) } - fapi, fcloser, err := cli2.NewFullNode(cctx) + fapi, fcloser, err := cli2.NewFullNode(cctx, cli2.OldClientRepoPath) if err != nil { return err } @@ -133,7 +133,7 @@ var paychStatusByFromToCmd = &cli.Command{ return cli2.ShowHelp(cctx, fmt.Errorf("failed to parse to address: %s", err)) } - fapi, fcloser, err := cli2.NewFullNode(cctx) + fapi, fcloser, err := cli2.NewFullNode(cctx, cli2.OldClientRepoPath) if err != nil { return err } @@ -164,7 +164,7 @@ var paychStatusCmd = &cli.Command{ return cli2.ShowHelp(cctx, fmt.Errorf("failed to parse channel address: %s", err)) } - fapi, fcloser, err := cli2.NewFullNode(cctx) + fapi, fcloser, err := cli2.NewFullNode(cctx, cli2.OldClientRepoPath) if err != nil { return err } @@ -241,7 +241,7 @@ var paychListCmd = &cli.Command{ Name: "list", Usage: "List all locally registered payment channels", Action: func(cctx *cli.Context) error { - fapi, fcloser, err := cli2.NewFullNode(cctx) + fapi, fcloser, err := cli2.NewFullNode(cctx, cli2.OldClientRepoPath) if err != nil { return err } @@ -275,7 +275,7 @@ var paychSettleCmd = &cli.Command{ return fmt.Errorf("failed to parse payment channel address: %s", err) } - fapi, fcloser, err := cli2.NewFullNode(cctx) + fapi, fcloser, err := cli2.NewFullNode(cctx, cli2.OldClientRepoPath) if err != nil { return err } @@ -315,7 +315,7 @@ var paychCloseCmd = &cli.Command{ return fmt.Errorf("failed to parse payment channel address: %s", err) } - fapi, fcloser, err := cli2.NewFullNode(cctx) + fapi, fcloser, err := cli2.NewFullNode(cctx, cli2.OldClientRepoPath) if err != nil { return err } @@ -382,7 +382,7 @@ var paychVoucherCreateCmd = &cli.Command{ lane := cctx.Int("lane") - fapi, fcloser, err := cli2.NewFullNode(cctx) + fapi, fcloser, err := cli2.NewFullNode(cctx, cli2.OldClientRepoPath) if err != nil { return err } @@ -428,7 +428,7 @@ var paychVoucherCheckCmd = &cli.Command{ return err } - fapi, fcloser, err := cli2.NewFullNode(cctx) + fapi, fcloser, err := cli2.NewFullNode(cctx, cli2.OldClientRepoPath) if err != nil { return err } @@ -464,7 +464,7 @@ var paychVoucherAddCmd = &cli.Command{ return err } - fapi, fcloser, err := cli2.NewFullNode(cctx) + fapi, fcloser, err := cli2.NewFullNode(cctx, cli2.OldClientRepoPath) if err != nil { return err } @@ -501,7 +501,7 @@ var paychVoucherListCmd = &cli.Command{ return err } - fapi, fcloser, err := cli2.NewFullNode(cctx) + fapi, fcloser, err := cli2.NewFullNode(cctx, cli2.OldClientRepoPath) if err != nil { return err } @@ -546,7 +546,7 @@ var paychVoucherBestSpendableCmd = &cli.Command{ return err } - fapi, fcloser, err := cli2.NewFullNode(cctx) + fapi, fcloser, err := cli2.NewFullNode(cctx, cli2.OldClientRepoPath) if err != nil { return err } @@ -622,7 +622,7 @@ var paychVoucherSubmitCmd = &cli.Command{ return err } - fapi, fcloser, err := cli2.NewFullNode(cctx) + fapi, fcloser, err := cli2.NewFullNode(cctx, cli2.OldClientRepoPath) if err != nil { return err } diff --git a/cmd/droplet-client/storage.go b/cmd/droplet-client/storage.go index 01b75066..7a6ff481 100644 --- a/cmd/droplet-client/storage.go +++ b/cmd/droplet-client/storage.go @@ -252,7 +252,7 @@ var storageAsksQueryCmd = &cli.Command{ return err } - fapi, fcloser, err := cli2.NewFullNode(cctx) + fapi, fcloser, err := cli2.NewFullNode(cctx, cli2.OldClientRepoPath) if err != nil { return err } @@ -328,7 +328,7 @@ var storageAsksListCmd = &cli.Command{ }, }, Action: func(cctx *cli.Context) error { - fapi, fcloser, err := cli2.NewFullNode(cctx) + fapi, fcloser, err := cli2.NewFullNode(cctx, cli2.OldClientRepoPath) if err != nil { return err } @@ -443,7 +443,7 @@ The minimum value is 518400 (6 months).`, return interactiveDeal(cctx) } - fapi, fcloser, err := cli2.NewFullNode(cctx) + fapi, fcloser, err := cli2.NewFullNode(cctx, cli2.OldClientRepoPath) if err != nil { return err } @@ -537,7 +537,7 @@ The minimum value is 518400 (6 months).`, } func interactiveDeal(cctx *cli.Context) error { - fapi, fcloser, err := cli2.NewFullNode(cctx) + fapi, fcloser, err := cli2.NewFullNode(cctx, cli2.OldClientRepoPath) if err != nil { return err } @@ -1039,7 +1039,7 @@ var storageDealsListCmd = &cli.Command{ color.NoColor = !cctx.Bool("color") } - fapi, fcloser, err := cli2.NewFullNode(cctx) + fapi, fcloser, err := cli2.NewFullNode(cctx, cli2.OldClientRepoPath) if err != nil { return err } @@ -1354,7 +1354,7 @@ var storageDealsGetCmd = &cli.Command{ return cli.ShowCommandHelp(cctx, cctx.Command.Name) } - fapi, fcloser, err := cli2.NewFullNode(cctx) + fapi, fcloser, err := cli2.NewFullNode(cctx, cli2.OldClientRepoPath) if err != nil { return err } @@ -1672,7 +1672,7 @@ The minimum value is 518400 (6 months).`, return fmt.Errorf("must pass two arguments") } - fapi, fcloser, err := cli2.NewFullNode(cctx) + fapi, fcloser, err := cli2.NewFullNode(cctx, cli2.OldClientRepoPath) if err != nil { return err } diff --git a/cmd/droplet/main.go b/cmd/droplet/main.go index f64ef006..e07d7e78 100644 --- a/cmd/droplet/main.go +++ b/cmd/droplet/main.go @@ -16,11 +16,6 @@ import ( _ "github.com/filecoin-project/venus/pkg/crypto/secp" ) -const ( - oldRepoPath = "~/.venusmarket" - defRepoPath = "~/.droplet" -) - var mainLog = logging.Logger("main") // Invokes are called in the order they are defined. @@ -33,7 +28,7 @@ var ( RepoFlag = &cli.StringFlag{ Name: "repo", EnvVars: []string{"DROPLET_PATH", "VENUS_MARKET_PATH"}, - Value: defRepoPath, + Value: cli2.DefMarketRepoPath, } APIListenFlag = &cli.StringFlag{ diff --git a/cmd/droplet/run.go b/cmd/droplet/run.go index 2ab41c3a..cb134ca3 100644 --- a/cmd/droplet/run.go +++ b/cmd/droplet/run.go @@ -130,7 +130,7 @@ func flagData(cctx *cli.Context, cfg *config.MarketConfig) error { func prepare(cctx *cli.Context) (*config.MarketConfig, error) { var err error cfg := config.DefaultMarketConfig - cfg.HomeDir, err = cmd.GetRepoPath(cctx, RepoFlag.Name, oldRepoPath) + cfg.HomeDir, err = cli2.GetRepoPath(cctx, RepoFlag.Name, cli2.OldMarketRepoPath) if err != nil { return nil, err } diff --git a/cmd/util.go b/cmd/util.go index 00eed1ec..29251ace 100644 --- a/cmd/util.go +++ b/cmd/util.go @@ -2,12 +2,8 @@ package cmd import ( "context" - "fmt" - "os" "github.com/ipfs-force-community/droplet/v2/config" - "github.com/mitchellh/go-homedir" - "github.com/urfave/cli/v2" "github.com/filecoin-project/venus/venus-shared/api" v1 "github.com/filecoin-project/venus/venus-shared/api/chain/v1" @@ -28,44 +24,3 @@ func FetchAndLoadBundles(ctx context.Context, nodeCfg config.Node) error { return utils.LoadBuiltinActors(ctx, fullNodeAPI) } - -func GetRepoPath(cctx *cli.Context, repoFlagName, oldRepoPath string) (string, error) { - repoPath, err := homedir.Expand(cctx.String(repoFlagName)) - if err != nil { - return "", err - } - has, err := exist(repoPath) - if err != nil { - return "", err - } - if !has { - oldRepoPath, err = homedir.Expand(oldRepoPath) - if err != nil { - return "", err - } - has, err = exist(oldRepoPath) - if err != nil { - return "", err - } - if has { - return oldRepoPath, nil - } - } - - return repoPath, nil -} - -func exist(path string) (bool, error) { - f, err := os.Stat(path) - if err != nil { - if os.IsNotExist(err) { - return false, nil - } - return false, err - } - if !f.IsDir() { - return false, fmt.Errorf("%s not a file directory", path) - } - - return true, nil -} diff --git a/go.mod b/go.mod index 407ec1be..fbf52b84 100644 --- a/go.mod +++ b/go.mod @@ -30,7 +30,7 @@ require ( github.com/filecoin-project/go-statestore v0.2.0 github.com/filecoin-project/specs-actors/v2 v2.3.6 github.com/filecoin-project/specs-actors/v7 v7.0.1 - github.com/filecoin-project/venus v1.12.0-rc1 + github.com/filecoin-project/venus v1.12.0 github.com/golang/mock v1.6.0 github.com/google/uuid v1.3.0 github.com/gorilla/mux v1.8.0 @@ -38,9 +38,9 @@ require ( github.com/hashicorp/go-multierror v1.1.1 github.com/howeyc/gopass v0.0.0-20210920133722-c8aef6fb66ef github.com/ipfs-force-community/metrics v1.0.1-0.20220824061112-ac916bacf2ea - github.com/ipfs-force-community/sophon-auth v1.12.0-rc1.0.20230614091443-9d27e566c685 - github.com/ipfs-force-community/sophon-gateway v1.12.0-rc1 - github.com/ipfs-force-community/sophon-messager v1.12.0-rc1 + github.com/ipfs-force-community/sophon-auth v1.12.0 + github.com/ipfs-force-community/sophon-gateway v1.12.1-0.20230630092336-6a7558c97183 + github.com/ipfs-force-community/sophon-messager v1.12.0 github.com/ipfs-force-community/venus-common-utils v0.0.0-20220217030526-e5e4c6bc14f7 github.com/ipfs/go-blockservice v0.5.0 github.com/ipfs/go-cid v0.3.2 diff --git a/go.sum b/go.sum index a70f6be6..8dc21ae6 100644 --- a/go.sum +++ b/go.sum @@ -467,8 +467,8 @@ github.com/filecoin-project/storetheindex v0.4.30-0.20221114113647-683091f8e893 github.com/filecoin-project/storetheindex v0.4.30-0.20221114113647-683091f8e893/go.mod h1:S7590oDimBvXMUtzWsBXoshu9HtYKwtXl47zAK9rcP8= github.com/filecoin-project/test-vectors/schema v0.0.5/go.mod h1:iQ9QXLpYWL3m7warwvK1JC/pTri8mnfEmKygNDqqY6E= github.com/filecoin-project/venus v1.2.4/go.mod h1:hJULXHGAnWuq5S5KRtPkwbT8DqgM9II7NwyNU7t59D0= -github.com/filecoin-project/venus v1.12.0-rc1 h1:P1ylFseqjA5pV1Pbl04FdXwSE3CgTPeIa93aX0usjNE= -github.com/filecoin-project/venus v1.12.0-rc1/go.mod h1:t5AL4ksL7QHaeKZ6sl6u6kW3jBvHK+m1xV0AdtGfjPE= +github.com/filecoin-project/venus v1.12.0 h1:ukMOqu/Zx25a8v1mKQ2gcA9Eb54/wKp/Sv3okGnuPJU= +github.com/filecoin-project/venus v1.12.0/go.mod h1:kSdkZVJp4DLktMrKKaXFQxDGhBmJwVNWMSwPyWASd7o= github.com/filecoin-project/venus-auth v1.3.2/go.mod h1:m5Jog2GYxztwP7w3m/iJdv/V1/bTcAVU9rm/CbhxRQU= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/flynn/noise v0.0.0-20180327030543-2492fe189ae6/go.mod h1:1i71OnUq3iUe1ma7Lr6yG6/rjvM3emb6yoL7xLFzcVQ= @@ -831,12 +831,12 @@ github.com/ipfs-force-community/metrics v1.0.0/go.mod h1:mn40SioMuKtjmRumHFy/fJ2 github.com/ipfs-force-community/metrics v1.0.1-0.20211022060227-11142a08b729/go.mod h1:mn40SioMuKtjmRumHFy/fJ26Pn028XuDjUJE9dorjyw= github.com/ipfs-force-community/metrics v1.0.1-0.20220824061112-ac916bacf2ea h1:mtR+uqI444dF1j3IcpDq3MCFBR5B/OQnHFulTuM7a6o= github.com/ipfs-force-community/metrics v1.0.1-0.20220824061112-ac916bacf2ea/go.mod h1:5rXHGpIN2wCkdgDnucJ1rEeKhLzbAur5IO1aWAIwogY= -github.com/ipfs-force-community/sophon-auth v1.12.0-rc1.0.20230614091443-9d27e566c685 h1:ZoPQPSb0UNcSCBDoBCwVomxBbBXrksMGHaQISBhNQSY= -github.com/ipfs-force-community/sophon-auth v1.12.0-rc1.0.20230614091443-9d27e566c685/go.mod h1:cGYCfjA/BDB/Km9P7Za6t1hmwpFlPKf8ho/CHmLG81Y= -github.com/ipfs-force-community/sophon-gateway v1.12.0-rc1 h1:c5BdvrB4g+Se/Uyotef6TR2H9pkm4ExtawR0zPx+GDs= -github.com/ipfs-force-community/sophon-gateway v1.12.0-rc1/go.mod h1:F+f4qzx+uVMPftk/sv2JnNOFgxpl83l5zrb9UFtzcCM= -github.com/ipfs-force-community/sophon-messager v1.12.0-rc1 h1:278xZjJt7yE18VOgPp/Nv9Scib37CkN2ZsBRrPSN1Qg= -github.com/ipfs-force-community/sophon-messager v1.12.0-rc1/go.mod h1:64MGbnEpmhuedGfGqmLiQQxt35yMoRPO/bfF9khk+pE= +github.com/ipfs-force-community/sophon-auth v1.12.0 h1:nqjsA6bIv9Rd9+7lHxGDvNJ7gvt/M2yGSxymA6AoxXI= +github.com/ipfs-force-community/sophon-auth v1.12.0/go.mod h1:cGYCfjA/BDB/Km9P7Za6t1hmwpFlPKf8ho/CHmLG81Y= +github.com/ipfs-force-community/sophon-gateway v1.12.1-0.20230630092336-6a7558c97183 h1:kzF0IceJswwz5wGDRGgbt2hiNrZsEOurw/F1/67Nu/I= +github.com/ipfs-force-community/sophon-gateway v1.12.1-0.20230630092336-6a7558c97183/go.mod h1:BEyAgworAAv1JVNKI1BA9NCcAy0OA1GrvxrtcBmn1sw= +github.com/ipfs-force-community/sophon-messager v1.12.0 h1:bkNERt31g4Ff8Kaiuof2txkFJ3aNw/vFwxdHGIAbPXQ= +github.com/ipfs-force-community/sophon-messager v1.12.0/go.mod h1:S8TdKPrnbxOtCB8rsA8n7izi9u1tINE4KtGoiZarhX4= github.com/ipfs-force-community/venus-common-utils v0.0.0-20210924063144-1d3a5b30de87/go.mod h1:RTVEOzM+hkpqmcEWpyLDkx1oGO5r9ZWCgYxG/CsXzJQ= github.com/ipfs-force-community/venus-common-utils v0.0.0-20220217030526-e5e4c6bc14f7 h1:v/1/INcqm3kHLauWQYB63MwWJRWGz+3WEuUPp0jzIl8= github.com/ipfs-force-community/venus-common-utils v0.0.0-20220217030526-e5e4c6bc14f7/go.mod h1:sSTUXgIu95tPHvgcYhdLuELmgPJWCP/pNMFtsrVtOyA= diff --git a/retrievalprovider/httpretrieval/server.go b/retrievalprovider/httpretrieval/server.go index ac3785c0..fee7c04e 100644 --- a/retrievalprovider/httpretrieval/server.go +++ b/retrievalprovider/httpretrieval/server.go @@ -54,10 +54,18 @@ func (s *Server) RetrievalByPieceCID(w http.ResponseWriter, r *http.Request) { badResponse(w, http.StatusNotFound, err) return } + len, err := store.Len(ctx, pieceCIDStr) + if err != nil { + log.Warn(err) + badResponse(w, http.StatusInternalServerError, err) + return + } + log.Infof("piece size: %v", len) + mountReader, err := store.GetMountReader(ctx, pieceCIDStr) if err != nil { log.Warn(err) - badResponse(w, http.StatusNotFound, err) + badResponse(w, http.StatusInternalServerError, err) return } defer mountReader.Close() // nolint diff --git a/version/version.go b/version/version.go index b52f6b2a..8525811f 100644 --- a/version/version.go +++ b/version/version.go @@ -3,7 +3,7 @@ package version var ( CurrentCommit string - Version = "v2.8.0-rc1" + Version = "v2.8.0" ) func UserVersion() string {