diff --git a/.github/workflows/build-zbox.yaml b/.github/workflows/build-zbox.yaml index 794bf13c..3e0e792c 100644 --- a/.github/workflows/build-zbox.yaml +++ b/.github/workflows/build-zbox.yaml @@ -21,7 +21,7 @@ jobs: sudo apt -y install build-essential nghttp2 libnghttp2-dev libssl-dev containerd docker.io - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Setup gopath and gocache run: | @@ -40,7 +40,7 @@ jobs: make install - name: 'Upload Artifact' - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: zbox-linux path: zbox @@ -79,7 +79,7 @@ jobs: go env -w "CC=/mingw64/bin/clang.exe" - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install run: make install @@ -93,7 +93,7 @@ jobs: zip zbox-windows.zip zbox.exe libgcc_s_seh-1.dll libstdc++-6.dll libwinpthread-1.dll - name: 'Upload Artifact' - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: zbox-windows.zip path: zbox-windows.zip @@ -115,13 +115,13 @@ jobs: go-version: '1.21' - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install run: make install - name: 'Upload Artifact' - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: zbox-macos path: zbox diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index c50188e1..eef52f5e 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -34,7 +34,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/.github/workflows/distribute-zboxcli-apt.yml b/.github/workflows/distribute-zboxcli-apt.yml index eb5a170b..6cc9bc9d 100644 --- a/.github/workflows/distribute-zboxcli-apt.yml +++ b/.github/workflows/distribute-zboxcli-apt.yml @@ -49,7 +49,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: path: ${{ env.SRC_DIR }} @@ -140,7 +140,7 @@ jobs: DEB_DIR: ${{ github.workspace }}/deb-files steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: path: ${{ env.SRC_DIR }} @@ -263,7 +263,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: path: ${{ env.SRC_DIR }} diff --git a/.github/workflows/release-zboxcli.yml b/.github/workflows/release-zboxcli.yml index 4f206580..e5badc50 100644 --- a/.github/workflows/release-zboxcli.yml +++ b/.github/workflows/release-zboxcli.yml @@ -22,7 +22,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install deps run: | @@ -87,7 +87,7 @@ jobs: tag_schema: semantic - name: 'Upload Artifact' - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: zbox-linux path: zbox @@ -126,7 +126,7 @@ jobs: go env -w "CC=/mingw64/bin/clang.exe" - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install run: make install @@ -140,7 +140,7 @@ jobs: zip zbox-windows.zip zbox.exe libgcc_s_seh-1.dll libstdc++-6.dll libwinpthread-1.dll - name: 'Upload Artifact' - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: zbox-windows.zip path: zbox-windows.zip @@ -162,7 +162,7 @@ jobs: go-version: '1.20' # The Go version to download (if necessary) and use. - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install run: make install @@ -171,7 +171,7 @@ jobs: run: tar -czvf zbox-macos.tar.gz ./zbox - name: 'Upload Artifact' - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: zbox-macos path: zbox diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2a3a3c37..38dd201a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -51,7 +51,7 @@ jobs: OUTPUT_DIR: ${{ github.workspace }}/output steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: path: ${{ env.SRC_DIR }} @@ -154,7 +154,7 @@ jobs: OUTPUT_DIR: ${{ github.workspace }}/output steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: path: ${{ env.SRC_DIR }} @@ -230,7 +230,7 @@ jobs: OUTPUT_DIR: ${{ github.workspace }}\output steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: path: ${{ env.SRC_DIR }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 87c1865a..71e06f68 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -19,7 +19,7 @@ jobs: go-version: '1.21' - name: Clone Zbox - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install Packages run: | @@ -40,7 +40,7 @@ jobs: go-version: '1.21' - name: Clone 0Box - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: check software run: | @@ -52,7 +52,7 @@ jobs: run: make install - name: 'Upload Artifact' - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: zbox-linux path: zbox diff --git a/cmd/newallocation.go b/cmd/newallocation.go index 460fdadd..8bcdf2a5 100755 --- a/cmd/newallocation.go +++ b/cmd/newallocation.go @@ -237,6 +237,14 @@ var newallocationCmd = &cobra.Command{ fileOptionParams.ForbidRename.Value = forbidRename } + var storageVersion int64 + if flags.Changed("storage_version") { + storageVersion, err = flags.GetInt64("storage_version") + if err != nil { + log.Fatal("invalid forbid_upload: ", err) + } + } + var allocationID string if len(owner) == 0 { options := sdk.CreateAllocationOptions{ @@ -258,6 +266,7 @@ var newallocationCmd = &cobra.Command{ ThirdPartyExtendable: thirdPartyExtendable, Force: force, IsEnterprise: isEnterprise, + StorageVersion: int(storageVersion), } allocationID, _, _, err = sdk.CreateAllocationWith(options) if err != nil { @@ -355,6 +364,8 @@ func init() { newallocationCmd.Flags().Bool("forbid_move", false, "(default false) specify if the users cannot move objects from this allocation") newallocationCmd.Flags().Bool("forbid_copy", false, "(default false) specify if the users cannot copy object from this allocation") newallocationCmd.Flags().Bool("forbid_rename", false, "(default false) specify if the users cannot rename objects in this allocation") + + newallocationCmd.Flags().Int64("storage_version", 0, "storaage version of allocation") } func storeAllocation(allocationID string) { diff --git a/cmd/storage.go b/cmd/storage.go index bc6d41a0..4eafcf31 100644 --- a/cmd/storage.go +++ b/cmd/storage.go @@ -188,6 +188,22 @@ var blobberUpdateCmd = &cobra.Command{ updateBlobber.Capacity = &changedCapacity } + var delegateWallet string + if flags.Changed("delegate_wallet") { + if delegateWallet, err = flags.GetString("delegate_wallet"); err != nil { + log.Fatal(err) + } + updateBlobber.DelegateWallet = &delegateWallet + } + + var storageVersion int + if flags.Changed("storage_version") { + if storageVersion, err = flags.GetInt("storage_version"); err != nil { + log.Fatal(err) + } + updateBlobber.StorageVersion = &storageVersion + } + terms := &sdk.UpdateTerms{} var termsChanged bool if flags.Changed("read_price") { @@ -235,6 +251,15 @@ var blobberUpdateCmd = &cobra.Command{ stakePoolSettingChanged = true } + if flags.Changed("delegate_Wallet") { + var dw string + if dw, err = flags.GetString("delegate_wallet"); err != nil { + log.Fatal(err) + } + stakePoolSettings.DelegateWallet = &dw + stakePoolSettingChanged = true + } + if flags.Changed("service_charge") { var sc float64 if sc, err = flags.GetFloat64("service_charge"); err != nil { @@ -379,7 +404,9 @@ func init() { buf := blobberUpdateCmd.Flags() buf.String("blobber_id", "", "blobber ID, required") - buf.Int64("capacity", 0, " update blobber capacity bid, optional") + buf.String("delegate_wallet", "", "delegate wallet, optional") + buf.Int64("storage_version", 0, "update storage version, optional") + buf.Int64("capacity", 0, "update blobber capacity bid, optional") buf.Float64("read_price", 0.0, "update read_price, optional") buf.Float64("write_price", 0.0, "update write_price, optional") buf.Duration("max_offer_duration", 0*time.Second, "update max_offer_duration, optional") diff --git a/go.mod b/go.mod index 0d69a1bc..bda53c46 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ toolchain go1.22.5 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.18.0-RC8.0.20241028155703-82a3092d4a0c + github.com/0chain/gosdk v1.18.0-RC9 github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 @@ -15,7 +15,7 @@ require ( ) require ( - github.com/0chain/common v1.18.1 // indirect + github.com/0chain/common v1.18.2 // indirect github.com/Luzifer/go-openssl/v3 v3.1.0 // indirect github.com/andybalholm/brotli v1.0.5 // indirect github.com/btcsuite/btcd v0.23.4 // indirect diff --git a/go.sum b/go.sum index 1abeb1d6..c9083279 100644 --- a/go.sum +++ b/go.sum @@ -36,12 +36,12 @@ cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RX cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/0chain/common v1.18.1 h1:QKXdEjK6SB3SqzDS/XbK74jy20d3tc+6PA8J8dFpuGw= -github.com/0chain/common v1.18.1/go.mod h1:Lapu2Tj7z5Sm4r+X141e7vsz4NDODTEypeElYAP3iSw= +github.com/0chain/common v1.18.2 h1:VGWfd3Xqio9xbmebPFnUbuk5QN0pK0xzvifaUggJF5g= +github.com/0chain/common v1.18.2/go.mod h1:Lapu2Tj7z5Sm4r+X141e7vsz4NDODTEypeElYAP3iSw= github.com/0chain/errors v1.0.3 h1:QQZPFxTfnMcRdt32DXbzRQIfGWmBsKoEdszKQDb0rRM= github.com/0chain/errors v1.0.3/go.mod h1:xymD6nVgrbgttWwkpSCfLLEJbFO6iHGQwk/yeSuYkIc= -github.com/0chain/gosdk v1.18.0-RC8.0.20241028155703-82a3092d4a0c h1:t3AOpN6pZYGO/AT8LC5ZNpdM8GQJrd9kOIKZuTa9Ddk= -github.com/0chain/gosdk v1.18.0-RC8.0.20241028155703-82a3092d4a0c/go.mod h1:fw3TUzF7HWNBuksA2WZzLcHlMz+A1XA9as5i3KUBqXg= +github.com/0chain/gosdk v1.18.0-RC9 h1:vGkdZnt7uS+1OmgS1Qv/6wFPlZqUoJvqWuenf0tMffs= +github.com/0chain/gosdk v1.18.0-RC9/go.mod h1:q/zFTOMHU2hFGjFzIxCOZLonsmrSzYVP3ExCHHOmL6w= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DataDog/zstd v1.4.5 h1:EndNeuB0l9syBZhut0wns3gV1hL8zX8LIu6ZiVHWLIQ=