From 6b5fcfdd233402a484fa57aa53f31ebe885d2122 Mon Sep 17 00:00:00 2001 From: hitenjain14 Date: Sun, 4 Feb 2024 02:55:18 +0530 Subject: [PATCH 001/228] add download progress storer --- cmd/download.go | 9 ++++++--- go.mod | 17 +++++++++++------ go.sum | 30 ++++++++++++++++++++---------- 3 files changed, 37 insertions(+), 19 deletions(-) diff --git a/cmd/download.go b/cmd/download.go index 1922fbfb..e5e91415 100644 --- a/cmd/download.go +++ b/cmd/download.go @@ -7,6 +7,7 @@ import ( "sync" "github.com/0chain/gosdk/zboxcore/fileref" + "github.com/0chain/zboxcli/util" "github.com/0chain/gosdk/zboxcore/sdk" "github.com/spf13/cobra" @@ -154,10 +155,11 @@ var downloadCmd = &cobra.Command{ if thumbnail { errE = allocationObj.DownloadThumbnail(localPath, remotePath, verifyDownload, statusBar, true) } else { - if startBlock != 0 || endBlock != 0 { + if (startBlock != 0 || endBlock != 0) && startBlock < endBlock { errE = allocationObj.DownloadFileByBlock(localPath, remotePath, startBlock, endBlock, numBlocks, verifyDownload, statusBar, true) } else { - errE = allocationObj.DownloadFile(localPath, remotePath, verifyDownload, statusBar, true) + ds := sdk.CreateFsDownloadProgress() + errE = allocationObj.DownloadFile(localPath, remotePath, verifyDownload, statusBar, true, sdk.WithDownloadProgressStorer(ds), sdk.WithWorkDir(util.GetHomeDir())) } } } else if len(multidownloadJSON) > 0 { @@ -216,8 +218,9 @@ func MultiDownload(a *sdk.Allocation, jsonMultiDownloadOptions string, statusBar if i > 0 { statusBar.wg.Add(1) } + ds := sdk.CreateFsDownloadProgress() if options[i].DownloadOp == 1 { - err = a.DownloadFile(options[i].LocalPath, options[i].RemotePath, verifyDownload, statusBar, i == lastOp) + err = a.DownloadFile(options[i].LocalPath, options[i].RemotePath, verifyDownload, statusBar, i == lastOp, sdk.WithDownloadProgressStorer(ds), sdk.WithWorkDir(util.GetHomeDir())) } else { err = a.DownloadThumbnail(options[i].LocalPath, options[i].RemotePath, false, statusBar, i == lastOp) } diff --git a/go.mod b/go.mod index 561c9c3d..c4256b1f 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.11.1-0.20240121215010-9bc91c688c7d + github.com/0chain/gosdk v1.11.1-0.20240203212223-466cb96eafd4 github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 @@ -15,6 +15,7 @@ require ( require ( github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565 // 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 github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect github.com/btcsuite/btcd/btcutil v1.1.3 // indirect @@ -31,7 +32,9 @@ require ( github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/herumi/bls-go-binary v1.31.0 // indirect + github.com/hitenjain14/fasthttp v0.0.0-20240201092245-8e4835c0e974 // indirect github.com/inconshreveable/mousetrap v1.0.1 // indirect + github.com/klauspost/compress v1.17.0 // indirect github.com/klauspost/cpuid/v2 v2.2.4 // indirect github.com/klauspost/reedsolomon v1.11.8 // indirect github.com/lithammer/shortuuid/v3 v3.0.7 // indirect @@ -57,16 +60,18 @@ require ( github.com/tklauser/go-sysconf v0.3.11 // indirect github.com/tklauser/numcpus v0.6.0 // indirect github.com/tyler-smith/go-bip39 v1.1.0 // indirect + github.com/valyala/bytebufferpool v1.0.0 // indirect + github.com/valyala/fasthttp v1.51.0 // indirect github.com/yusufpapurcu/wmi v1.2.2 // indirect go.dedis.ch/fixbuf v1.0.3 // indirect go.dedis.ch/kyber/v3 v3.1.0 // indirect go.uber.org/atomic v1.10.0 // indirect go.uber.org/multierr v1.9.0 // indirect go.uber.org/zap v1.24.0 // indirect - golang.org/x/crypto v0.6.0 // indirect - golang.org/x/sync v0.1.0 // indirect - golang.org/x/sys v0.7.0 // indirect - golang.org/x/text v0.8.0 // indirect + golang.org/x/crypto v0.17.0 // indirect + golang.org/x/sync v0.5.0 // indirect + golang.org/x/sys v0.15.0 // indirect + golang.org/x/text v0.14.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect @@ -74,4 +79,4 @@ require ( ) // temporary, for development -//replace github.com/0chain/gosdk => ../gosdk +// replace github.com/0chain/gosdk => ../gosdk diff --git a/go.sum b/go.sum index 870439d3..97ab61ec 100644 --- a/go.sum +++ b/go.sum @@ -40,14 +40,16 @@ github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565 h1:z+DtCR8mBsjPnEs github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565/go.mod h1:UyDC8Qyl5z9lGkCnf9RHJPMektnFX8XtCJZHXCCVj8E= 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.11.1-0.20240121215010-9bc91c688c7d h1:c5pxk3bjtV5yZlNpF1kD8dnnrqU3sXmTRLiCsSZymNQ= -github.com/0chain/gosdk v1.11.1-0.20240121215010-9bc91c688c7d/go.mod h1:DAg/de6vodjEa7CM1/LjElOwntRtNV5lb9rMRaR7fzU= +github.com/0chain/gosdk v1.11.1-0.20240203212223-466cb96eafd4 h1:snFGPccC+0xB6KKJ4gzfPsaDcvAuQiNO2mtC8DwO4os= +github.com/0chain/gosdk v1.11.1-0.20240203212223-466cb96eafd4/go.mod h1:ld0CtqdivpMrEoTWA5Z0nbv3A6Q7+w2/cA3iRGCGYS8= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= github.com/Luzifer/go-openssl/v3 v3.1.0/go.mod h1:liy3FXuuS8hfDlYh1T+l78AwQ/NjZflJz0NDvjKhwDs= github.com/VictoriaMetrics/fastcache v1.6.0 h1:C/3Oi3EiBCqufydp1neRZkqcwmEiuRT9c3fqvvgKm5o= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= +github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs= +github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= @@ -199,6 +201,8 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/herumi/bls-go-binary v1.31.0 h1:L1goQ2tMtGgpXCg5AwHAdJQpLs/pfnWWEc3Wog6OhmI= github.com/herumi/bls-go-binary v1.31.0/go.mod h1:O4Vp1AfR4raRGwFeQpr9X/PQtncEicMoOe6BQt1oX0Y= +github.com/hitenjain14/fasthttp v0.0.0-20240201092245-8e4835c0e974 h1:oEjH9SSKBlzwDyYjzZaqRpxo7GlfUJCyRoOk7QHKSDs= +github.com/hitenjain14/fasthttp v0.0.0-20240201092245-8e4835c0e974/go.mod h1:RZMcXy7u4S+E97IXYTe7WHZ3+mCYOh4vys8PkIGZeXk= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= github.com/holiman/uint256 v1.2.2-0.20230321075855-87b91420868c h1:DZfsyhDK1hnSS5lH8l+JggqzEleHteTYfutAiVlSUM8= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= @@ -219,6 +223,8 @@ github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1 github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= +github.com/klauspost/compress v1.17.0 h1:Rnbp4K9EjcDuVuHtd0dgA4qNuv9yKDYKK1ulpJwgrqM= +github.com/klauspost/compress v1.17.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/klauspost/cpuid/v2 v2.2.4 h1:acbojRNwl3o09bUq+yDCtZFc1aiwaAAxtcn8YkZXnvk= github.com/klauspost/cpuid/v2 v2.2.4/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= github.com/klauspost/reedsolomon v1.11.8 h1:s8RpUW5TK4hjr+djiOpbZJB4ksx+TdYbRH7vHQpwPOY= @@ -326,6 +332,10 @@ github.com/tklauser/numcpus v0.6.0/go.mod h1:FEZLMke0lhOUG6w2JadTzp0a+Nl8PF/GFkQ github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8= github.com/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3CWg+kkNaLt55U= github.com/urfave/cli/v2 v2.17.2-0.20221006022127-8f469abc00aa h1:5SqCsI/2Qya2bCzK15ozrqo2sZxkh0FHynJZOTVoV6Q= +github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= +github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= +github.com/valyala/fasthttp v1.51.0 h1:8b30A5JlZ6C7AS81RsWjYMQmrZG6feChmgAolCl1SqA= +github.com/valyala/fasthttp v1.51.0/go.mod h1:oI2XroL+lI7vdXyYoQk03bXBThfFl2cVdIA3Xl7cH8g= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -368,8 +378,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= -golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= +golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= +golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -457,8 +467,8 @@ golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= +golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190124100055-b90733256f2e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -504,8 +514,8 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= -golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -513,8 +523,8 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3 golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= From 16666268cc2702e37d27320f760fa3369d80a030 Mon Sep 17 00:00:00 2001 From: zorro30 Date: Sun, 4 Feb 2024 21:31:16 +0530 Subject: [PATCH 002/228] removed --free_allocation flag which is not in the system now --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index eeb15f13..45a3cde4 100644 --- a/README.md +++ b/README.md @@ -310,10 +310,6 @@ form of a json file Once created, an allocation funded by a free storage marker becomes identical to any other allocation; Its history forgotten. -```shell -./zbox newallocation --free_allocation markers/referal_marker.json -``` - ```shell Allocation created : d0939e912851959637257573b08c748474f0dd0ebbc8e191e4f6ad69e4fdc7ac ``` From cd14af4c25a2aaf8f407509df71d524669cf4145 Mon Sep 17 00:00:00 2001 From: Jayash Satolia Date: Thu, 15 Feb 2024 02:09:19 +0530 Subject: [PATCH 003/228] Updated sprint-1.13 with staging From 671b7722c8d2ccfcf2ea495ca4fbd55ed013e7a2 Mon Sep 17 00:00:00 2001 From: Jayash Satolia Date: Thu, 15 Feb 2024 21:29:42 +0530 Subject: [PATCH 004/228] Update gosdk --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 01dfd50c..1329eb36 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.12.1 + github.com/0chain/gosdk v1.12.4-0.20240215155605-0f583eba40db github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 diff --git a/go.sum b/go.sum index e14b501f..0485da00 100644 --- a/go.sum +++ b/go.sum @@ -40,8 +40,8 @@ github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565 h1:z+DtCR8mBsjPnEs github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565/go.mod h1:UyDC8Qyl5z9lGkCnf9RHJPMektnFX8XtCJZHXCCVj8E= 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.12.1 h1:U4XX87tao+J7rqiOdVBa1bWh/SKz+kiSvxGbVjdvWwE= -github.com/0chain/gosdk v1.12.1/go.mod h1:ew7kU2Cf1Y/CzoxMqtnmflD1CuSPaOI5TukoXA26Sz4= +github.com/0chain/gosdk v1.12.4-0.20240215155605-0f583eba40db h1:+08s7iSbJ18tF68udX7t1Pb22RUIP0j6jBiQT2eK7k8= +github.com/0chain/gosdk v1.12.4-0.20240215155605-0f583eba40db/go.mod h1:ew7kU2Cf1Y/CzoxMqtnmflD1CuSPaOI5TukoXA26Sz4= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= From 36dfe9a4475617949393770f65b9dfcd311a9ce8 Mon Sep 17 00:00:00 2001 From: Jayash Satolia Date: Sun, 18 Feb 2024 02:26:40 +0530 Subject: [PATCH 005/228] Feature blobber authorization --- cmd/newallocation.go | 16 +++++++++++++++- go.mod | 2 +- go.sum | 4 ++-- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/cmd/newallocation.go b/cmd/newallocation.go index 10e24d33..8135f315 100755 --- a/cmd/newallocation.go +++ b/cmd/newallocation.go @@ -23,6 +23,7 @@ var ( size *int64 allocationFileName *string preferred_blobbers []string + blobber_auth_tickets []string ) func getPriceRange(val string) (pr sdk.PriceRange, err error) { @@ -119,6 +120,17 @@ var newallocationCmd = &cobra.Command{ } } + if flags.Changed("blobber_auth_tickets") { + b, err := flags.GetString("blobber_auth_tickets") + if err != nil { + log.Fatal("invalid read_price value: ", err) + } + blobber_auth_tickets = strings.Split(b, ",") + for i, id := range blobber_auth_tickets { + blobber_auth_tickets[i] = strings.TrimSpace(id) + } + } + if flags.Changed("read_price") { rps, err := flags.GetString("read_price") if err != nil { @@ -239,6 +251,7 @@ var newallocationCmd = &cobra.Command{ }, Lock: uint64(lock), BlobberIds: preferred_blobbers, + BlobberAuthTickets: blobber_auth_tickets, FileOptionsParams: &fileOptionParams, ThirdPartyExtendable: thirdPartyExtendable, } @@ -258,7 +271,7 @@ var newallocationCmd = &cobra.Command{ } allocationID, _, _, err = sdk.CreateAllocationForOwner(owner, ownerPublicKey, *datashards, *parityshards, - *size, readPrice, writePrice, lock, preferred_blobbers, thirdPartyExtendable, &fileOptionParams) + *size, readPrice, writePrice, lock, preferred_blobbers, blobber_auth_tickets, thirdPartyExtendable, &fileOptionParams) if err != nil { log.Fatal("Error creating allocation: ", err) } @@ -327,6 +340,7 @@ func init() { newallocationCmd.Flags().String("name", "", "allocation name") newallocationCmd.Flags().String("preferred_blobbers", "", "coma seperated list of preferred blobbers") + newallocationCmd.Flags().String("blobber_auth_tickets", "", "coma seperated list of blobber auth tickets") newallocationCmd.Flags().Bool("third_party_extendable", false, "(default false) specify if the allocation can be extended by users other than the owner") newallocationCmd.Flags().Bool("forbid_upload", false, "(default false) specify if users cannot upload to this allocation") diff --git a/go.mod b/go.mod index 01dfd50c..ef363ae2 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.12.1 + github.com/0chain/gosdk v1.12.4-0.20240217205223-0b62c0cce448 github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 diff --git a/go.sum b/go.sum index e14b501f..51a792ad 100644 --- a/go.sum +++ b/go.sum @@ -40,8 +40,8 @@ github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565 h1:z+DtCR8mBsjPnEs github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565/go.mod h1:UyDC8Qyl5z9lGkCnf9RHJPMektnFX8XtCJZHXCCVj8E= 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.12.1 h1:U4XX87tao+J7rqiOdVBa1bWh/SKz+kiSvxGbVjdvWwE= -github.com/0chain/gosdk v1.12.1/go.mod h1:ew7kU2Cf1Y/CzoxMqtnmflD1CuSPaOI5TukoXA26Sz4= +github.com/0chain/gosdk v1.12.4-0.20240217205223-0b62c0cce448 h1:M054U//2Aw18pw83eyF0ijYpSl57NxvkPeZMSTEBXwg= +github.com/0chain/gosdk v1.12.4-0.20240217205223-0b62c0cce448/go.mod h1:ew7kU2Cf1Y/CzoxMqtnmflD1CuSPaOI5TukoXA26Sz4= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= From 9bcb118716f9ef855346239e41517ebae09ba96d Mon Sep 17 00:00:00 2001 From: Jayash Satolia Date: Sun, 18 Feb 2024 03:59:02 +0530 Subject: [PATCH 006/228] Fixed update blobber settings --- cmd/storage.go | 10 ++++++++++ go.mod | 2 +- go.sum | 4 ++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/cmd/storage.go b/cmd/storage.go index 4d1794d4..0309fa13 100644 --- a/cmd/storage.go +++ b/cmd/storage.go @@ -133,6 +133,7 @@ var blobberInfoCmd = &cobra.Command{ fmt.Println("capacity_used: ", blob.Allocated) fmt.Println("total_stake: ", blob.TotalStake) fmt.Println("not_available: ", blob.NotAvailable) + fmt.Println("is_restricted: ", blob.IsRestricted) fmt.Println("terms:") fmt.Println(" read_price: ", blob.Terms.ReadPrice, "/ GB") fmt.Println(" write_price: ", blob.Terms.WritePrice, "/ GB") @@ -281,6 +282,14 @@ var blobberUpdateCmd = &cobra.Command{ updateBlobber.NotAvailable = &ia } + if flags.Changed("is_restricted") { + var ia bool + if ia, err = flags.GetBool("is_restricted"); err != nil { + log.Fatal(err) + } + updateBlobber.NotAvailable = &ia + } + if termsChanged { updateBlobber.Terms = terms } @@ -322,6 +331,7 @@ func init() { buf.Int("num_delegates", 0, "update num_delegates, optional") buf.Float64("service_charge", 0.0, "update service_charge, optional") buf.Bool("not_available", true, "(default false) set blobber's availability for new allocations") + buf.Bool("is_restricted", true, "(default false) set is_restricted") buf.String("url", "", "update the url of the blobber, optional") blobberUpdateCmd.MarkFlagRequired("blobber_id") } diff --git a/go.mod b/go.mod index ef363ae2..2115ab6a 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.12.4-0.20240217205223-0b62c0cce448 + github.com/0chain/gosdk v1.12.4-0.20240217212211-749cdb7aa996 github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 diff --git a/go.sum b/go.sum index 51a792ad..167b52b4 100644 --- a/go.sum +++ b/go.sum @@ -40,8 +40,8 @@ github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565 h1:z+DtCR8mBsjPnEs github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565/go.mod h1:UyDC8Qyl5z9lGkCnf9RHJPMektnFX8XtCJZHXCCVj8E= 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.12.4-0.20240217205223-0b62c0cce448 h1:M054U//2Aw18pw83eyF0ijYpSl57NxvkPeZMSTEBXwg= -github.com/0chain/gosdk v1.12.4-0.20240217205223-0b62c0cce448/go.mod h1:ew7kU2Cf1Y/CzoxMqtnmflD1CuSPaOI5TukoXA26Sz4= +github.com/0chain/gosdk v1.12.4-0.20240217212211-749cdb7aa996 h1:146ZuXAHQHGOGs05QvAO0SGGcsrP6Xj0Sw4bSu/OlxU= +github.com/0chain/gosdk v1.12.4-0.20240217212211-749cdb7aa996/go.mod h1:ew7kU2Cf1Y/CzoxMqtnmflD1CuSPaOI5TukoXA26Sz4= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= From c1115c903cc8d11dee391c7266640781c952d9e9 Mon Sep 17 00:00:00 2001 From: devyetii Date: Sun, 18 Feb 2024 23:42:25 +0200 Subject: [PATCH 007/228] update gosdk --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 01dfd50c..6dad4efd 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.12.1 + github.com/0chain/gosdk v1.12.4 github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 diff --git a/go.sum b/go.sum index e14b501f..d07b602d 100644 --- a/go.sum +++ b/go.sum @@ -42,6 +42,8 @@ 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.12.1 h1:U4XX87tao+J7rqiOdVBa1bWh/SKz+kiSvxGbVjdvWwE= github.com/0chain/gosdk v1.12.1/go.mod h1:ew7kU2Cf1Y/CzoxMqtnmflD1CuSPaOI5TukoXA26Sz4= +github.com/0chain/gosdk v1.12.4 h1:Dvsr40KR6LD+Yf1aOVzx8nfPT4wV9SxLKnMs/LKvFes= +github.com/0chain/gosdk v1.12.4/go.mod h1:ew7kU2Cf1Y/CzoxMqtnmflD1CuSPaOI5TukoXA26Sz4= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= From ab44a85f518376e4da85697610806de5237b7934 Mon Sep 17 00:00:00 2001 From: peterlimg Date: Mon, 19 Feb 2024 21:08:57 +0800 Subject: [PATCH 008/228] Update gosdk - fix sync --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 01dfd50c..4a895c28 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.12.1 + github.com/0chain/gosdk v1.12.5-0.20240215163051-38c56e20fc62 github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 diff --git a/go.sum b/go.sum index e14b501f..a3ca5c6a 100644 --- a/go.sum +++ b/go.sum @@ -42,6 +42,8 @@ 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.12.1 h1:U4XX87tao+J7rqiOdVBa1bWh/SKz+kiSvxGbVjdvWwE= github.com/0chain/gosdk v1.12.1/go.mod h1:ew7kU2Cf1Y/CzoxMqtnmflD1CuSPaOI5TukoXA26Sz4= +github.com/0chain/gosdk v1.12.5-0.20240215163051-38c56e20fc62 h1:eWBx6eb33cPMbgV3Z5rWgnFfw1q4HKGzdzBG15uEzgU= +github.com/0chain/gosdk v1.12.5-0.20240215163051-38c56e20fc62/go.mod h1:ew7kU2Cf1Y/CzoxMqtnmflD1CuSPaOI5TukoXA26Sz4= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= From 88df1bb684e83c173fe524870952546a591df165 Mon Sep 17 00:00:00 2001 From: zorro30 Date: Mon, 19 Feb 2024 22:35:24 +0530 Subject: [PATCH 009/228] updated gosdk version --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 6dad4efd..06e72248 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.12.4 + github.com/0chain/gosdk v1.12.5 github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 diff --git a/go.sum b/go.sum index d07b602d..244864ec 100644 --- a/go.sum +++ b/go.sum @@ -44,6 +44,8 @@ github.com/0chain/gosdk v1.12.1 h1:U4XX87tao+J7rqiOdVBa1bWh/SKz+kiSvxGbVjdvWwE= github.com/0chain/gosdk v1.12.1/go.mod h1:ew7kU2Cf1Y/CzoxMqtnmflD1CuSPaOI5TukoXA26Sz4= github.com/0chain/gosdk v1.12.4 h1:Dvsr40KR6LD+Yf1aOVzx8nfPT4wV9SxLKnMs/LKvFes= github.com/0chain/gosdk v1.12.4/go.mod h1:ew7kU2Cf1Y/CzoxMqtnmflD1CuSPaOI5TukoXA26Sz4= +github.com/0chain/gosdk v1.12.5 h1:v659JdBcgtg2N9TxnJRac6/kaAWqP0w8KjFuVpT93rw= +github.com/0chain/gosdk v1.12.5/go.mod h1:ew7kU2Cf1Y/CzoxMqtnmflD1CuSPaOI5TukoXA26Sz4= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= From 6150e287e91aee9fd042f3e2cd1be1e4ad064707 Mon Sep 17 00:00:00 2001 From: zorro30 Date: Mon, 19 Feb 2024 23:01:57 +0530 Subject: [PATCH 010/228] updated gosdk version --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 06e72248..973060a1 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.12.5 + github.com/0chain/gosdk v1.12.6 github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 diff --git a/go.sum b/go.sum index 244864ec..b14127a2 100644 --- a/go.sum +++ b/go.sum @@ -46,6 +46,8 @@ github.com/0chain/gosdk v1.12.4 h1:Dvsr40KR6LD+Yf1aOVzx8nfPT4wV9SxLKnMs/LKvFes= github.com/0chain/gosdk v1.12.4/go.mod h1:ew7kU2Cf1Y/CzoxMqtnmflD1CuSPaOI5TukoXA26Sz4= github.com/0chain/gosdk v1.12.5 h1:v659JdBcgtg2N9TxnJRac6/kaAWqP0w8KjFuVpT93rw= github.com/0chain/gosdk v1.12.5/go.mod h1:ew7kU2Cf1Y/CzoxMqtnmflD1CuSPaOI5TukoXA26Sz4= +github.com/0chain/gosdk v1.12.6 h1:6ljC8irMhsgRwJhDhZIdbI5D4UQmGDIOEJiHbWRpIXc= +github.com/0chain/gosdk v1.12.6/go.mod h1:ew7kU2Cf1Y/CzoxMqtnmflD1CuSPaOI5TukoXA26Sz4= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= From b08a4d425e64eba9258b3766b59db1a8b33556a3 Mon Sep 17 00:00:00 2001 From: peterlimg Date: Tue, 20 Feb 2024 08:41:15 +0800 Subject: [PATCH 011/228] Update gosdk --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 4a895c28..3d050993 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.12.5-0.20240215163051-38c56e20fc62 + github.com/0chain/gosdk v1.12.5-0.20240220003935-991c98538eed github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 diff --git a/go.sum b/go.sum index a3ca5c6a..4873a6ca 100644 --- a/go.sum +++ b/go.sum @@ -40,10 +40,10 @@ github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565 h1:z+DtCR8mBsjPnEs github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565/go.mod h1:UyDC8Qyl5z9lGkCnf9RHJPMektnFX8XtCJZHXCCVj8E= 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.12.1 h1:U4XX87tao+J7rqiOdVBa1bWh/SKz+kiSvxGbVjdvWwE= -github.com/0chain/gosdk v1.12.1/go.mod h1:ew7kU2Cf1Y/CzoxMqtnmflD1CuSPaOI5TukoXA26Sz4= github.com/0chain/gosdk v1.12.5-0.20240215163051-38c56e20fc62 h1:eWBx6eb33cPMbgV3Z5rWgnFfw1q4HKGzdzBG15uEzgU= github.com/0chain/gosdk v1.12.5-0.20240215163051-38c56e20fc62/go.mod h1:ew7kU2Cf1Y/CzoxMqtnmflD1CuSPaOI5TukoXA26Sz4= +github.com/0chain/gosdk v1.12.5-0.20240220003935-991c98538eed h1:1irazVMriPVXL2RuIhVXnBG3QtFz1qMaPPUM0+MU+Bg= +github.com/0chain/gosdk v1.12.5-0.20240220003935-991c98538eed/go.mod h1:ew7kU2Cf1Y/CzoxMqtnmflD1CuSPaOI5TukoXA26Sz4= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= From 0e5bd56845343bcbf5353cb2988e73c707060be1 Mon Sep 17 00:00:00 2001 From: peterlimg Date: Tue, 20 Feb 2024 08:46:54 +0800 Subject: [PATCH 012/228] Update gosdk - windows fix logs --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 3d050993..5a3f333c 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.12.5-0.20240220003935-991c98538eed + github.com/0chain/gosdk v1.12.7-0.20240220004529-90818037118c github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 diff --git a/go.sum b/go.sum index 4873a6ca..61d85637 100644 --- a/go.sum +++ b/go.sum @@ -44,6 +44,8 @@ github.com/0chain/gosdk v1.12.5-0.20240215163051-38c56e20fc62 h1:eWBx6eb33cPMbgV github.com/0chain/gosdk v1.12.5-0.20240215163051-38c56e20fc62/go.mod h1:ew7kU2Cf1Y/CzoxMqtnmflD1CuSPaOI5TukoXA26Sz4= github.com/0chain/gosdk v1.12.5-0.20240220003935-991c98538eed h1:1irazVMriPVXL2RuIhVXnBG3QtFz1qMaPPUM0+MU+Bg= github.com/0chain/gosdk v1.12.5-0.20240220003935-991c98538eed/go.mod h1:ew7kU2Cf1Y/CzoxMqtnmflD1CuSPaOI5TukoXA26Sz4= +github.com/0chain/gosdk v1.12.7-0.20240220004529-90818037118c h1:XRX354j5QPQswlEyfo6FibcUfn11fat/A2M0inZV8Ck= +github.com/0chain/gosdk v1.12.7-0.20240220004529-90818037118c/go.mod h1:ew7kU2Cf1Y/CzoxMqtnmflD1CuSPaOI5TukoXA26Sz4= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= From e81682c4aa16a58404e0bc509c00ce997d6f6f79 Mon Sep 17 00:00:00 2001 From: peterlimg Date: Wed, 21 Feb 2024 11:17:23 +0800 Subject: [PATCH 013/228] Fix windows sync --- cmd/sync.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/cmd/sync.go b/cmd/sync.go index 3089f9e3..7154224c 100644 --- a/cmd/sync.go +++ b/cmd/sync.go @@ -3,7 +3,7 @@ package cmd import ( "fmt" "os" - "runtime" + "path/filepath" "strings" "sync" @@ -230,17 +230,15 @@ var syncCmd = &cobra.Command{ downloadSlice := make([]MultiDownloadOption, 0) downloadStatusBars := make([]*StatusBar, 0) for _, f := range lDiff { - operatingSys := runtime.GOOS + // operatingSys := runtime.GOOS // Check the operating system and modify the path accordingly - if operatingSys == "windows" { - f.Path = strings.ReplaceAll(f.Path, "/", "\\") - } localpath = strings.TrimRight(localpath, "/") - lPath := localpath + f.Path + lPath := filepath.Join(localpath, f.Path) fileRemotePath, err := getFullRemotePath(f.Path, remotepath) if err != nil { return } + switch f.Op { case sdk.Download: wg.Add(1) From 5e3a08b1f458fffd3915c4b6d2476364a65e12a2 Mon Sep 17 00:00:00 2001 From: peterlimg Date: Wed, 21 Feb 2024 11:39:37 +0800 Subject: [PATCH 014/228] Fix windows sync --- cmd/sync.go | 2 -- go.mod | 2 +- go.sum | 6 ++---- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/cmd/sync.go b/cmd/sync.go index 7154224c..a9b03324 100644 --- a/cmd/sync.go +++ b/cmd/sync.go @@ -230,8 +230,6 @@ var syncCmd = &cobra.Command{ downloadSlice := make([]MultiDownloadOption, 0) downloadStatusBars := make([]*StatusBar, 0) for _, f := range lDiff { - // operatingSys := runtime.GOOS - // Check the operating system and modify the path accordingly localpath = strings.TrimRight(localpath, "/") lPath := filepath.Join(localpath, f.Path) fileRemotePath, err := getFullRemotePath(f.Path, remotepath) diff --git a/go.mod b/go.mod index 5a3f333c..973060a1 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.12.7-0.20240220004529-90818037118c + github.com/0chain/gosdk v1.12.6 github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 diff --git a/go.sum b/go.sum index 61d85637..519deb7f 100644 --- a/go.sum +++ b/go.sum @@ -40,10 +40,8 @@ github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565 h1:z+DtCR8mBsjPnEs github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565/go.mod h1:UyDC8Qyl5z9lGkCnf9RHJPMektnFX8XtCJZHXCCVj8E= 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.12.5-0.20240215163051-38c56e20fc62 h1:eWBx6eb33cPMbgV3Z5rWgnFfw1q4HKGzdzBG15uEzgU= -github.com/0chain/gosdk v1.12.5-0.20240215163051-38c56e20fc62/go.mod h1:ew7kU2Cf1Y/CzoxMqtnmflD1CuSPaOI5TukoXA26Sz4= -github.com/0chain/gosdk v1.12.5-0.20240220003935-991c98538eed h1:1irazVMriPVXL2RuIhVXnBG3QtFz1qMaPPUM0+MU+Bg= -github.com/0chain/gosdk v1.12.5-0.20240220003935-991c98538eed/go.mod h1:ew7kU2Cf1Y/CzoxMqtnmflD1CuSPaOI5TukoXA26Sz4= +github.com/0chain/gosdk v1.12.6 h1:6ljC8irMhsgRwJhDhZIdbI5D4UQmGDIOEJiHbWRpIXc= +github.com/0chain/gosdk v1.12.6/go.mod h1:ew7kU2Cf1Y/CzoxMqtnmflD1CuSPaOI5TukoXA26Sz4= github.com/0chain/gosdk v1.12.7-0.20240220004529-90818037118c h1:XRX354j5QPQswlEyfo6FibcUfn11fat/A2M0inZV8Ck= github.com/0chain/gosdk v1.12.7-0.20240220004529-90818037118c/go.mod h1:ew7kU2Cf1Y/CzoxMqtnmflD1CuSPaOI5TukoXA26Sz4= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= From 48737125633c73d7bb87153be9bffcb118725025 Mon Sep 17 00:00:00 2001 From: Hitenjain14 Date: Sun, 25 Feb 2024 17:33:34 +0530 Subject: [PATCH 015/228] update gosdk to sprint-1.13 --- go.mod | 6 +++--- go.sum | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index ac266326..a1f85f23 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.12.1 + github.com/0chain/gosdk v1.12.2-0.20240224212924-e46cfb60cb14 github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 @@ -32,7 +32,7 @@ require ( github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/herumi/bls-go-binary v1.31.0 // indirect - github.com/hitenjain14/fasthttp v0.0.0-20240201092245-8e4835c0e974 // indirect + github.com/hitenjain14/fasthttp v0.0.0-20240223160417-7458814cf3d0 // indirect github.com/inconshreveable/mousetrap v1.0.1 // indirect github.com/klauspost/compress v1.17.0 // indirect github.com/klauspost/cpuid/v2 v2.2.4 // indirect @@ -68,7 +68,7 @@ require ( go.uber.org/atomic v1.10.0 // indirect go.uber.org/multierr v1.9.0 // indirect go.uber.org/zap v1.24.0 // indirect - golang.org/x/crypto v0.16.0 // indirect + golang.org/x/crypto v0.17.0 // indirect golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect diff --git a/go.sum b/go.sum index 7541172a..979cdb1b 100644 --- a/go.sum +++ b/go.sum @@ -40,8 +40,8 @@ github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565 h1:z+DtCR8mBsjPnEs github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565/go.mod h1:UyDC8Qyl5z9lGkCnf9RHJPMektnFX8XtCJZHXCCVj8E= 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.12.1 h1:U4XX87tao+J7rqiOdVBa1bWh/SKz+kiSvxGbVjdvWwE= -github.com/0chain/gosdk v1.12.1/go.mod h1:ew7kU2Cf1Y/CzoxMqtnmflD1CuSPaOI5TukoXA26Sz4= +github.com/0chain/gosdk v1.12.2-0.20240224212924-e46cfb60cb14 h1:zzu2SSp4o5FX3pdscbU434ZhsSYn98OaWSV72kZxONA= +github.com/0chain/gosdk v1.12.2-0.20240224212924-e46cfb60cb14/go.mod h1:UhPOdN/1HKqEjVPNS8Zph1Kl4NpWsBmQnqlh9NRsVDY= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= @@ -201,8 +201,8 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/herumi/bls-go-binary v1.31.0 h1:L1goQ2tMtGgpXCg5AwHAdJQpLs/pfnWWEc3Wog6OhmI= github.com/herumi/bls-go-binary v1.31.0/go.mod h1:O4Vp1AfR4raRGwFeQpr9X/PQtncEicMoOe6BQt1oX0Y= -github.com/hitenjain14/fasthttp v0.0.0-20240201092245-8e4835c0e974 h1:oEjH9SSKBlzwDyYjzZaqRpxo7GlfUJCyRoOk7QHKSDs= -github.com/hitenjain14/fasthttp v0.0.0-20240201092245-8e4835c0e974/go.mod h1:RZMcXy7u4S+E97IXYTe7WHZ3+mCYOh4vys8PkIGZeXk= +github.com/hitenjain14/fasthttp v0.0.0-20240223160417-7458814cf3d0 h1:XCrNCir8+zDo+Ku7B+AXhzFnsJvSelx1YbQQTNpxtqI= +github.com/hitenjain14/fasthttp v0.0.0-20240223160417-7458814cf3d0/go.mod h1:RZMcXy7u4S+E97IXYTe7WHZ3+mCYOh4vys8PkIGZeXk= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= github.com/holiman/uint256 v1.2.2-0.20230321075855-87b91420868c h1:DZfsyhDK1hnSS5lH8l+JggqzEleHteTYfutAiVlSUM8= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= @@ -378,8 +378,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY= -golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= +golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= From 3711d05977501ffdd81abf191a719ddf8b166bde Mon Sep 17 00:00:00 2001 From: Hitenjain14 Date: Tue, 27 Feb 2024 00:04:15 +0530 Subject: [PATCH 016/228] fix blocks check --- cmd/download.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/download.go b/cmd/download.go index e5e91415..2931e313 100644 --- a/cmd/download.go +++ b/cmd/download.go @@ -155,7 +155,7 @@ var downloadCmd = &cobra.Command{ if thumbnail { errE = allocationObj.DownloadThumbnail(localPath, remotePath, verifyDownload, statusBar, true) } else { - if (startBlock != 0 || endBlock != 0) && startBlock < endBlock { + if startBlock != 0 || endBlock != 0 { errE = allocationObj.DownloadFileByBlock(localPath, remotePath, startBlock, endBlock, numBlocks, verifyDownload, statusBar, true) } else { ds := sdk.CreateFsDownloadProgress() @@ -242,7 +242,7 @@ func init() { downloadCmd.PersistentFlags().String("multidownloadjson", "", "A JSON file containing multi download options") downloadCmd.Flags().BoolP("thumbnail", "t", false, "(default false) pass this option to download only the thumbnail") - downloadCmd.Flags().Int64P("startblock", "s", 1, + downloadCmd.Flags().Int64P("startblock", "s", 0, "Pass this option to download from specific block number. It should not be less than 1") downloadCmd.Flags().Int64P("endblock", "e", 0, "pass this option to download till specific block number") downloadCmd.Flags().IntP("blockspermarker", "b", 10, "pass this option to download multiple blocks per marker") From 82119bfc14a6d31484091909d22fd5896cb00954 Mon Sep 17 00:00:00 2001 From: Hitenjain14 Date: Tue, 27 Feb 2024 01:02:55 +0530 Subject: [PATCH 017/228] allow start block to be 0 --- cmd/download.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/cmd/download.go b/cmd/download.go index 2931e313..9df973ef 100644 --- a/cmd/download.go +++ b/cmd/download.go @@ -69,13 +69,10 @@ var downloadCmd = &cobra.Command{ numBlocks, _ := cmd.Flags().GetInt("blockspermarker") if numBlocks == 0 { - numBlocks = 10 + numBlocks = 100 } startBlock, _ := cmd.Flags().GetInt64("startblock") - if startBlock < 1 { - PrintError("Error: start block should not be less than 1") - } endBlock, _ := cmd.Flags().GetInt64("endblock") sdk.SetNumBlockDownloads(numBlocks) From 87deb226c2c19c93c836576184d433191a1e239c Mon Sep 17 00:00:00 2001 From: Hitenjain14 Date: Tue, 27 Feb 2024 01:30:17 +0530 Subject: [PATCH 018/228] fix download check --- cmd/download.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/cmd/download.go b/cmd/download.go index 9df973ef..d404f2f8 100644 --- a/cmd/download.go +++ b/cmd/download.go @@ -73,6 +73,9 @@ var downloadCmd = &cobra.Command{ } startBlock, _ := cmd.Flags().GetInt64("startblock") + if startBlock < 1 { + PrintError("Error: start block should not be less than 1") + } endBlock, _ := cmd.Flags().GetInt64("endblock") sdk.SetNumBlockDownloads(numBlocks) @@ -152,11 +155,11 @@ var downloadCmd = &cobra.Command{ if thumbnail { errE = allocationObj.DownloadThumbnail(localPath, remotePath, verifyDownload, statusBar, true) } else { - if startBlock != 0 || endBlock != 0 { - errE = allocationObj.DownloadFileByBlock(localPath, remotePath, startBlock, endBlock, numBlocks, verifyDownload, statusBar, true) - } else { + if startBlock == 1 && endBlock == 0 { ds := sdk.CreateFsDownloadProgress() errE = allocationObj.DownloadFile(localPath, remotePath, verifyDownload, statusBar, true, sdk.WithDownloadProgressStorer(ds), sdk.WithWorkDir(util.GetHomeDir())) + } else { + errE = allocationObj.DownloadFileByBlock(localPath, remotePath, startBlock, endBlock, numBlocks, verifyDownload, statusBar, true) } } } else if len(multidownloadJSON) > 0 { @@ -239,7 +242,7 @@ func init() { downloadCmd.PersistentFlags().String("multidownloadjson", "", "A JSON file containing multi download options") downloadCmd.Flags().BoolP("thumbnail", "t", false, "(default false) pass this option to download only the thumbnail") - downloadCmd.Flags().Int64P("startblock", "s", 0, + downloadCmd.Flags().Int64P("startblock", "s", 1, "Pass this option to download from specific block number. It should not be less than 1") downloadCmd.Flags().Int64P("endblock", "e", 0, "pass this option to download till specific block number") downloadCmd.Flags().IntP("blockspermarker", "b", 10, "pass this option to download multiple blocks per marker") From 02b04dd24f85ebc8b9e5848f53f0031fdad15d64 Mon Sep 17 00:00:00 2001 From: storybehind Date: Sat, 2 Mar 2024 09:58:40 +0530 Subject: [PATCH 019/228] reset blobber stats command --- cmd/storage.go | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/cmd/storage.go b/cmd/storage.go index 4d1794d4..985db8b1 100644 --- a/cmd/storage.go +++ b/cmd/storage.go @@ -296,11 +296,81 @@ var blobberUpdateCmd = &cobra.Command{ }, } +var resetBlobberStatsCmd = &cobra.Command{ + Use: "reset-blobber-stats", + Short: "", + Long: ``, + Args: cobra.MinimumNArgs(0), + Run: func(cmd *cobra.Command, args []string) { + var ( + flags = cmd.Flags() + + blobberID string + prevAllocated int64 + prevSavedData int64 + newAllocated int64 + newSavedData int64 + err error + ) + + if !flags.Changed("blobber_id") { + log.Fatal("missing required 'blobber_id' flag") + } + if blobberID, err = flags.GetString("blobber_id"); err != nil { + log.Fatal("error in 'blobber_id' flag: ", err) + } + + if !flags.Changed("prev_allocated") { + log.Fatal("missing required 'prev_allocated' flag") + } + if prevAllocated, err = flags.GetInt64("prev_allocated"); err != nil { + log.Fatal("error in 'prev_allocated' flag: ", err) + } + + if !flags.Changed("prev_saved_data") { + log.Fatal("missing required 'prev_saved_data' flag") + } + if prevSavedData, err = flags.GetInt64("prev_saved_data"); err != nil { + log.Fatal("error in 'prev_saved_data' flag: ", err) + } + + if !flags.Changed("new_allocated") { + log.Fatal("missing required 'new_allocated' flag") + } + if newAllocated, err = flags.GetInt64("new_allocated"); err != nil { + log.Fatal("error in 'new_allocated' flag: ", err) + } + + if !flags.Changed("new_saved_data") { + log.Fatal("missing required 'new_saved_data' flag") + } + if newSavedData, err = flags.GetInt64("new_saved_data"); err != nil { + log.Fatal("error in 'new_saved_data' flag: ", err) + } + + resetBlobberStatsDto := &sdk.ResetBlobberStatsDto { + BlobberID: blobberID, + PrevAllocated: prevAllocated, + PrevSavedData: prevSavedData, + NewAllocated: newAllocated, + NewSavedData: newSavedData, + } + log.Println(*resetBlobberStatsDto) + + _, _, err = sdk.ResetBlobberStats(resetBlobberStatsDto) + if err != nil { + log.Fatal(err) + } + fmt.Println("reset blobber stats successfully") + }, +} + func init() { rootCmd.AddCommand(scConfig) rootCmd.AddCommand(lsBlobers) rootCmd.AddCommand(blobberInfoCmd) rootCmd.AddCommand(blobberUpdateCmd) + rootCmd.AddCommand(resetBlobberStatsCmd) scConfig.Flags().Bool("json", false, "(default false) pass this option to print response as json data") lsBlobers.Flags().Bool("json", false, "(default false) pass this option to print response as json data") @@ -324,4 +394,15 @@ func init() { buf.Bool("not_available", true, "(default false) set blobber's availability for new allocations") buf.String("url", "", "update the url of the blobber, optional") blobberUpdateCmd.MarkFlagRequired("blobber_id") + + resetBlobberStatsCmd.Flags().String("blobber_id", "", "blobber_id is required") + resetBlobberStatsCmd.Flags().Int64("prev_allocated", 0, "prev_allocated is required") + resetBlobberStatsCmd.Flags().Int64("prev_saved_data", 0, "prev_saved_data is required") + resetBlobberStatsCmd.Flags().Int64("new_allocated", 0, "new_allocated is required") + resetBlobberStatsCmd.Flags().Int64("new_saved_data", 0, "new_saved_data is required") + resetBlobberStatsCmd.MarkFlagRequired("blobber_id") + resetBlobberStatsCmd.MarkFlagRequired("prev_allocated") + resetBlobberStatsCmd.MarkFlagRequired("prev_saved_data") + resetBlobberStatsCmd.MarkFlagRequired("new_allocated") + resetBlobberStatsCmd.MarkFlagRequired("new_saved_data") } From ad721aaf56898168c7d1f7de9bead11727c8a676 Mon Sep 17 00:00:00 2001 From: storybehind Date: Tue, 5 Mar 2024 22:32:44 +0530 Subject: [PATCH 020/228] provide command description --- cmd/storage.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/storage.go b/cmd/storage.go index 985db8b1..2f398907 100644 --- a/cmd/storage.go +++ b/cmd/storage.go @@ -298,8 +298,8 @@ var blobberUpdateCmd = &cobra.Command{ var resetBlobberStatsCmd = &cobra.Command{ Use: "reset-blobber-stats", - Short: "", - Long: ``, + Short: "Reset blobber stats", + Long: `Reset blobber stats`, Args: cobra.MinimumNArgs(0), Run: func(cmd *cobra.Command, args []string) { var ( @@ -355,7 +355,7 @@ var resetBlobberStatsCmd = &cobra.Command{ NewAllocated: newAllocated, NewSavedData: newSavedData, } - log.Println(*resetBlobberStatsDto) + fmt.Println(*resetBlobberStatsDto) _, _, err = sdk.ResetBlobberStats(resetBlobberStatsDto) if err != nil { From 6465980c1dd2eed8dc62beb4cc680d75c690fbd1 Mon Sep 17 00:00:00 2001 From: Jayash Satolia Date: Sun, 10 Mar 2024 16:54:29 +0530 Subject: [PATCH 021/228] Updated gosdk to 1.13.0 --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index a1f85f23..82ad5807 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.12.2-0.20240224212924-e46cfb60cb14 + github.com/0chain/gosdk v1.13.0 github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 @@ -32,7 +32,7 @@ require ( github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/herumi/bls-go-binary v1.31.0 // indirect - github.com/hitenjain14/fasthttp v0.0.0-20240223160417-7458814cf3d0 // indirect + github.com/hitenjain14/fasthttp v0.0.0-20240229173600-722723e15e17 // indirect github.com/inconshreveable/mousetrap v1.0.1 // indirect github.com/klauspost/compress v1.17.0 // indirect github.com/klauspost/cpuid/v2 v2.2.4 // indirect diff --git a/go.sum b/go.sum index 979cdb1b..72183131 100644 --- a/go.sum +++ b/go.sum @@ -40,8 +40,8 @@ github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565 h1:z+DtCR8mBsjPnEs github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565/go.mod h1:UyDC8Qyl5z9lGkCnf9RHJPMektnFX8XtCJZHXCCVj8E= 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.12.2-0.20240224212924-e46cfb60cb14 h1:zzu2SSp4o5FX3pdscbU434ZhsSYn98OaWSV72kZxONA= -github.com/0chain/gosdk v1.12.2-0.20240224212924-e46cfb60cb14/go.mod h1:UhPOdN/1HKqEjVPNS8Zph1Kl4NpWsBmQnqlh9NRsVDY= +github.com/0chain/gosdk v1.13.0 h1:1jNfnuv5+e2qNJq+cQjuI4ZDQXwr04z7lpAJ/uyb0Ek= +github.com/0chain/gosdk v1.13.0/go.mod h1:RRBLJvF1FsPkG95D+8UxeasgpFxnLO5s7QV2svXg69E= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= @@ -201,8 +201,8 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/herumi/bls-go-binary v1.31.0 h1:L1goQ2tMtGgpXCg5AwHAdJQpLs/pfnWWEc3Wog6OhmI= github.com/herumi/bls-go-binary v1.31.0/go.mod h1:O4Vp1AfR4raRGwFeQpr9X/PQtncEicMoOe6BQt1oX0Y= -github.com/hitenjain14/fasthttp v0.0.0-20240223160417-7458814cf3d0 h1:XCrNCir8+zDo+Ku7B+AXhzFnsJvSelx1YbQQTNpxtqI= -github.com/hitenjain14/fasthttp v0.0.0-20240223160417-7458814cf3d0/go.mod h1:RZMcXy7u4S+E97IXYTe7WHZ3+mCYOh4vys8PkIGZeXk= +github.com/hitenjain14/fasthttp v0.0.0-20240229173600-722723e15e17 h1:FbyIK0BfvXVZTOxKOe2dlxJqSPSF2ZXOv2Mc7dvS7sc= +github.com/hitenjain14/fasthttp v0.0.0-20240229173600-722723e15e17/go.mod h1:RZMcXy7u4S+E97IXYTe7WHZ3+mCYOh4vys8PkIGZeXk= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= github.com/holiman/uint256 v1.2.2-0.20230321075855-87b91420868c h1:DZfsyhDK1hnSS5lH8l+JggqzEleHteTYfutAiVlSUM8= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= From 3ebdc78933f517d70c2f6b962cd9f835adeba874 Mon Sep 17 00:00:00 2001 From: Jayash Satolia Date: Tue, 12 Mar 2024 02:01:13 +0530 Subject: [PATCH 022/228] Fix new allocation request --- cmd/storage.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/storage.go b/cmd/storage.go index 0309fa13..658a7d04 100644 --- a/cmd/storage.go +++ b/cmd/storage.go @@ -287,7 +287,7 @@ var blobberUpdateCmd = &cobra.Command{ if ia, err = flags.GetBool("is_restricted"); err != nil { log.Fatal(err) } - updateBlobber.NotAvailable = &ia + updateBlobber.IsRestricted = &ia } if termsChanged { From 0253f228eaa5e082e5d615ae26ba2a0ce0f54749 Mon Sep 17 00:00:00 2001 From: Jayash Satolia Date: Thu, 21 Mar 2024 00:47:42 +0530 Subject: [PATCH 023/228] Add blobber auth tickets --- cmd/newallocation.go | 8 ++++---- cmd/updateallocation.go | 9 ++++++++- go.mod | 9 +++++++-- go.sum | 18 ++++++++++++++---- 4 files changed, 33 insertions(+), 11 deletions(-) diff --git a/cmd/newallocation.go b/cmd/newallocation.go index 8135f315..bee9ec62 100755 --- a/cmd/newallocation.go +++ b/cmd/newallocation.go @@ -242,12 +242,12 @@ var newallocationCmd = &cobra.Command{ ParityShards: *parityshards, Size: *size, ReadPrice: sdk.PriceRange{ - Min: uint64(readPrice.Min), - Max: uint64(readPrice.Max), + Min: readPrice.Min, + Max: readPrice.Max, }, WritePrice: sdk.PriceRange{ - Min: uint64(writePrice.Min), - Max: uint64(writePrice.Max), + Min: writePrice.Min, + Max: writePrice.Max, }, Lock: uint64(lock), BlobberIds: preferred_blobbers, diff --git a/cmd/updateallocation.go b/cmd/updateallocation.go index 1e777acc..af49b350 100755 --- a/cmd/updateallocation.go +++ b/cmd/updateallocation.go @@ -26,12 +26,15 @@ var updateAllocationCmd = &cobra.Command{ log.Fatal("invalid 'allocation_id' flag: ", err) } - var addBlobberId, removeBlobberId string + var addBlobberId, addBlobberAuthTicket, removeBlobberId string if flags.Changed("add_blobber") { addBlobberId, err = flags.GetString("add_blobber") if err != nil { log.Fatal("invalid 'add_blobber' flag: ", err) } + + addBlobberAuthTicket, _ = flags.GetString("add_blobber_auth_ticket") + if flags.Changed("remove_blobber") { removeBlobberId, err = flags.GetString("remove_blobber") if err != nil { @@ -130,6 +133,7 @@ var updateAllocationCmd = &cobra.Command{ extend, lock, addBlobberId, + addBlobberAuthTicket, removeBlobberId, setThirdPartyExtendable, &fileOptionParams, @@ -151,6 +155,7 @@ var updateAllocationCmd = &cobra.Command{ allocID, lock, addBlobberId, + addBlobberAuthTicket, removeBlobberId, setThirdPartyExtendable, &fileOptionParams, @@ -169,6 +174,8 @@ func init() { "Allocation ID") updateAllocationCmd.PersistentFlags().String("add_blobber", "", "ID of blobber to add to the allocation") + updateAllocationCmd.PersistentFlags().String("add_blobber_auth_ticket", "", + "Auth ticket of blobber to add to the allocation") updateAllocationCmd.PersistentFlags().String("remove_blobber", "", "ID of blobber to remove from the allocation") updateAllocationCmd.PersistentFlags().Float64("lock", 0.0, diff --git a/go.mod b/go.mod index 2115ab6a..6ef2c593 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.12.4-0.20240217212211-749cdb7aa996 + github.com/0chain/gosdk v1.13.4-0.20240320185656-d8229fb1926a github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 @@ -15,6 +15,7 @@ require ( require ( github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565 // 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 github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect github.com/btcsuite/btcd/btcutil v1.1.3 // indirect @@ -31,7 +32,9 @@ require ( github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/herumi/bls-go-binary v1.31.0 // indirect + github.com/hitenjain14/fasthttp v0.0.0-20240229173600-722723e15e17 // indirect github.com/inconshreveable/mousetrap v1.0.1 // indirect + github.com/klauspost/compress v1.17.0 // indirect github.com/klauspost/cpuid/v2 v2.2.4 // indirect github.com/klauspost/reedsolomon v1.11.8 // indirect github.com/lithammer/shortuuid/v3 v3.0.7 // indirect @@ -57,13 +60,15 @@ require ( github.com/tklauser/go-sysconf v0.3.11 // indirect github.com/tklauser/numcpus v0.6.0 // indirect github.com/tyler-smith/go-bip39 v1.1.0 // indirect + github.com/valyala/bytebufferpool v1.0.0 // indirect + github.com/valyala/fasthttp v1.51.0 // indirect github.com/yusufpapurcu/wmi v1.2.2 // indirect go.dedis.ch/fixbuf v1.0.3 // indirect go.dedis.ch/kyber/v3 v3.1.0 // indirect go.uber.org/atomic v1.10.0 // indirect go.uber.org/multierr v1.9.0 // indirect go.uber.org/zap v1.24.0 // indirect - golang.org/x/crypto v0.16.0 // indirect + golang.org/x/crypto v0.17.0 // indirect golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect diff --git a/go.sum b/go.sum index 167b52b4..b727e512 100644 --- a/go.sum +++ b/go.sum @@ -40,14 +40,16 @@ github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565 h1:z+DtCR8mBsjPnEs github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565/go.mod h1:UyDC8Qyl5z9lGkCnf9RHJPMektnFX8XtCJZHXCCVj8E= 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.12.4-0.20240217212211-749cdb7aa996 h1:146ZuXAHQHGOGs05QvAO0SGGcsrP6Xj0Sw4bSu/OlxU= -github.com/0chain/gosdk v1.12.4-0.20240217212211-749cdb7aa996/go.mod h1:ew7kU2Cf1Y/CzoxMqtnmflD1CuSPaOI5TukoXA26Sz4= +github.com/0chain/gosdk v1.13.4-0.20240320185656-d8229fb1926a h1:hGMX0hTEsT3w6I9GAB/wqfUNju1L5K3nPbKGU34v0w0= +github.com/0chain/gosdk v1.13.4-0.20240320185656-d8229fb1926a/go.mod h1:NY7xhPwLShj/OvbiLst2fnLEwR0Zv76gzMBBYDZ43Ps= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= github.com/Luzifer/go-openssl/v3 v3.1.0/go.mod h1:liy3FXuuS8hfDlYh1T+l78AwQ/NjZflJz0NDvjKhwDs= github.com/VictoriaMetrics/fastcache v1.6.0 h1:C/3Oi3EiBCqufydp1neRZkqcwmEiuRT9c3fqvvgKm5o= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= +github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs= +github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= @@ -199,6 +201,8 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/herumi/bls-go-binary v1.31.0 h1:L1goQ2tMtGgpXCg5AwHAdJQpLs/pfnWWEc3Wog6OhmI= github.com/herumi/bls-go-binary v1.31.0/go.mod h1:O4Vp1AfR4raRGwFeQpr9X/PQtncEicMoOe6BQt1oX0Y= +github.com/hitenjain14/fasthttp v0.0.0-20240229173600-722723e15e17 h1:FbyIK0BfvXVZTOxKOe2dlxJqSPSF2ZXOv2Mc7dvS7sc= +github.com/hitenjain14/fasthttp v0.0.0-20240229173600-722723e15e17/go.mod h1:RZMcXy7u4S+E97IXYTe7WHZ3+mCYOh4vys8PkIGZeXk= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= github.com/holiman/uint256 v1.2.2-0.20230321075855-87b91420868c h1:DZfsyhDK1hnSS5lH8l+JggqzEleHteTYfutAiVlSUM8= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= @@ -219,6 +223,8 @@ github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1 github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= +github.com/klauspost/compress v1.17.0 h1:Rnbp4K9EjcDuVuHtd0dgA4qNuv9yKDYKK1ulpJwgrqM= +github.com/klauspost/compress v1.17.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/klauspost/cpuid/v2 v2.2.4 h1:acbojRNwl3o09bUq+yDCtZFc1aiwaAAxtcn8YkZXnvk= github.com/klauspost/cpuid/v2 v2.2.4/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= github.com/klauspost/reedsolomon v1.11.8 h1:s8RpUW5TK4hjr+djiOpbZJB4ksx+TdYbRH7vHQpwPOY= @@ -326,6 +332,10 @@ github.com/tklauser/numcpus v0.6.0/go.mod h1:FEZLMke0lhOUG6w2JadTzp0a+Nl8PF/GFkQ github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8= github.com/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3CWg+kkNaLt55U= github.com/urfave/cli/v2 v2.17.2-0.20221006022127-8f469abc00aa h1:5SqCsI/2Qya2bCzK15ozrqo2sZxkh0FHynJZOTVoV6Q= +github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= +github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= +github.com/valyala/fasthttp v1.51.0 h1:8b30A5JlZ6C7AS81RsWjYMQmrZG6feChmgAolCl1SqA= +github.com/valyala/fasthttp v1.51.0/go.mod h1:oI2XroL+lI7vdXyYoQk03bXBThfFl2cVdIA3Xl7cH8g= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -368,8 +378,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY= -golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= +golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= From 1870e5c42ec2c2dff2905aea691e56d2f6bc3d23 Mon Sep 17 00:00:00 2001 From: storybehind Date: Sat, 30 Mar 2024 13:28:11 +0530 Subject: [PATCH 024/228] list stakable blobbers and validators --- cmd/storage.go | 8 ++++++-- cmd/validator.go | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/cmd/storage.go b/cmd/storage.go index 4d1794d4..d58de4d8 100644 --- a/cmd/storage.go +++ b/cmd/storage.go @@ -66,13 +66,16 @@ var lsBlobers = &cobra.Command{ Run: func(cmd *cobra.Command, args []string) { doJSON, _ := cmd.Flags().GetBool("json") doAll, _ := cmd.Flags().GetBool("all") - + isStakable, err := cmd.Flags().GetBool("stakable") + if err != nil { + log.Fatalf("err parsing in stakable flag: %v", err) + } // set is_active=true to get only active blobbers isActive := true if doAll { isActive = false } - var list, err = sdk.GetBlobbers(isActive) + list, err := sdk.GetBlobbers(isActive, isStakable) if err != nil { log.Fatalf("Failed to get storage SC configurations: %v", err) } @@ -305,6 +308,7 @@ func init() { scConfig.Flags().Bool("json", false, "(default false) pass this option to print response as json data") lsBlobers.Flags().Bool("json", false, "(default false) pass this option to print response as json data") lsBlobers.Flags().Bool("all", false, "(default false) shows active and non active list of blobbers on ls-blobbers") + lsBlobers.Flags().Bool("stakable", false, "(default false) gets only stakable list of blobbers if set to true") blobberInfoCmd.Flags().String("blobber_id", "", "blobber ID, required") blobberInfoCmd.Flags().Bool("json", false, diff --git a/cmd/validator.go b/cmd/validator.go index 958eb4da..0d4607e4 100644 --- a/cmd/validator.go +++ b/cmd/validator.go @@ -40,9 +40,12 @@ var lsValidators = &cobra.Command{ Args: cobra.MinimumNArgs(0), Run: func(cmd *cobra.Command, args []string) { doJSON, _ := cmd.Flags().GetBool("json") + stakable, err := cmd.Flags().GetBool("stakable") + if err != nil { + log.Fatalf("error parsing stakable flag: %v", err) + } - var list, err = sdk.GetValidators() - + list, err := sdk.GetValidators(stakable) if err != nil { log.Fatalf("Failed to get storage SC configurations: %v", err) } @@ -193,4 +196,5 @@ func init() { validatorUpdateCmd.MarkFlagRequired("validator_id") lsValidators.Flags().Bool("json", false, "(default false) pass this flag to get response as json object") + lsValidators.Flags().Bool("stakable", false, "(default false) Gets only validators that can be staked if set to true") } From 911c7dbc1fd0e367029b7c75798d4ae52712652d Mon Sep 17 00:00:00 2001 From: Hitenjain14 Date: Sun, 31 Mar 2024 21:36:08 +0530 Subject: [PATCH 025/228] update gosdk --- go.mod | 6 +++--- go.sum | 43 ++++++++++++++++++++++++++++++++++++++----- 2 files changed, 41 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index 82ad5807..b12f9f71 100644 --- a/go.mod +++ b/go.mod @@ -1,10 +1,10 @@ module github.com/0chain/zboxcli -go 1.20 +go 1.21 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.13.0 + github.com/0chain/gosdk v1.13.7 github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 @@ -28,7 +28,7 @@ require ( github.com/go-stack/stack v1.8.1 // indirect github.com/google/uuid v1.3.0 // indirect github.com/gorilla/websocket v1.5.0 // indirect - github.com/h2non/filetype v1.1.3 // indirect + github.com/h2non/filetype v1.1.4-0.20231228185113-6469358c2bcb // indirect github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/herumi/bls-go-binary v1.31.0 // indirect diff --git a/go.sum b/go.sum index 72183131..c848c421 100644 --- a/go.sum +++ b/go.sum @@ -40,13 +40,14 @@ github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565 h1:z+DtCR8mBsjPnEs github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565/go.mod h1:UyDC8Qyl5z9lGkCnf9RHJPMektnFX8XtCJZHXCCVj8E= 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.13.0 h1:1jNfnuv5+e2qNJq+cQjuI4ZDQXwr04z7lpAJ/uyb0Ek= -github.com/0chain/gosdk v1.13.0/go.mod h1:RRBLJvF1FsPkG95D+8UxeasgpFxnLO5s7QV2svXg69E= +github.com/0chain/gosdk v1.13.7 h1:VztAP8SJ9QsQhx/HV8/ToFzoK2NKWjdHBJHiWDnoWgY= +github.com/0chain/gosdk v1.13.7/go.mod h1:tgAiVAuIy+Vs1tGfKCPEuuWWARwNQBEw32y950LrqrU= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= github.com/Luzifer/go-openssl/v3 v3.1.0/go.mod h1:liy3FXuuS8hfDlYh1T+l78AwQ/NjZflJz0NDvjKhwDs= github.com/VictoriaMetrics/fastcache v1.6.0 h1:C/3Oi3EiBCqufydp1neRZkqcwmEiuRT9c3fqvvgKm5o= +github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs= github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= @@ -81,6 +82,7 @@ github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46f github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= +github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= @@ -103,6 +105,7 @@ github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 h1:HbphB4TFFXpv7MNrT52FGrrgVXF1 github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0/go.mod h1:DZGJHZMqrU4JJqFAWUS2UO1+lbSKsdiOoYi9Zzey7Fc= github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw= +github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= @@ -112,13 +115,17 @@ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7 github.com/ethereum/go-ethereum v1.10.26 h1:i/7d9RBBwiXCEuyduBQzJw/mKmnvzsN14jqBmytw72s= github.com/ethereum/go-ethereum v1.10.26/go.mod h1:EYFyF19u3ezGLD4RqOkLq+ZCXzYbLoNDdZlMt7kyKFg= github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= +github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlKLDt+S+6hbjVMEW6RGQ7aUf7c= +github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= +github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= +github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -127,6 +134,7 @@ github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiU github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw= github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= github.com/golang-jwt/jwt/v4 v4.3.0 h1:kHL1vqdqWNfATmA0FNMdmZNMyZI1U6O31X4rlIPoBog= +github.com/golang-jwt/jwt/v4 v4.3.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -154,6 +162,7 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk= +github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= @@ -166,6 +175,7 @@ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= @@ -188,11 +198,13 @@ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+ github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= +github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/h2non/filetype v1.1.3 h1:FKkx9QbD7HR/zjK1Ia5XiBsq9zdLi5Kf3zGyFTAFkGg= -github.com/h2non/filetype v1.1.3/go.mod h1:319b3zT68BvV+WRj7cwy856M2ehB3HqNOt6sy1HndBY= +github.com/h2non/filetype v1.1.4-0.20231228185113-6469358c2bcb h1:GlQyMv2C48qmfPItvAXFoyN341Swxp9JNVeUZxnmbJw= +github.com/h2non/filetype v1.1.4-0.20231228185113-6469358c2bcb/go.mod h1:319b3zT68BvV+WRj7cwy856M2ehB3HqNOt6sy1HndBY= github.com/hashicorp/go-bexpr v0.1.10 h1:9kuI5PFotCboP3dkDYFr/wi0gg0QVbSNz5oFRpxn4uE= +github.com/hashicorp/go-bexpr v0.1.10/go.mod h1:oxlubA2vC/gFVfX1A6JGp7ls7uCDlfJn732ehYYg+g0= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d h1:dg1dEPuWpEqDnvIw251EVy4zlP8gWbsGj4BsUKCRpYs= @@ -204,9 +216,12 @@ github.com/herumi/bls-go-binary v1.31.0/go.mod h1:O4Vp1AfR4raRGwFeQpr9X/PQtncEic github.com/hitenjain14/fasthttp v0.0.0-20240229173600-722723e15e17 h1:FbyIK0BfvXVZTOxKOe2dlxJqSPSF2ZXOv2Mc7dvS7sc= github.com/hitenjain14/fasthttp v0.0.0-20240229173600-722723e15e17/go.mod h1:RZMcXy7u4S+E97IXYTe7WHZ3+mCYOh4vys8PkIGZeXk= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= +github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= github.com/holiman/uint256 v1.2.2-0.20230321075855-87b91420868c h1:DZfsyhDK1hnSS5lH8l+JggqzEleHteTYfutAiVlSUM8= +github.com/holiman/uint256 v1.2.2-0.20230321075855-87b91420868c/go.mod h1:SC8Ryt4n+UBbPbIBKaG9zbbDlp4jOru9xFZmPzLUTxw= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huin/goupnp v1.0.3 h1:N8No57ls+MnjlB+JPiCVSOyy/ot7MJTqlo7rn+NYSqQ= +github.com/huin/goupnp v1.0.3/go.mod h1:ZxNlw5WqJj6wSsRK5+YfflQGXYfccj5VgQsMNixHM7Y= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/icza/bitio v1.1.0 h1:ysX4vtldjdi3Ygai5m1cWy4oLkhWTAi+SyO6HC8L9T0= @@ -216,6 +231,7 @@ github.com/icza/mighty v0.0.0-20180919140131-cfd07d671de6/go.mod h1:xQig96I1VNBD github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc= github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= +github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= @@ -232,9 +248,11 @@ github.com/klauspost/reedsolomon v1.11.8/go.mod h1:4bXRN+cVzMdml6ti7qLouuYi32KHJ github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/lithammer/shortuuid/v3 v3.0.7 h1:trX0KTHy4Pbwo/6ia8fscyHoGA+mf1jWbPJVuvyJQQ8= github.com/lithammer/shortuuid/v3 v3.0.7/go.mod h1:vMk8ke37EmiewwolSO1NLW8vP4ZaKlRuDIi8tWWmAts= github.com/machinebox/graphql v0.2.2 h1:dWKpJligYKhYKO5A2gvNhkJdQMNZeChZYyBbrZkBZfo= @@ -242,8 +260,11 @@ github.com/machinebox/graphql v0.2.2/go.mod h1:F+kbVMHuwrQ5tYgU9JXlnskM8nOaFxCAE github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/matryer/is v1.4.1 h1:55ehd8zaGABKLXQUe2awZ99BD/PTc2ls+KV/dXphgEQ= +github.com/matryer/is v1.4.1/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng= +github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= @@ -254,6 +275,7 @@ github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrk github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A= +github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= @@ -278,15 +300,19 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/tsdb v0.7.1 h1:YZcsG11NqnK4czYLrWd9mpEuAJIHVQLwdrleYfszMAA= +github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/remeh/sizedwaitgroup v1.0.0 h1:VNGGFwNo/R5+MJBf6yrsr110p0m4/OX4S3DCy7Kyl5E= github.com/remeh/sizedwaitgroup v1.0.0/go.mod h1:3j2R4OIe/SeS6YDhICBy22RWjJC5eNCJ1V+9+NVNYlo= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.3 h1:utMvzDsuh3suAEnhH0RdHmoPbU648o6CvXxTx4SBMOw= github.com/rivo/uniseg v0.4.3/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rjeczalik/notify v0.9.1 h1:CLCKso/QK1snAlnhNR/CNvNiFU2saUtjV0bx3EwNeCE= +github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= +github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= +github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI= @@ -306,6 +332,7 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An github.com/spf13/viper v1.15.0 h1:js3yy885G8xwJa6iOISGFwd+qlUo5AvyXb7CiihdtiU= github.com/spf13/viper v1.15.0/go.mod h1:fFcTBJxvhhzSJiZy8n+PeW6t8l+KeT/uTARa0jHOQLA= github.com/status-im/keycard-go v0.2.0 h1:QDLFswOQu1r5jsycloeQh3bVU8n/NatHHaZobtDnDzA= +github.com/status-im/keycard-go v0.2.0/go.mod h1:wlp8ZLbsmrF6g6WjugPAx+IzoLrkdf9+mHxBEeo3Hbg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= @@ -317,8 +344,9 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8= github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= @@ -332,11 +360,13 @@ github.com/tklauser/numcpus v0.6.0/go.mod h1:FEZLMke0lhOUG6w2JadTzp0a+Nl8PF/GFkQ github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8= github.com/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3CWg+kkNaLt55U= github.com/urfave/cli/v2 v2.17.2-0.20221006022127-8f469abc00aa h1:5SqCsI/2Qya2bCzK15ozrqo2sZxkh0FHynJZOTVoV6Q= +github.com/urfave/cli/v2 v2.17.2-0.20221006022127-8f469abc00aa/go.mod h1:1CNUng3PtjQMtRzJO4FMXBQvkGtuYRxxiR9xMa7jMwI= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasthttp v1.51.0 h1:8b30A5JlZ6C7AS81RsWjYMQmrZG6feChmgAolCl1SqA= github.com/valyala/fasthttp v1.51.0/go.mod h1:oI2XroL+lI7vdXyYoQk03bXBThfFl2cVdIA3Xl7cH8g= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= +github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -363,6 +393,7 @@ go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI= +go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= @@ -529,6 +560,7 @@ golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxb golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= +golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= @@ -674,6 +706,7 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/cheggaaa/pb.v1 v1.0.28 h1:n1tBJnnK2r7g9OW2btFH91V92STTUevLXYFb8gy9EMk= gopkg.in/cheggaaa/pb.v1 v1.0.28/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= From acee9b88ecc32dae390674de9c1cf1809119ed64 Mon Sep 17 00:00:00 2001 From: shahnawaz-creator <117025384+shahnawaz-creator@users.noreply.github.com> Date: Tue, 2 Apr 2024 13:22:51 +0530 Subject: [PATCH 026/228] updated go version to 1.21 (#608) * updated go version to 1.21 * Debug go build * Use action@update-go - testing * Change actions back to master --------- Co-authored-by: peterlimg --- .github/workflows/build-zbox.yaml | 12 ++++++------ .github/workflows/gosdk.yml | 6 +++--- .github/workflows/tests.yml | 12 ++++++------ Makefile | 2 ++ 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build-zbox.yaml b/.github/workflows/build-zbox.yaml index efa4e476..794bf13c 100644 --- a/.github/workflows/build-zbox.yaml +++ b/.github/workflows/build-zbox.yaml @@ -28,10 +28,10 @@ jobs: echo "GOPATH=$HOME/go" >> $GITHUB_ENV echo "GOCACHE=$GITHUB_WORKSPACE/.gocache" >> $GITHUB_ENV - - name: Setup go 1.20 - uses: actions/setup-go@v3 + - name: Setup go 1.21 + uses: actions/setup-go@v5 with: - go-version: '1.20' + go-version: '1.21' - name: Install run: | @@ -109,10 +109,10 @@ jobs: runs-on: macos-runner steps: - - name: Setup go 1.20 - uses: actions/setup-go@v2 + - name: Setup go 1.21 + uses: actions/setup-go@v5 with: - go-version: '1.20' # The Go version to download (if necessary) and use. + go-version: '1.21' - name: Checkout uses: actions/checkout@v2 diff --git a/.github/workflows/gosdk.yml b/.github/workflows/gosdk.yml index f6d34867..45403195 100644 --- a/.github/workflows/gosdk.yml +++ b/.github/workflows/gosdk.yml @@ -15,10 +15,10 @@ jobs: create-pr: runs-on: [self-hosted, build] steps: - - name: Setup go 1.20 - uses: actions/setup-go@v2 + - name: Setup go 1.21 + uses: actions/setup-go@v5 with: - go-version: '1.20' + go-version: '1.21' - name: Checkout uses: actions/checkout@v1 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 08c7b899..85c66bf8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,10 +13,10 @@ jobs: unit-test: runs-on: [self-hosted, build] steps: - - name: Setup go 1.20 - uses: actions/setup-go@v2 + - name: Setup go 1.21 + uses: actions/setup-go@v5 with: - go-version: '1.20' + go-version: '1.21' - name: Clone Zbox uses: actions/checkout@v2 @@ -34,10 +34,10 @@ jobs: runs-on: [self-hosted, build] needs: unit-test steps: - - name: Setup go 1.20 - uses: actions/setup-go@v2 + - name: Setup go 1.21 + uses: actions/setup-go@v5 with: - go-version: '1.20' + go-version: '1.21' - name: Clone 0Box uses: actions/checkout@v2 diff --git a/Makefile b/Makefile index 0f137aa5..d483d5d6 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,8 @@ default: help #GO BUILD SDK gomod-download: + go env + cat go.mod go mod download go mod tidy From 621fbdebf466f1c204b5676031d1bfe9c1c455d9 Mon Sep 17 00:00:00 2001 From: peterlimg <54137706+peterlimg@users.noreply.github.com> Date: Tue, 2 Apr 2024 20:32:36 +1100 Subject: [PATCH 027/228] updated go version to 1.21 (#608) (#610) * updated go version to 1.21 * Debug go build * Use action@update-go - testing * Change actions back to master --------- Co-authored-by: shahnawaz-creator <117025384+shahnawaz-creator@users.noreply.github.com> --- .github/workflows/build-zbox.yaml | 12 ++++++------ .github/workflows/gosdk.yml | 6 +++--- .github/workflows/tests.yml | 12 ++++++------ Makefile | 2 ++ 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build-zbox.yaml b/.github/workflows/build-zbox.yaml index efa4e476..794bf13c 100644 --- a/.github/workflows/build-zbox.yaml +++ b/.github/workflows/build-zbox.yaml @@ -28,10 +28,10 @@ jobs: echo "GOPATH=$HOME/go" >> $GITHUB_ENV echo "GOCACHE=$GITHUB_WORKSPACE/.gocache" >> $GITHUB_ENV - - name: Setup go 1.20 - uses: actions/setup-go@v3 + - name: Setup go 1.21 + uses: actions/setup-go@v5 with: - go-version: '1.20' + go-version: '1.21' - name: Install run: | @@ -109,10 +109,10 @@ jobs: runs-on: macos-runner steps: - - name: Setup go 1.20 - uses: actions/setup-go@v2 + - name: Setup go 1.21 + uses: actions/setup-go@v5 with: - go-version: '1.20' # The Go version to download (if necessary) and use. + go-version: '1.21' - name: Checkout uses: actions/checkout@v2 diff --git a/.github/workflows/gosdk.yml b/.github/workflows/gosdk.yml index f6d34867..45403195 100644 --- a/.github/workflows/gosdk.yml +++ b/.github/workflows/gosdk.yml @@ -15,10 +15,10 @@ jobs: create-pr: runs-on: [self-hosted, build] steps: - - name: Setup go 1.20 - uses: actions/setup-go@v2 + - name: Setup go 1.21 + uses: actions/setup-go@v5 with: - go-version: '1.20' + go-version: '1.21' - name: Checkout uses: actions/checkout@v1 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 08c7b899..85c66bf8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,10 +13,10 @@ jobs: unit-test: runs-on: [self-hosted, build] steps: - - name: Setup go 1.20 - uses: actions/setup-go@v2 + - name: Setup go 1.21 + uses: actions/setup-go@v5 with: - go-version: '1.20' + go-version: '1.21' - name: Clone Zbox uses: actions/checkout@v2 @@ -34,10 +34,10 @@ jobs: runs-on: [self-hosted, build] needs: unit-test steps: - - name: Setup go 1.20 - uses: actions/setup-go@v2 + - name: Setup go 1.21 + uses: actions/setup-go@v5 with: - go-version: '1.20' + go-version: '1.21' - name: Clone 0Box uses: actions/checkout@v2 diff --git a/Makefile b/Makefile index 0f137aa5..d483d5d6 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,8 @@ default: help #GO BUILD SDK gomod-download: + go env + cat go.mod go mod download go mod tidy From 75f155f8d534ba4446a926fcc7022605ecbb21d4 Mon Sep 17 00:00:00 2001 From: Jayash Satolia Date: Mon, 8 Apr 2024 01:20:53 +0530 Subject: [PATCH 028/228] Updated gosdk --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index b12f9f71..9d571a62 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.13.7 + github.com/0chain/gosdk v1.13.4-0.20240407191237-9a015a0f33cc github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 diff --git a/go.sum b/go.sum index c848c421..89840ffc 100644 --- a/go.sum +++ b/go.sum @@ -40,8 +40,8 @@ github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565 h1:z+DtCR8mBsjPnEs github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565/go.mod h1:UyDC8Qyl5z9lGkCnf9RHJPMektnFX8XtCJZHXCCVj8E= 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.13.7 h1:VztAP8SJ9QsQhx/HV8/ToFzoK2NKWjdHBJHiWDnoWgY= -github.com/0chain/gosdk v1.13.7/go.mod h1:tgAiVAuIy+Vs1tGfKCPEuuWWARwNQBEw32y950LrqrU= +github.com/0chain/gosdk v1.13.4-0.20240407191237-9a015a0f33cc h1:XRzNCb6LZWwHRa+JSpfO5UTfgzGcemm39SBsqtJZXGk= +github.com/0chain/gosdk v1.13.4-0.20240407191237-9a015a0f33cc/go.mod h1:P8ha0wz3B43sDKD0AxqFDI8EyqLghcvY8g29xFJrBsg= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= From 0b1dea1bd2c94232d3ca999896fcfe9a30975312 Mon Sep 17 00:00:00 2001 From: Jayash Satolia Date: Mon, 8 Apr 2024 21:41:16 +0530 Subject: [PATCH 029/228] Fix new allocation request --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 9d571a62..12100b4d 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.13.4-0.20240407191237-9a015a0f33cc + github.com/0chain/gosdk v1.13.4-0.20240408160516-bfcfff83751e github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 diff --git a/go.sum b/go.sum index 89840ffc..f990a044 100644 --- a/go.sum +++ b/go.sum @@ -40,8 +40,8 @@ github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565 h1:z+DtCR8mBsjPnEs github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565/go.mod h1:UyDC8Qyl5z9lGkCnf9RHJPMektnFX8XtCJZHXCCVj8E= 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.13.4-0.20240407191237-9a015a0f33cc h1:XRzNCb6LZWwHRa+JSpfO5UTfgzGcemm39SBsqtJZXGk= -github.com/0chain/gosdk v1.13.4-0.20240407191237-9a015a0f33cc/go.mod h1:P8ha0wz3B43sDKD0AxqFDI8EyqLghcvY8g29xFJrBsg= +github.com/0chain/gosdk v1.13.4-0.20240408160516-bfcfff83751e h1:E83m6GOdrP/mX+IDhlchIGdGyYinjSWGX4WkGN/+Xv0= +github.com/0chain/gosdk v1.13.4-0.20240408160516-bfcfff83751e/go.mod h1:P8ha0wz3B43sDKD0AxqFDI8EyqLghcvY8g29xFJrBsg= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= From 700e8c5ca1922de51869460e7b8bfb7fdd7520d6 Mon Sep 17 00:00:00 2001 From: Jayash Satolia Date: Tue, 9 Apr 2024 01:20:20 +0530 Subject: [PATCH 030/228] Updated gosdk --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 12100b4d..7d35627d 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.13.4-0.20240408160516-bfcfff83751e + github.com/0chain/gosdk v1.13.4-0.20240408194813-7e52ce831b19 github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 diff --git a/go.sum b/go.sum index f990a044..8005208f 100644 --- a/go.sum +++ b/go.sum @@ -40,8 +40,8 @@ github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565 h1:z+DtCR8mBsjPnEs github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565/go.mod h1:UyDC8Qyl5z9lGkCnf9RHJPMektnFX8XtCJZHXCCVj8E= 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.13.4-0.20240408160516-bfcfff83751e h1:E83m6GOdrP/mX+IDhlchIGdGyYinjSWGX4WkGN/+Xv0= -github.com/0chain/gosdk v1.13.4-0.20240408160516-bfcfff83751e/go.mod h1:P8ha0wz3B43sDKD0AxqFDI8EyqLghcvY8g29xFJrBsg= +github.com/0chain/gosdk v1.13.4-0.20240408194813-7e52ce831b19 h1:wq+GLgytz0tP/R+caNN1dZs8cdHUNwxiMlQG+SwJXrY= +github.com/0chain/gosdk v1.13.4-0.20240408194813-7e52ce831b19/go.mod h1:P8ha0wz3B43sDKD0AxqFDI8EyqLghcvY8g29xFJrBsg= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= From 9310b43388dbf302c58f6011a22655cafa959e13 Mon Sep 17 00:00:00 2001 From: dabasov Date: Sat, 13 Apr 2024 12:59:37 +0300 Subject: [PATCH 031/228] updated gosdk --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index b12f9f71..dd037d31 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.13.7 + github.com/0chain/gosdk v1.13.13 github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 diff --git a/go.sum b/go.sum index c848c421..7156a81f 100644 --- a/go.sum +++ b/go.sum @@ -40,8 +40,8 @@ github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565 h1:z+DtCR8mBsjPnEs github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565/go.mod h1:UyDC8Qyl5z9lGkCnf9RHJPMektnFX8XtCJZHXCCVj8E= 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.13.7 h1:VztAP8SJ9QsQhx/HV8/ToFzoK2NKWjdHBJHiWDnoWgY= -github.com/0chain/gosdk v1.13.7/go.mod h1:tgAiVAuIy+Vs1tGfKCPEuuWWARwNQBEw32y950LrqrU= +github.com/0chain/gosdk v1.13.13 h1:qgxKZkHZdshsri2i7lqE5Z2acuIsZZqgQKkvaM86g5Y= +github.com/0chain/gosdk v1.13.13/go.mod h1:tgAiVAuIy+Vs1tGfKCPEuuWWARwNQBEw32y950LrqrU= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= From c942e963ab698cd27865320d6ba16e6a069ef826 Mon Sep 17 00:00:00 2001 From: Jayash Satolia Date: Sun, 14 Apr 2024 16:27:45 +0530 Subject: [PATCH 032/228] Fix not available and is restricted and update gosdk --- cmd/storage.go | 29 ++++++++++++++++++----------- go.mod | 2 +- go.sum | 4 ++-- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/cmd/storage.go b/cmd/storage.go index a30b522e..7ab0b0b2 100644 --- a/cmd/storage.go +++ b/cmd/storage.go @@ -275,18 +275,25 @@ var blobberUpdateCmd = &cobra.Command{ } if flags.Changed("not_available") { - var ia bool - if ia, err = flags.GetBool("not_available"); err != nil { + var na bool + if na, err = flags.GetBool("not_available"); err != nil { log.Fatal(err) } - updateBlobber.NotAvailable = &ia + if !na { + na = false + } + updateBlobber.NotAvailable = &na } if flags.Changed("is_restricted") { var ia bool + // Check if the flag is set to true if ia, err = flags.GetBool("is_restricted"); err != nil { log.Fatal(err) } + if !ia { + ia = false + } updateBlobber.IsRestricted = &ia } @@ -314,12 +321,12 @@ var resetBlobberStatsCmd = &cobra.Command{ var ( flags = cmd.Flags() - blobberID string + blobberID string prevAllocated int64 prevSavedData int64 - newAllocated int64 - newSavedData int64 - err error + newAllocated int64 + newSavedData int64 + err error ) if !flags.Changed("blobber_id") { @@ -357,12 +364,12 @@ var resetBlobberStatsCmd = &cobra.Command{ log.Fatal("error in 'new_saved_data' flag: ", err) } - resetBlobberStatsDto := &sdk.ResetBlobberStatsDto { - BlobberID: blobberID, + resetBlobberStatsDto := &sdk.ResetBlobberStatsDto{ + BlobberID: blobberID, PrevAllocated: prevAllocated, PrevSavedData: prevSavedData, - NewAllocated: newAllocated, - NewSavedData: newSavedData, + NewAllocated: newAllocated, + NewSavedData: newSavedData, } fmt.Println(*resetBlobberStatsDto) diff --git a/go.mod b/go.mod index 7d35627d..87379996 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.13.4-0.20240408194813-7e52ce831b19 + github.com/0chain/gosdk v1.13.14-0.20240413095324-7b4cf9acca0b github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 diff --git a/go.sum b/go.sum index 8005208f..1785107a 100644 --- a/go.sum +++ b/go.sum @@ -40,8 +40,8 @@ github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565 h1:z+DtCR8mBsjPnEs github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565/go.mod h1:UyDC8Qyl5z9lGkCnf9RHJPMektnFX8XtCJZHXCCVj8E= 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.13.4-0.20240408194813-7e52ce831b19 h1:wq+GLgytz0tP/R+caNN1dZs8cdHUNwxiMlQG+SwJXrY= -github.com/0chain/gosdk v1.13.4-0.20240408194813-7e52ce831b19/go.mod h1:P8ha0wz3B43sDKD0AxqFDI8EyqLghcvY8g29xFJrBsg= +github.com/0chain/gosdk v1.13.14-0.20240413095324-7b4cf9acca0b h1:zbDBLWzHB6bnH4hWPvssj0WGtLgfQiMwARyPKuRF1Ok= +github.com/0chain/gosdk v1.13.14-0.20240413095324-7b4cf9acca0b/go.mod h1:tgAiVAuIy+Vs1tGfKCPEuuWWARwNQBEw32y950LrqrU= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= From ac2401d6abe3dab1ddc6c53e53ebf0797b5f24a3 Mon Sep 17 00:00:00 2001 From: dabasov Date: Sun, 14 Apr 2024 17:52:50 +0300 Subject: [PATCH 033/228] updated gosdk --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 87379996..a29dda32 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.13.14-0.20240413095324-7b4cf9acca0b + github.com/0chain/gosdk v1.14.0-RC1 github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 diff --git a/go.sum b/go.sum index 1785107a..64b661e7 100644 --- a/go.sum +++ b/go.sum @@ -40,8 +40,8 @@ github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565 h1:z+DtCR8mBsjPnEs github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565/go.mod h1:UyDC8Qyl5z9lGkCnf9RHJPMektnFX8XtCJZHXCCVj8E= 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.13.14-0.20240413095324-7b4cf9acca0b h1:zbDBLWzHB6bnH4hWPvssj0WGtLgfQiMwARyPKuRF1Ok= -github.com/0chain/gosdk v1.13.14-0.20240413095324-7b4cf9acca0b/go.mod h1:tgAiVAuIy+Vs1tGfKCPEuuWWARwNQBEw32y950LrqrU= +github.com/0chain/gosdk v1.14.0-RC1 h1:FaQIXMDtchKjJqhpxMh4dA52QUe46DKixibrZXcFS+o= +github.com/0chain/gosdk v1.14.0-RC1/go.mod h1:tgAiVAuIy+Vs1tGfKCPEuuWWARwNQBEw32y950LrqrU= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= From 93e83a4c39d85a7761675e275224a335bfcd598b Mon Sep 17 00:00:00 2001 From: devyetii Date: Sun, 14 Apr 2024 19:06:15 +0200 Subject: [PATCH 034/228] add revoke hint to share docs --- README.md | 2 +- cmd/share.go | 2 +- cmd/stream.go | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 45a3cde4..0c2466cc 100644 --- a/README.md +++ b/README.md @@ -1030,7 +1030,7 @@ the pre-defined remote path. | Parameter | Required | Description | Valid values | | ------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | | allocation | yes | allocation id | string | -| clientid | no | id of user to share file with, leave blank for public share | string | +| clientid | no | id of user to share file with (or revoke share from), leave blank for public share (or to revoke public sharing) | string | | encryptionpublickey | no | public key of the client to share file with, required if clientId | string | | expiration-seconds | no | seconds before `auth ticket` expires | int | | remotepath | yes | remote path of file to share | string | diff --git a/cmd/share.go b/cmd/share.go index 537ee427..a4f6f279 100644 --- a/cmd/share.go +++ b/cmd/share.go @@ -124,7 +124,7 @@ func init() { rootCmd.AddCommand(shareCmd) shareCmd.PersistentFlags().String("allocation", "", "Allocation ID") shareCmd.PersistentFlags().String("remotepath", "", "Remote path to share") - shareCmd.PersistentFlags().String("clientid", "", "ClientID of the user to share with. Leave blank for public share") + shareCmd.PersistentFlags().String("clientid", "", "ClientID of the user to share with (or revoke share from). Leave blank for public share (or revoking public access).") shareCmd.PersistentFlags().String("encryptionpublickey", "", "Encryption public key of the client you want to share with. Can be retrieved by the getwallet command") shareCmd.PersistentFlags().Int64("expiration-seconds", 0, "Authticket will expire when the seconds specified have elapsed after the instant of its creation") shareCmd.PersistentFlags().String("available-after", "", "Timelock for private file that makes the file available for download at certain time. 4 input formats are supported: +1h30m, +30, 1647858200 and 2022-03-21 10:21:38. Default value is current local time.") diff --git a/cmd/stream.go b/cmd/stream.go index 54743ee4..d5550395 100644 --- a/cmd/stream.go +++ b/cmd/stream.go @@ -114,7 +114,6 @@ func init() { streamCmd.PersistentFlags().String("allocation", "", "Allocation ID") streamCmd.PersistentFlags().String("remotepath", "", "Remote path to upload") streamCmd.PersistentFlags().String("localpath", "", "Local path of file to upload") - streamCmd.PersistentFlags().String("thumbnailpath", "", "Local thumbnail path of file to upload") streamCmd.PersistentFlags().String("attr-who-pays-for-reads", "owner", "Who pays for reads: owner or 3rd_party") streamCmd.Flags().Bool("encrypt", false, "(default false) pass this option to encrypt and upload the file") From 882103193504b215375dcaf314011c2106177548 Mon Sep 17 00:00:00 2001 From: Jayash Satolia Date: Mon, 15 Apr 2024 14:43:18 +0530 Subject: [PATCH 035/228] Update gosdk --- cmd/newallocation.go | 5 ++++- go.mod | 2 +- go.sum | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/cmd/newallocation.go b/cmd/newallocation.go index bee9ec62..c640d27f 100755 --- a/cmd/newallocation.go +++ b/cmd/newallocation.go @@ -183,6 +183,7 @@ var newallocationCmd = &cobra.Command{ } thirdPartyExtendable, _ := flags.GetBool("third_party_extendable") + force, _ := flags.GetBool("force") // Read the file options flags var fileOptionParams sdk.FileOptionsParameters @@ -254,6 +255,7 @@ var newallocationCmd = &cobra.Command{ BlobberAuthTickets: blobber_auth_tickets, FileOptionsParams: &fileOptionParams, ThirdPartyExtendable: thirdPartyExtendable, + Force: force, } allocationID, _, _, err = sdk.CreateAllocationWith(options) if err != nil { @@ -271,7 +273,7 @@ var newallocationCmd = &cobra.Command{ } allocationID, _, _, err = sdk.CreateAllocationForOwner(owner, ownerPublicKey, *datashards, *parityshards, - *size, readPrice, writePrice, lock, preferred_blobbers, blobber_auth_tickets, thirdPartyExtendable, &fileOptionParams) + *size, readPrice, writePrice, lock, preferred_blobbers, blobber_auth_tickets, thirdPartyExtendable, force, &fileOptionParams) if err != nil { log.Fatal("Error creating allocation: ", err) } @@ -342,6 +344,7 @@ func init() { newallocationCmd.Flags().String("preferred_blobbers", "", "coma seperated list of preferred blobbers") newallocationCmd.Flags().String("blobber_auth_tickets", "", "coma seperated list of blobber auth tickets") + newallocationCmd.Flags().Bool("force", false, "(default false) force to get blobbers even if required number of blobbers are not available (should be passed true in case of restricted blobbers)") newallocationCmd.Flags().Bool("third_party_extendable", false, "(default false) specify if the allocation can be extended by users other than the owner") newallocationCmd.Flags().Bool("forbid_upload", false, "(default false) specify if users cannot upload to this allocation") newallocationCmd.Flags().Bool("forbid_delete", false, "(default false) specify if the users cannot delete objects from this allocation") diff --git a/go.mod b/go.mod index a29dda32..736119a7 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.14.0-RC1 + github.com/0chain/gosdk v1.14.0-RC1.0.20240414202040-32b307adbe91 github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 diff --git a/go.sum b/go.sum index 64b661e7..89439ecd 100644 --- a/go.sum +++ b/go.sum @@ -40,8 +40,8 @@ github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565 h1:z+DtCR8mBsjPnEs github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565/go.mod h1:UyDC8Qyl5z9lGkCnf9RHJPMektnFX8XtCJZHXCCVj8E= 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.14.0-RC1 h1:FaQIXMDtchKjJqhpxMh4dA52QUe46DKixibrZXcFS+o= -github.com/0chain/gosdk v1.14.0-RC1/go.mod h1:tgAiVAuIy+Vs1tGfKCPEuuWWARwNQBEw32y950LrqrU= +github.com/0chain/gosdk v1.14.0-RC1.0.20240414202040-32b307adbe91 h1:rD4PsszAOb/TFeJwmz8pUmoQP54tbZOiE0AiQR/8yFk= +github.com/0chain/gosdk v1.14.0-RC1.0.20240414202040-32b307adbe91/go.mod h1:tgAiVAuIy+Vs1tGfKCPEuuWWARwNQBEw32y950LrqrU= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= From 2b72857789a8d067b1de470d3d97a277e7c3ddda Mon Sep 17 00:00:00 2001 From: Jayash Satolia Date: Tue, 16 Apr 2024 13:42:22 +0530 Subject: [PATCH 036/228] Update gosdk --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 736119a7..01d329f5 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.14.0-RC1.0.20240414202040-32b307adbe91 + github.com/0chain/gosdk v1.14.0-RC1.0.20240415100519-3195fb50d00e github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 diff --git a/go.sum b/go.sum index 89439ecd..896e3fb4 100644 --- a/go.sum +++ b/go.sum @@ -40,8 +40,8 @@ github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565 h1:z+DtCR8mBsjPnEs github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565/go.mod h1:UyDC8Qyl5z9lGkCnf9RHJPMektnFX8XtCJZHXCCVj8E= 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.14.0-RC1.0.20240414202040-32b307adbe91 h1:rD4PsszAOb/TFeJwmz8pUmoQP54tbZOiE0AiQR/8yFk= -github.com/0chain/gosdk v1.14.0-RC1.0.20240414202040-32b307adbe91/go.mod h1:tgAiVAuIy+Vs1tGfKCPEuuWWARwNQBEw32y950LrqrU= +github.com/0chain/gosdk v1.14.0-RC1.0.20240415100519-3195fb50d00e h1:aMMZkBlV4Kcy8ITxAhkCADUxt+BEYM20szqqVkv/7uI= +github.com/0chain/gosdk v1.14.0-RC1.0.20240415100519-3195fb50d00e/go.mod h1:tgAiVAuIy+Vs1tGfKCPEuuWWARwNQBEw32y950LrqrU= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= From 4c854f4f263a7a85c9953e5b7537056b418ce5a4 Mon Sep 17 00:00:00 2001 From: dabasov Date: Sat, 13 Apr 2024 12:59:37 +0300 Subject: [PATCH 037/228] updated gosdk --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 01d329f5..dd037d31 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.14.0-RC1.0.20240415100519-3195fb50d00e + github.com/0chain/gosdk v1.13.13 github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 diff --git a/go.sum b/go.sum index 896e3fb4..7156a81f 100644 --- a/go.sum +++ b/go.sum @@ -40,8 +40,8 @@ github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565 h1:z+DtCR8mBsjPnEs github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565/go.mod h1:UyDC8Qyl5z9lGkCnf9RHJPMektnFX8XtCJZHXCCVj8E= 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.14.0-RC1.0.20240415100519-3195fb50d00e h1:aMMZkBlV4Kcy8ITxAhkCADUxt+BEYM20szqqVkv/7uI= -github.com/0chain/gosdk v1.14.0-RC1.0.20240415100519-3195fb50d00e/go.mod h1:tgAiVAuIy+Vs1tGfKCPEuuWWARwNQBEw32y950LrqrU= +github.com/0chain/gosdk v1.13.13 h1:qgxKZkHZdshsri2i7lqE5Z2acuIsZZqgQKkvaM86g5Y= +github.com/0chain/gosdk v1.13.13/go.mod h1:tgAiVAuIy+Vs1tGfKCPEuuWWARwNQBEw32y950LrqrU= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= From f19697f705d7d1832e8328650a112954ca04d6ca Mon Sep 17 00:00:00 2001 From: dabasov Date: Sat, 20 Apr 2024 23:36:30 +0300 Subject: [PATCH 038/228] updated gosdk --- go.mod | 3 ++- go.sum | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index dd037d31..54c7376f 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.13.13 + github.com/0chain/gosdk v1.14.0-RC2 github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 @@ -30,6 +30,7 @@ require ( github.com/gorilla/websocket v1.5.0 // indirect github.com/h2non/filetype v1.1.4-0.20231228185113-6469358c2bcb // indirect github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect + github.com/hashicorp/golang-lru/v2 v2.0.1 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/herumi/bls-go-binary v1.31.0 // indirect github.com/hitenjain14/fasthttp v0.0.0-20240229173600-722723e15e17 // indirect diff --git a/go.sum b/go.sum index 7156a81f..d055b373 100644 --- a/go.sum +++ b/go.sum @@ -40,8 +40,8 @@ github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565 h1:z+DtCR8mBsjPnEs github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565/go.mod h1:UyDC8Qyl5z9lGkCnf9RHJPMektnFX8XtCJZHXCCVj8E= 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.13.13 h1:qgxKZkHZdshsri2i7lqE5Z2acuIsZZqgQKkvaM86g5Y= -github.com/0chain/gosdk v1.13.13/go.mod h1:tgAiVAuIy+Vs1tGfKCPEuuWWARwNQBEw32y950LrqrU= +github.com/0chain/gosdk v1.14.0-RC2 h1:OIpjj7mDKxVqJVlxJKm8/fPzdJRN5roXO7/plBCtmTg= +github.com/0chain/gosdk v1.14.0-RC2/go.mod h1:tgAiVAuIy+Vs1tGfKCPEuuWWARwNQBEw32y950LrqrU= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= @@ -209,6 +209,8 @@ github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d h1:dg1dEPuWpEqDnvIw251EVy4zlP8gWbsGj4BsUKCRpYs= github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +github.com/hashicorp/golang-lru/v2 v2.0.1 h1:5pv5N1lT1fjLg2VQ5KWc7kmucp2x/kvFOnxuVTqZ6x4= +github.com/hashicorp/golang-lru/v2 v2.0.1/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/herumi/bls-go-binary v1.31.0 h1:L1goQ2tMtGgpXCg5AwHAdJQpLs/pfnWWEc3Wog6OhmI= From a9cb1c0f178b8cbec3f1a01a9fa518999f8bb5d1 Mon Sep 17 00:00:00 2001 From: dabasov Date: Sun, 21 Apr 2024 11:59:42 +0300 Subject: [PATCH 039/228] fixed build --- cmd/stakepool.go | 4 ++-- cmd/storage.go | 32 +++----------------------------- 2 files changed, 5 insertions(+), 31 deletions(-) diff --git a/cmd/stakepool.go b/cmd/stakepool.go index e43305d9..3ed00bc0 100644 --- a/cmd/stakepool.go +++ b/cmd/stakepool.go @@ -36,8 +36,8 @@ func printStakePoolInfo(info *sdk.StakePoolInfo) { // settings fmt.Println("settings:") fmt.Println(" delegate_wallet: ", info.Settings.DelegateWallet) - fmt.Println(" min_stake: ", info.Settings.MinStake.String()) - fmt.Println(" max_stake: ", info.Settings.MaxStake.String()) + //fmt.Println(" min_stake: ", info.Settings.MinStake.String()) + //fmt.Println(" max_stake: ", info.Settings.MaxStake.String()) fmt.Println(" num_delegates: ", info.Settings.NumDelegates) } diff --git a/cmd/storage.go b/cmd/storage.go index 23611204..e3a8a097 100644 --- a/cmd/storage.go +++ b/cmd/storage.go @@ -66,7 +66,7 @@ var lsBlobers = &cobra.Command{ Run: func(cmd *cobra.Command, args []string) { doJSON, _ := cmd.Flags().GetBool("json") doAll, _ := cmd.Flags().GetBool("all") - isStakable, err := cmd.Flags().GetBool("stakable") + isStakable, err := cmd.Flags().GetBool("stakable") if err != nil { log.Fatalf("err parsing in stakable flag: %v", err) } @@ -143,8 +143,8 @@ var blobberInfoCmd = &cobra.Command{ fmt.Println(" max_offer_duration:", blob.Terms.MaxOfferDuration) fmt.Println("settings:") fmt.Println(" delegate_wallet:", blob.StakePoolSettings.DelegateWallet) - fmt.Println(" min_stake: ", blob.StakePoolSettings.MinStake) - fmt.Println(" max_stake: ", blob.StakePoolSettings.MaxStake) + //fmt.Println(" min_stake: ", blob.StakePoolSettings.MinStake) + //fmt.Println(" max_stake: ", blob.StakePoolSettings.MaxStake) fmt.Println(" num_delegates: ", blob.StakePoolSettings.NumDelegates) fmt.Println(" service_charge: ", blob.StakePoolSettings.ServiceCharge*100, "%") }, @@ -225,32 +225,6 @@ var blobberUpdateCmd = &cobra.Command{ stakePoolSettings := &blockchain.UpdateStakePoolSettings{} var stakePoolSettingChanged bool - if flags.Changed("min_stake") { - var minStake float64 - if minStake, err = flags.GetFloat64("min_stake"); err != nil { - log.Fatal(err) - } - stake, err := common.ToBalance(minStake) - if err != nil { - log.Fatal(err) - } - stakePoolSettings.MinStake = &stake - stakePoolSettingChanged = true - } - - if flags.Changed("max_stake") { - var maxStake float64 - if maxStake, err = flags.GetFloat64("max_stake"); err != nil { - log.Fatal(err) - } - stake, err := common.ToBalance(maxStake) - if err != nil { - log.Fatal(err) - } - stakePoolSettings.MaxStake = &stake - stakePoolSettingChanged = true - } - if flags.Changed("num_delegates") { var nd int if nd, err = flags.GetInt("num_delegates"); err != nil { From 07d60cb04dccd3a52491c192665a052248b005f8 Mon Sep 17 00:00:00 2001 From: devyetii Date: Sun, 21 Apr 2024 23:21:53 +0200 Subject: [PATCH 040/228] add docs to transfer allocation ownership command --- README.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/README.md b/README.md index 0c2466cc..d4f171a2 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ zbox is a command line interface (CLI) tool to understand the capabilities of Z - [Create new allocation](#create-new-allocation) - [Free storage allocation](#free-storage-allocation) - [Update allocation](#update-allocation) + - [Transfer allocation ownership](#transfer-allocation-ownership) - [Forbid Allocation](#forbid-allocation) - [Cancel allocation](#cancel-allocation) - [Finalise allocation](#finalise-allocation) @@ -398,6 +399,27 @@ Output: Allocation updated with txId : fb84185dae620bbba8386286726f1efcd20d2516bcf1a448215434d87be3b30d ``` +#### Transfer allocation ownership + +`transferallocation` transfers an allocation from one account to another. +This operation needs to be run by the current owner of the allocation. + +| Parameter | Required | Description | Valid Values | +| ---------- | -------- | ------------- | ------------ | +| allocation | yes | allocation id | string | +| new_owner | yes | new owner id | string | +| new_owner_key | yes | new owner public key | string | + +```shell +./zbox transferallocation --allocation d0939e912851959637257573b08c748474f0dd0ebbc8e191e4f6ad69e4fdc7ac --new_owner e61b1d5f081c4dfa4d45c852ca8abbfcdc3023ed4ffe2402ba7e9b2ebc56b129 --new_owner_key 421d9f68e121884a02587c1d5aad0ca81a4df2358abe1acb0952efdd5a6afc0ed198ec897a848890bd36a74f3dfd178a1ed9dcd2fab969b6ed073f98d795759d +``` + +Output: + +``` +transferred ownership of allocation : d0939e912851959637257573b08c748474f0dd0ebbc8e191e4f6ad69e4fdc7ac to e61b1d5f081c4dfa4d45c852ca8abbfcdc3023ed4ffe2402ba7e9b2ebc56b129 +``` + #### Forbid Allocation There are various operations which you can forbid on an allocation. Forbid flag works with [update allocation](#update-allocation) command. Check its working first. From 8255a6cb15591d2f0d0c160e7b1b71e529caf36d Mon Sep 17 00:00:00 2001 From: Gaurboy's M3Pro Date: Fri, 26 Apr 2024 03:54:19 +0530 Subject: [PATCH 041/228] fixed till kill-validator --- README.md | 86 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 47 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index d4f171a2..e480a5fd 100644 --- a/README.md +++ b/README.md @@ -250,24 +250,27 @@ and `free_storage` parameters. | allocationFileName | local file to store allocation information | allocation.txt | file path | | cost | returns the cost of the allocation, no allocation created | | flag | | data | number of data shards, effects upload and download speeds | 2 | int | -| expire | duration to allocation expiration | 720h | duration | -| free_storage | free storage marker file. | | file path | +| free_storage | free storage marker file. | | file path to json marker file | | owner | owner's id, use for funding an allocation for another | | string | | owner_public_key | public key, use for funding an allocation for another | | string | -| lock | lock write pool with given number of tokens | | float | -| parity | number of parity shards, effects availability | 2 | int | +| lock\* | lock write pool with given number of tokens | | float | +| parity | number of parity shards, effects availability (has to be more than 1 and less than the number of available blobbers on the chain (upper capped to 30)) | 2 | int | | read_price | filter blobbers by read price range | 0-inf | range | | size | size of space reserved on blobbers | 2147483648 | bytes | | usd | give token value in USD | | flag | | write_price | filter blobbers by write price range | 0-inf | range | -| false | bool | | third_party_extendable | specify if the allocation can be extended by users other than the owner | false | bool | -| forbid_upload | specify if users cannot upload to this allocation | false | bool | -| forbid_delete | specify if the users cannot delete objects from this allocation | false | bool | -| forbid_update | specify if the users cannot update objects in this allocation | false | bool | -| forbid_move | specify if the users cannot move objects from this allocation | false | bool | -| forbid_copy | specify if the users cannot copy object from this allocation | false | bool | -| forbid_rename | specify if the users cannot rename objects in this allocation | false | bool | +| forbid_upload | specify if users cannot upload to this allocation | on blank flag use :true ; else false | bool | +| forbid_delete | specify if the users cannot delete objects from this allocation | on blank flag use :true ; else false | bool | +| forbid_update | specify if the users cannot update objects in this allocation | on blank flag use :true ; else false | bool | +| forbid_move | specify if the users cannot move objects from this allocation | on blank flag use :true ; else false | bool | +| forbid_copy | specify if the users cannot copy object from this allocation | on blank flag use :true ; else false | bool | +| forbid_rename | specify if the users cannot rename objects in this allocation | on blank flag use :true ; else false | bool | +| blobber_auth_tickets | comma separated list of blobber auth tickets | | comma separated list of strings | +| force | force to get blobbers even if required number of blobbers are not available (should be passed true in case of restricted blobbers) | false | bool | +| name | allocation name | | string | +| preferred_blobbers | comma separated list of preferred blobber ids | | comma separated list of strings | +`*` - only required if free_storage not set.
newallocation @@ -352,25 +355,25 @@ Further we can add a blobber to the allocation, adding a blobber will allow a blobber to be removed. An increase in blobber count will increment the parity shards. -| Parameter | Required | Description | Valid Values | -| -------------- | -------- | -------------------------------------------------------------------- | ------------ | -| allocation | yes | allocation id | string | -| expiry | | adjust storage expiration time | duration | -| free_storage | | free storage marker file | string | -| lock | yes\* | lock additional tokens in write pool | int | -| size | | adjust allocation size | bytes | -| add_blobber | | add a new blobber to the allocation, required for remove_blobber | string | -| remove_blobber | | remove a blobber from the allocation, requires an add_blobber option | string2 | - +| Parameter | Required | Description | Default| Valid Values | +| -------------- | -------- | -------------------------------------------------------------------- | | ------------ | +| allocation | yes | allocation id | | string | +| name | | allocation name | | string | +| extend | | adjust storage expiration time | | duration | +| free_storage | | free storage marker file | | string | +| lock | yes\* | lock additional tokens in write pool | | int | +| size | | adjust allocation size | | bytes | +| add_blobber | | add a new blobber to the allocation, required for remove_blobber | | string | +| add_blobber_auth_ticket | | Auth ticket of blobber to add to the allocation | | string | +| remove_blobber | | remove a blobber from the allocation, requires an add_blobber option | | string | +| third_party_extendable | | specify if the allocation can be extended by users other than the owner | false | bool +| forbid_upload | |specify if users cannot upload to this allocation |on blank flag use :true ; else false | bool +| forbid_delete | |specify if the users cannot delete objects from this allocation | on blank flag use :true ; else false | bool +| forbid_update | |specify if the users cannot update objects in this allocation |on blank flag use :true ; else false | bool +| forbid_move | |specify if the users cannot move objects from this allocation |on blank flag use :true ; else false | bool +| forbid_copy | |specify if the users cannot copy object from this allocation |on blank flag use :true ; else false | bool +| forbid_rename | |specify if the users cannot rename objects in this allocation |on blank flag use :true ; else false | bool `*` only required if free_storage not set. -| third_party_extendable | specify if the allocation can be extended by users other than the owner | false | bool -| forbid_upload | specify if users cannot upload to this allocation |false | bool -| forbid_delete | specify if the users cannot delete objects from this allocation | false | bool -| forbid_update | specify if the users cannot update objects in this allocation |false | bool -| forbid_move | specify if the users cannot move objects from this allocation |false | bool -| forbid_copy | specify if the users cannot copy object from this allocation |false | bool -| forbid_rename | specify if the users cannot rename objects in this allocation |false | bool -
updateallocation @@ -509,8 +512,9 @@ Use `ls-blobbers` command to show active blobbers. | Parameter | Required | Description | Valid Values | | --------- | -------- | ------------------------------------ | ------------ | -| all | no | shows active and non active blobbers | flag | -| json | no | display result in .json format | flag | +| all | no | shows active and non active blobbers | bool | +| json | no | display result in .json format | bool | +| stakable | no | gets only stakable list of blobbers if set to true | bool |
ls-blobbers @@ -547,7 +551,7 @@ Use `bl-info` command to get detailed blobber information. | Parameter | Required | Description | default | Valid values | | ---------- | -------- | ----------------------------------- | ------- | ------------ | -| blobber id | yes | blobber on which to get information | | string | +| blobber_id | yes | blobber on which to get information | | string | | json | no | print result in json format | false | boolean |
@@ -635,7 +639,9 @@ on the blockchain not the blobber. | read_price | no | update read price | | float | | service_charge | no | update service charge | | float | | write_price | no | update write price | | float | - +| url | no | update the url of the blobber | | string | +| is_restricted | no | update whether blobber is restricted | on blank flag use :true ; else false | bool | +| not_available | no | set blobber's availability for new allocations | on blank flag use :true ; else false | bool |
bl-update @@ -673,6 +679,12 @@ Command: ``` ./zbox ls-validators ``` + +| Parameter | Required | Description +| ------------------ | -------- | ----------------------------------------- +| --stakable | no | Gets only validators that can be staked if set to true +| --json | no | Print Response as json data + Response : ``` id: b9f4f244e2e483548795e42dad0c5b5bb8f5c25d70cadeafc202ce6011b7ff8c @@ -728,9 +740,7 @@ settings: | Parameter | Required | Description | ------------------ | -------- | ----------------------------------------- -| --blobber_id | yes | Blobber Id to kill a specific blobber.Can be retrieved using [List blobbers](#list-blobbers). -| --json | optional | Print Response as json data -| --help | no | Provide information about the command +| --id | yes | Blobber Id to kill a specific blobber.Can be retrieved using [List blobbers](#list-blobbers). Sample Command : ``` @@ -749,9 +759,7 @@ killed blobber $BLOBBER_ID | Parameter | Required | Description | ------------------ | -------- | ----------------------------------------- -| --validator_id | yes | Validator Id to kill a specific blobber.Can be retrieved using [List all Validators](#list-all-validators). -| --json | optional | Print Response as json data -| --help | no | Provide information about the command +| --id | yes | Validator Id to kill a specific blobber.Can be retrieved using [List all Validators](#list-all-validators). Sample Command : From b00c64545030fa4ed17968ee9f65c6f876402ab9 Mon Sep 17 00:00:00 2001 From: Hitenjain14 Date: Sat, 27 Apr 2024 00:39:31 +0530 Subject: [PATCH 042/228] fix get content type --- cmd/sync.go | 3 ++- go.mod | 2 +- go.sum | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cmd/sync.go b/cmd/sync.go index 3089f9e3..a013815b 100644 --- a/cmd/sync.go +++ b/cmd/sync.go @@ -3,6 +3,7 @@ package cmd import ( "fmt" "os" + "path" "runtime" "strings" "sync" @@ -101,7 +102,7 @@ func startMultiUploadUpdate(allocationObj *sdk.Allocation, argsSlice []chunkedUp return err } - mimeType, err := zboxutil.GetFileContentType(fileReader) + mimeType, err := zboxutil.GetFileContentType(path.Ext(args.localPath), fileReader) if err != nil { return err } diff --git a/go.mod b/go.mod index 54c7376f..c333b995 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.14.0-RC2 + github.com/0chain/gosdk v1.14.0-RC5 github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 diff --git a/go.sum b/go.sum index d055b373..f1376aea 100644 --- a/go.sum +++ b/go.sum @@ -42,6 +42,8 @@ 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.14.0-RC2 h1:OIpjj7mDKxVqJVlxJKm8/fPzdJRN5roXO7/plBCtmTg= github.com/0chain/gosdk v1.14.0-RC2/go.mod h1:tgAiVAuIy+Vs1tGfKCPEuuWWARwNQBEw32y950LrqrU= +github.com/0chain/gosdk v1.14.0-RC5 h1:3/K++2jreD9jaZDAYkGXQ41ywANUq6KlIO9vjVZ3d3A= +github.com/0chain/gosdk v1.14.0-RC5/go.mod h1:tgAiVAuIy+Vs1tGfKCPEuuWWARwNQBEw32y950LrqrU= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= From 33de0f77995d924608ad83a57d78c8780cc19c6f Mon Sep 17 00:00:00 2001 From: Gaurboy's M3Pro Date: Sat, 27 Apr 2024 01:50:58 +0530 Subject: [PATCH 043/228] added more documentations --- README.md | 121 ++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 77 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index e480a5fd..5bfe455a 100644 --- a/README.md +++ b/README.md @@ -260,12 +260,12 @@ and `free_storage` parameters. | usd | give token value in USD | | flag | | write_price | filter blobbers by write price range | 0-inf | range | | third_party_extendable | specify if the allocation can be extended by users other than the owner | false | bool | -| forbid_upload | specify if users cannot upload to this allocation | on blank flag use :true ; else false | bool | -| forbid_delete | specify if the users cannot delete objects from this allocation | on blank flag use :true ; else false | bool | -| forbid_update | specify if the users cannot update objects in this allocation | on blank flag use :true ; else false | bool | -| forbid_move | specify if the users cannot move objects from this allocation | on blank flag use :true ; else false | bool | -| forbid_copy | specify if the users cannot copy object from this allocation | on blank flag use :true ; else false | bool | -| forbid_rename | specify if the users cannot rename objects in this allocation | on blank flag use :true ; else false | bool | +| forbid_upload | specify if users cannot upload to this allocation | false | bool | +| forbid_delete | specify if the users cannot delete objects from this allocation | false | bool | +| forbid_update | specify if the users cannot update objects in this allocation | false | bool | +| forbid_move | specify if the users cannot move objects from this allocation | false | bool | +| forbid_copy | specify if the users cannot copy object from this allocation | false | bool | +| forbid_rename | specify if the users cannot rename objects in this allocation | false | bool | | blobber_auth_tickets | comma separated list of blobber auth tickets | | comma separated list of strings | | force | force to get blobbers even if required number of blobbers are not available (should be passed true in case of restricted blobbers) | false | bool | | name | allocation name | | string | @@ -367,12 +367,12 @@ An increase in blobber count will increment the parity shards. | add_blobber_auth_ticket | | Auth ticket of blobber to add to the allocation | | string | | remove_blobber | | remove a blobber from the allocation, requires an add_blobber option | | string | | third_party_extendable | | specify if the allocation can be extended by users other than the owner | false | bool -| forbid_upload | |specify if users cannot upload to this allocation |on blank flag use :true ; else false | bool -| forbid_delete | |specify if the users cannot delete objects from this allocation | on blank flag use :true ; else false | bool -| forbid_update | |specify if the users cannot update objects in this allocation |on blank flag use :true ; else false | bool -| forbid_move | |specify if the users cannot move objects from this allocation |on blank flag use :true ; else false | bool -| forbid_copy | |specify if the users cannot copy object from this allocation |on blank flag use :true ; else false | bool -| forbid_rename | |specify if the users cannot rename objects in this allocation |on blank flag use :true ; else false | bool +| forbid_upload | |specify if users cannot upload to this allocation | false | bool +| forbid_delete | |specify if the users cannot delete objects from this allocation | false | bool +| forbid_update | |specify if the users cannot update objects in this allocation | false | bool +| forbid_move | |specify if the users cannot move objects from this allocation | false | bool +| forbid_copy | |specify if the users cannot copy object from this allocation | false | bool +| forbid_rename | |specify if the users cannot rename objects in this allocation | false | bool `*` only required if free_storage not set.
updateallocation @@ -640,8 +640,8 @@ on the blockchain not the blobber. | service_charge | no | update service charge | | float | | write_price | no | update write price | | float | | url | no | update the url of the blobber | | string | -| is_restricted | no | update whether blobber is restricted | on blank flag use :true ; else false | bool | -| not_available | no | set blobber's availability for new allocations | on blank flag use :true ; else false | bool | +| is_restricted | no | update whether blobber is restricted | false | bool | +| not_available | no | set blobber's availability for new allocations | false | bool |
bl-update @@ -682,8 +682,8 @@ Command: | Parameter | Required | Description | ------------------ | -------- | ----------------------------------------- -| --stakable | no | Gets only validators that can be staked if set to true -| --json | no | Print Response as json data +| --stakable | no | Gets only validators that can be staked if set to true +| --json | no | Print Response as json data Response : ``` @@ -713,7 +713,6 @@ settings: | ------------------ | -------- | ----------------------------------------- | --validator_id | yes | id of validator whose configuration has to be fetched | --json | optional | Print Response as json data -| --help | no | Provide information about the command Sample Command : ``` @@ -789,8 +788,10 @@ The user must be the owner of the allocation.You can request the file be encrypt | web-streaming | no | transcode file before upload to fragmented mp4 | false | boolean | | localpath | yes | local path of the file to upload | | file path | | remotepath | yes | remote path to upload file to, use to access file later | | string | -| thumbnailpath | no | local path of thumbnaSil | | file path | +| thumbnailpath | no | local path of thumbnail | | file path | | chunknumber | no | how many chunks should be uploaded in a http request | 1 | int | +| attr-who-pays-for-reads | no | Who pays for reads: owner or 3rd_party | owner | owner / 3rd_party| +| multiuploadjson | no | A JSON file containing multiupload options | | file path |
upload @@ -862,6 +863,7 @@ The user must be the owner of the allocation.You can request the file be encrypt | thumbnailpath | no | local path of thumbnaSil | | file path | | chunknumber | no | how many chunks should be uploaded in a http request | 1 | int | | delay | no | set segment duration to seconds. | 5 | int | +| attr-who-pays-for-reads | no | Who pays for reads: owner or 3rd_party | owner | owner / 3rd_party|
stream @@ -891,7 +893,8 @@ The user must be the owner of the allocation.You can request the file be encrypt | feed | no | set remote live feed to url. | false | url | | downloader-args | no | pass args to youtube-dl to download video. default is \"-q -f best\". | -q -f best | [youtube-dl](https://github.com/ytdl-org/youtube-dl/blob/master/README.md#options) | | ffmpeg-args | no | pass args to ffmpeg to build segments. | -loglevel warning | [ffmpeg](https://www.ffmpeg.org/ffmpeg.html) | - +| attr-who-pays-for-reads | no | Who pays for reads: owner or 3rd_party | owner | owner / 3rd_party| +enum
feed @@ -952,11 +955,13 @@ Use `download` command to download your own or a shared file. | endblock | no | download until specified block number | | int | | localpath | yes | local path to which to download the file to | | file path | | remotepath | yes | remote path to which the file was uploaded | | string | -| rx_pay | no | `authticket` must be valid, true = sender pays, false = allocation owner pays | false | boolean | | startblock | no | start download from specified block | | int | | thumbail | no | only download the thumbnail | false | boolean | | live | no | start m3u8 downloader,and automatically generate media playlist(m3u8) on --localpath | false | boolean | | delay | no | pass segment duration to generate media playlist(m3u8). only works with --live. default duration is 5s. | 5 | int | +| lookuphash | no | The remote lookuphash of the object retrieved from the list | | string | +| multidownloadjson | no | A JSON file containing multi download options | | string | +| verifydownload | no | pass this option to verify downloaded blocks | false | boolean |
download @@ -1045,14 +1050,6 @@ File successfully deleted (Can be verified using [list](https://github.com/0chai Use share command to generate an authtoken that provides authorization to the holder to the specified file on the remotepath. -- --allocation string Allocation ID -- --clientid string ClientID of the user to share with. Leave blank for public share -- --encryptionpublickey string Encryption public key of the client you want to share with (from [getwallet](#Get-wallet) command ) -- --remotepath string Remote path to share -- --expiration-seconds number The seconds after which the ticket will expire(defaults to number of seconds in 90 days - if option not provided) -- --available-after Timelock for private file that makes the file available for download at certain time. 4 input formats are supported: +1h30m, +30, 1647858200 and 2022-03-21 10:21:38 - `auth ticket` can be used with [download](#download), and [list](#list), [meta](#get-metadata) and [get_download_cost](#download-cost), but only for files in the pre-defined remote path. @@ -1295,7 +1292,9 @@ Only the allocation's owner can successfully run `sync`. | localchache | no | local chache of remote snapshot. Used for comparsion with remote. After sync will be updated. | | string | | localpath | yes | local directory to which to sync | | file path | | uploadonly | no | only upload and update files | false | boolean | -| chunknumber | no | how many chunks should be uploaded in a http request | 1 | int | +| chunknumber | no | how many chunks should be uploaded in a http request | | int | +| remotepath | no | Remote dir path from where it sync | "/" | string | +| verifydownload | no | how many chunks should be uploaded in a http request | true | boolean |
sync @@ -1393,6 +1392,7 @@ and challenges passed/failed/open/redeemed. | Parameter | Required | Description | default | Valid values | | ---------- | -------- | ----------------------------- | ------- | ------------ | | allocation | yes | allocation id | | string | +| blocks-per-marker | no | print response in json format | 10 | int | | json | no | print response in json format | false | boolean |
@@ -1744,9 +1744,10 @@ These rewards can be accessed using this `collect-reward` command. | Parameter | Required | Description | default | Valid values | | ------------- | -------- | -------------------- | ------- | ------------ | | provider_type | no | blobber or validator | blobber | string | +| provider_id | no | id of blobber or validator | | string | ```bash -./zbox colect-reward --provider_type blobber +./zbox collect-reward --provider_type blobber ``` #### Read pool info @@ -1800,11 +1801,10 @@ Unlocked tokens get returned to the original wallet balance. #### Storage SC configurations -Show storage SC configuration. +Use `sc-config` to show storage SC configuration. | Parameter | Required | Description | default | Valid values | | ---------- | -------- | --------------------------- | ------- | ------------ | -| allocation | yes | allocation id | | string | | json | no | print result in json format | false | boolean |
@@ -1814,18 +1814,27 @@ Show storage SC configuration.
-``` +```sh ./zbox sc-config ``` +```sh +{"blobber_slash":"0.1","block_reward.block_reward":"0.0063","block_reward.gamma.a":"10","block_reward.gamma.alpha":"0.2","block_reward.gamma.b":"9","block_reward.qualifying_stake":"1","block_reward.zeta.i":"1","block_reward.zeta.k":"0.9","block_reward.zeta.mu":"0.2","cancellation_charge":"0.2","challenge_enabled":"true","challenge_generation_gap":"1","cost.add_blobber":"266","cost.add_free_storage_assigner":"124","cost.add_validator":"348","cost.blobber_health_check":"97","cost.cancel_allocation":"1163","cost.challenge_response":"728","cost.collect_reward":"181","cost.commit_connection":"743","cost.commit_settings_changes":"56","cost.finalize_allocation":"1091","cost.free_allocation_request":"2132","cost.generate_challenge":"600","cost.kill_blobber":"651","cost.kill_validator":"277","cost.new_allocation_request":"1919","cost.pay_blobber_block_rewards":"100","cost.read_pool_lock":"170","cost.read_pool_unlock":"104","cost.read_redeem":"664","cost.shutdown_blobber":"597","cost.shutdown_validator":"227","cost.stake_pool_lock":"187","cost.stake_pool_unlock":"119","cost.update_allocation_request":"2692","cost.update_blobber_settings":"338","cost.update_settings":"143","cost.update_validator_settings":"247","cost.write_pool_lock":"186","free_allocation_settings.data_shards":"4","free_allocation_settings.parity_shards":"2","free_allocation_settings.read_pool_fraction":"0","free_allocation_settings.read_price_range.max":"0","free_allocation_settings.read_price_range.min":"0","free_allocation_settings.size":"2147483648","free_allocation_settings.write_price_range.max":"0.025","free_allocation_settings.write_price_range.min":"0","health_check_period":"1h30m0s","max_blobber_select_for_challenge":"5","max_blobbers_per_allocation":"30","max_challenge_completion_rounds":"1200","max_charge":"0.5","max_delegates":"100","max_file_size":"549755813888","max_individual_free_allocation":"1","max_read_price":"0","max_stake":"2e+06","max_total_free_allocation":"1e+07","max_write_price":"0.025","min_alloc_size":"1073741824","min_blobber_capacity":"10737418240","min_stake":"1","min_stake_per_delegate":"10","min_write_price":"0.001","num_validators_rewarded":"10","owner_id":"1746b06bb09f55ee01b33b5e2e055d6cc7a900cb57c0a3a5eaabb8a0e7745802","readpool.min_lock":"0","stakepool.kill_slash":"0.5","stakepool.min_lock_period":"0s","time_unit":"8760h0m0s","validator_reward":"0.025","validators_per_challenge":"2","writepool.min_lock":"0.1"} +``` + #### Stake pool info Use `sp-info` to get your stake pool information and settings. | Parameter | Required | Description | default | Valid values | | ---------- | -------- | --------------------------- | -------------- | ------------ | -| blobber_id | | id of blobber | current client | string | +| blobber_id | | id of blobber | | string | +| authorizer_id | | id of authorizer | | string | +| miner_id | | id of miner | | string | +| sharder_id | | id of sharder | | string | +| validator_id | | id of validator | | string | | json | no | print result in json format | false | boolean | + \* - one of the above ids is required
sp-info @@ -1837,6 +1846,21 @@ Use `sp-info` to get your stake pool information and settings. ``` ./zbox sp-info --blobber_id ``` +Sample Response : + +```sh +pool id: 1c9e629b3f6c2c402c5b2979ba4d618f8645de5c0152312e5b8bfff44466e56e +balance: 0 SAS +total stake: 0 SAS +unclaimed rewards: 0 SAS +total rewards: 0 SAS +delegate_pools: no delegate pools +settings: + delegate_wallet: 57da19ce71f8c28b21a2db84eb27cf91874d9ca5e04455d7ee364a757f4bf920 + min_stake: 0 SAS + max_stake: 0 SAS + num_delegates: 1 +``` #### Lock tokens into stake pool @@ -1852,6 +1876,9 @@ to stake pool later. | ------------ | -------- | --------------- | ------- | ------------ | | blobber_id | | id of blobber | n/a | string | | validator_id | | id of validator | n/a | string | +| miner_id | | id of miner | n/a | string | +| sharder_id | | id of blobber | n/a | string | +| authorizer_id| | id of authorizer| n/a | string | | fee | no | transaction fee | 0 | float | | tokens | yes | tokens to lock | | float | @@ -1885,6 +1912,9 @@ blobber allocation for any new allocations. | ------------ | -------- | --------------- | ------- | ------------ | | blobber_id | | id of blobber | n/a | string | | validator_id | | id of validator | n/a | string | +| miner_id | | id of miner | n/a | string | +| sharder_id | | id of blobber | n/a | string | +| authorizer_id| | id of authorizer| n/a | string | | fee | no | transaction fee | 0 | float |
@@ -1912,6 +1942,10 @@ Get information about all stake pools of current user. | Parameter | Required | Description | default | Valid values | | --------- | -------- | --------------------------- | ------- | ------------ | +| all | no | get all the pools | false | boolean | +| client_id | no | client_id of the user | | string | +| limit | no | limit the number of records returned | 20 | int | +| offset | no | skip the number of rows before beginning | | int | | json | no | print result in json format | false | boolean |
@@ -1970,31 +2004,28 @@ allocation's owner on closing the allocation. | Parameter | Required | Description | default | Valid values | | ------------- | -------- | --------------------------------- | ------- | ------------ | -| allocation id | no | allocation id | | string | -| blobber | no | blobber id | | string | -| duration | yes | duration for which to lock tokens | | duration | +| allocation | no | allocation id | | string | | fee | no | transaction fee | 0 | float | | tokens | yes | number of tokens to lock | | float |
- rp-lock with a specific blobber + wp-lock with a specific blobber ```shell -./zbox rp-lock --allocation --duration 40m --tokens 1 --blobber f65af5d64000c7cd2883f4910eb69086f9d6e6635c744e62afcfab58b938ee25 -``` +./zbox wp-lock --allocation --tokens 1 ![image](https://user-images.githubusercontent.com/6240686/123988183-b4c93c00-d9bf-11eb-825c-9a5849fedbbf.png)
- rp-lock spread across all blobbers + wp-lock spread across all blobbers Tokens are spread between the blobber pools weighted by each blobber's Terms.ReadPrice. ```shell -./zbox rp-lock --allocation --duration 40m --tokens 1 +./zbox wp-lock --allocation --tokens 1 ``` ![image](https://user-images.githubusercontent.com/6240686/123979735-e5f23e00-d9b8-11eb-8232-339a4a3374d0.png) @@ -2012,17 +2043,18 @@ An expired write pool, associated with an allocation, can be locked until alloca | Parameter | Required | Description | default | Valid values | | --------- | -------- | --------------- | ------- | ------------ | +| allocation | no | allocation id | | string | | fee | no | transaction fee | 0 | float |
- rp-unlock + wp-unlock ![image](https://user-images.githubusercontent.com/6240686/123980742-b09a2000-d9b9-11eb-8987-c18ff90ee705.png)
``` -./zbox wp-unlock +./zbox wp-unlock --allocation ``` #### Download cost @@ -2034,6 +2066,7 @@ owner, collaborator, or using an auth ticket to determine the download cost of t | ---------- | -------- | ----------------------------------------- | ------- | ------------ | | allocation | yes | allocation id | | string | | authticket | no | auth ticket to use if not the owner | | string | +| blocks-per-marker | no | blocks signed per Read Marker | 10 | int | | lookuphash | no | hash of remote file, use with auth ticket | | string | | remotepath | no | file of which to get stats, use if owner | | string | From c33111808f92d783bbe5ebedd80656ff23f66d15 Mon Sep 17 00:00:00 2001 From: devyetii Date: Sat, 27 Apr 2024 19:35:42 +0200 Subject: [PATCH 044/228] some fixes --- README.md | 342 ++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 242 insertions(+), 100 deletions(-) diff --git a/README.md b/README.md index 5bfe455a..5fcbc097 100644 --- a/README.md +++ b/README.md @@ -130,65 +130,67 @@ Usage: zbox [command] Available Commands: - add Adds free storage assigner - alloc-cancel Cancel an allocation - alloc-fini Finalize an expired allocation - bl-info Get blobber info - bl-update Update blobber settings by its delegate_wallet owner - collect-reward Collect accrued rewards for a stake pool. - completion Generate the autocompletion script for the specified shell - copy copy an object(file/folder) to another folder on blobbers - cp-info Challenge pool information. - createdir Create directory - decrypt Decrypt text with passphrase - delete delete file from blobbers - download download file from blobbers - feed download segment files from remote live feed, and upload - get-diff Get difference of local and allocation root - get-download-cost Get downloading cost - get-mpt Directly view blockchain data - get-upload-cost Get uploading cost - getallocation Gets the allocation info - getwallet Get wallet information - help Help about any command - kill-blobber punitively deactivate a blobber - kill-validator punitively deactivate a validator - list list files from blobbers - list-all list all files from blobbers - listallocations List allocations for the client - ls-blobbers Show active blobbers in storage SC. - ls-validators Show active Validators. - meta get meta data of files from blobbers - move move an object(file/folder) to another folder on blobbers - newallocation Creates a new allocation - recent-refs get list of recently added refs - rename rename an object(file/folder) on blobbers - rp-create Create read pool if missing - rp-info Read pool information. - rp-lock Lock some tokens in read pool. - rp-unlock Unlock some expired tokens in a read pool. - sc-config Show storage SC configuration. - share share files from blobbers - shutdown-blobber deactivate a blobber - shutdown-validator deactivate a validator - sign-data Sign given data - sp-info Stake pool information. - sp-lock Lock tokens lacking in stake pool. - sp-unlock Unlock tokens in stake pool. - sp-user-info Stake pool information for a user. - start-repair start repair file to blobbers - stats stats for file from blobbers - stream capture video and audio streaming form local devices, and upload - sync Sync files to/from blobbers - transferallocation Transfer an allocation from one account to another - update update file to blobbers - updateallocation Updates allocation's expiry and size - upload upload file to blobbers - validator-info Get validator info - validator-update Update validator settings by its delegate_wallet owner - version Prints version information - wp-lock Lock some tokens in write pool. - wp-unlock Unlock some expired tokens in a write pool. + add Adds free storage assigner + alloc-cancel Cancel an allocation + alloc-fini Finalize an expired allocation + bl-info Get blobber info + bl-update Update blobber settings by its delegate_wallet owner + collect-reward Collect accrued rewards for a stake pool. + completion Generate the autocompletion script for the specified shell + copy copy an object(file/folder) to another folder on blobbers + cp-info Challenge pool information. + createdir Create directory + decrypt Decrypt text with passphrase + delete delete file from blobbers + download download file from blobbers + feed download segment files from remote live feed, and upload + get-diff Get difference of local and allocation root + get-download-cost Get downloading cost + get-mpt Directly view blockchain data + get-upload-cost Get uploading cost + getallocation Gets the allocation info + getwallet Get wallet information + help Help about any command + kill-blobber punitively deactivate a blobber + kill-validator punitively deactivate a validator + list list files from blobbers + list-all list all files from blobbers + listallocations List allocations for the client + ls-blobbers Show active blobbers in storage SC. + ls-validators Show active Validators. + meta get meta data of files from blobbers + move move an object(file/folder) to another folder on blobbers + newallocation Creates a new allocation + recent-refs get list of recently added refs + rename rename an object(file/folder) on blobbers + reset-blobber-stats Reset blobber stats + rollback rollback file to previous version + rp-create Create read pool if missing + rp-info Read pool information. + rp-lock Lock some tokens in read pool. + rp-unlock Unlock some expired tokens in a read pool. + sc-config Show storage SC configuration. + share share files from blobbers + shutdown-blobber deactivate a blobber + shutdown-validator deactivate a validator + sign-data Sign given data + sp-info Stake pool information. + sp-lock Lock tokens lacking in stake pool. + sp-unlock Unlock tokens in stake pool. + sp-user-info Stake pool information for a user. + start-repair start repair file to blobbers + stats stats for file from blobbers + stream capture video and audio streaming form local devices, and upload + sync Sync files to/from blobbers + transferallocation Transfer an allocation from one account to another + update update file to blobbers + updateallocation Updates allocation's expiry and size + upload upload file to blobbers + validator-info Get validator info + validator-update Update validator settings by its delegate_wallet owner + version Prints version information + wp-lock Lock some tokens in write pool. + wp-unlock Unlock some expired tokens in a write pool. Flags: --config string config file (default is config.yaml) @@ -196,11 +198,13 @@ Flags: --fee float transaction fee for the given transaction (if unset, it will be set to blockchain min fee) -h, --help help for zbox --network string network file to overwrite the network details (if required, default is network.yaml) - --silent Do not show interactive sdk logs (shown by default) + --silent (default false) Do not show interactive sdk logs (shown by default) --wallet string wallet file (default is wallet.json) --wallet_client_id string wallet client_id --wallet_client_key string wallet client_key --withNonce int nonce that will be used in transaction (default is 0) + +Use "zbox [command] --help" for more information about a command. ``` ### Global Flags @@ -1384,7 +1388,7 @@ Response: Response will give details for current selected wallet (or wallet file specified by optional --wallet parameter) -#### Get +#### Get Allocation Information Use `getallocation` command to get the information about the allocation such as total size , used size, number of challenges and challenges passed/failed/open/redeemed. @@ -1412,29 +1416,129 @@ Response: ``` allocation: - id: 8695b9e7f986d4a447b64de020ba86f53b3b5e2c442abceb6cd65742702067dc - tx: 026c9d331e9c93aee4f3247507c20bdd4b7429bd81d27845bfab83f9c9c082e6 (latest create/update allocation transaction hash) + id: 2813684263f6a28de4d1301255bba21c6cf9429cc02286b56ef38db7b068d8f1 + tx: 2813684263f6a28de4d1301255bba21c6cf9429cc02286b56ef38db7b068d8f1 (latest create/update allocation transaction hash) data_shards: 4 parity_shards: 2 - size: 6.0 GiB - expiration_date: 2021-05-24 00:27:23 +0700 +07 + size: 2.0 GiB + expiration_date: 2024-05-27 15:42:23 +0200 EET + third_party_extendable: false + file_options: 00111111 + write pool 1.000 ZCN blobbers: - - blobber_id: dea18e3f3c308666cb489877b9b2c7e2babf797d8b8c322fa9d074105787a9e9 - base URL: http://demo.zus.network:31304 - size: 1.0 GiB - min_lock_demand: 0.0012333333 - spent: 0.0000244839 (moved to challenge pool or to the blobber) - penalty: 0 (blobber stake slash) - read_reward: 0.000024414 - returned: 0.0000000233 (on challenge failed) - challenge_reward: 0 (on challenge passed) - final_reward: 0 (if finalized) + min_lock_demand: 0 % + - blobber_id: 6f895dfc20b5e55df6b3084eeb69ad604eb232e5853cf054983d7495bdbc9ed7 + base URL: https://dev1.zus.network/blobber02/ + size: 512.0 MiB + min_lock_demand: 0 SAS + spent: 0 SAS (moved to challenge pool or to the blobber) + penalty: 0 SAS (blobber stake slash) + read_reward: 0 SAS + returned: 0 SAS (on challenge failed) + challenge_reward: 0 SAS (on challenge passed) + final_reward: 0 SAS (if finalized) + terms: (allocation related terms) + read_price: 0 SAS / GB (by 64KB chunks) + write_price: 10.000 mZCN / GB + min_lock_demand: 0 SAS % + max_offer_duration: 0s + - blobber_id: 98f14362f075caf467653044cf046eb9e8a5dfee88dc8b78cad1891748245003 + base URL: https://dev1.zus.network/blobber01/ + size: 512.0 MiB + min_lock_demand: 0 SAS + spent: 0 SAS (moved to challenge pool or to the blobber) + penalty: 0 SAS (blobber stake slash) + read_reward: 0 SAS + returned: 0 SAS (on challenge failed) + challenge_reward: 0 SAS (on challenge passed) + final_reward: 0 SAS (if finalized) + terms: (allocation related terms) + read_price: 0 SAS / GB (by 64KB chunks) + write_price: 10.000 mZCN / GB + min_lock_demand: 0 SAS % + max_offer_duration: 0s + - blobber_id: 0e2fa9abc5a14231a1e7dc27b129480b732222e8e864d3b4e62d60a8b8ae617b + base URL: https://dev2.zus.network/blobber02/ + size: 512.0 MiB + min_lock_demand: 0 SAS + spent: 0 SAS (moved to challenge pool or to the blobber) + penalty: 0 SAS (blobber stake slash) + read_reward: 0 SAS + returned: 0 SAS (on challenge failed) + challenge_reward: 0 SAS (on challenge passed) + final_reward: 0 SAS (if finalized) + terms: (allocation related terms) + read_price: 0 SAS / GB (by 64KB chunks) + write_price: 10.000 mZCN / GB + min_lock_demand: 0 SAS % + max_offer_duration: 0s + - blobber_id: 06166f3dfd72a90cd0b51f4bd7520d4434552fc72880039b1ee1e8fe4b3cd7ea + base URL: https://dev2.zus.network/blobber01/ + size: 512.0 MiB + min_lock_demand: 0 SAS + spent: 0 SAS (moved to challenge pool or to the blobber) + penalty: 0 SAS (blobber stake slash) + read_reward: 0 SAS + returned: 0 SAS (on challenge failed) + challenge_reward: 0 SAS (on challenge passed) + final_reward: 0 SAS (if finalized) terms: (allocation related terms) - read_price: 0.0099999999 tok / GB (by 64KB chunks) - write_price: 0.0099999999 tok / GB - min_lock_demand: 10 % - max_offer_duration: 744h0m0s - challenge_completion_time: 2m0s + read_price: 0 SAS / GB (by 64KB chunks) + write_price: 10.000 mZCN / GB + min_lock_demand: 0 SAS % + max_offer_duration: 0s + - blobber_id: 5c61f8d3e63528dfe45db89a598bd5c42c71b3994f7639d4647268ba75269d9a + base URL: https://dev3.zus.network/blobber02/ + size: 512.0 MiB + min_lock_demand: 0 SAS + spent: 0 SAS (moved to challenge pool or to the blobber) + penalty: 0 SAS (blobber stake slash) + read_reward: 0 SAS + returned: 0 SAS (on challenge failed) + challenge_reward: 0 SAS (on challenge passed) + final_reward: 0 SAS (if finalized) + terms: (allocation related terms) + read_price: 0 SAS / GB (by 64KB chunks) + write_price: 10.000 mZCN / GB + min_lock_demand: 0 SAS % + max_offer_duration: 0s + - blobber_id: 8d19a8fd7147279d1dfdadd7e3ceecaf91c63ad940dae78731e7a64b104441a6 + base URL: https://dev3.zus.network/blobber01/ + size: 512.0 MiB + min_lock_demand: 0 SAS + spent: 0 SAS (moved to challenge pool or to the blobber) + penalty: 0 SAS (blobber stake slash) + read_reward: 0 SAS + returned: 0 SAS (on challenge failed) + challenge_reward: 0 SAS (on challenge passed) + final_reward: 0 SAS (if finalized) + terms: (allocation related terms) + read_price: 0 SAS / GB (by 64KB chunks) + write_price: 10.000 mZCN / GB + min_lock_demand: 0 SAS % + max_offer_duration: 0s + read_price_range: 0 SAS-0 SAS (requested) + write_price_range: 0 SAS-25.000 mZCN (requested) + challenge_completion_time: 0s (max) + start_time: 2024-04-27 15:42:23 +0200 EET + finalized: false + canceled: false + moved_to_challenge: 0 SAS + moved_back: 0 SAS + moved_to_validators: 0 SAS + stats: + total size: 2.0 GiB + used size: 0 B + number of writes: 0 + total challenges: 0 + passed challenges: 0 + failed challenges: 0 + open challenges: 0 + last challenge redeemed: + price: + time_unit: 720h0m0s + read_price: 0 SAS / GB (by 64KB) + write_price: 15.000 mZCN / GB / 720h0m0s ``` #### Get metadata @@ -1474,7 +1578,7 @@ Response: f | 1.txt | /1.txt | 20dc798b04ebab3015817c85d22aea64a52305bad6f7449acd3828c8d70c76a3 | 4 | application/octet-stream | 03cfd743661f07975fa2f1220c5194cbaff48451 ``` -**With authticket ** +**With authticket** ``` ./zbox meta --lookuphash 20dc798b04ebab3015817c85d22aea64a52305bad6f7449acd3828c8d70c76a3 --authticket eyJjbGllbnRfaWQiOiJiNmRlNTYyYjU3YTBiNTkzZDA0ODA2MjRmNzlhNTVlZDQ2ZGJhNTQ0NDA0NTk1YmVlMDI3MzE0NGUwMTAzNGFlIiwib3duZXJfaWQiOiJiNmRlNTYyYjU3YTBiNTkzZDA0ODA2MjRmNzlhNTVlZDQ2ZGJhNTQ0NDA0NTk1YmVlMDI3MzE0NGUwMTAzNGFlIiwiYWxsb2NhdGlvbl9pZCI6Ijg2OTViOWU3Zjk4NmQ0YTQ0N2I2NGRlMDIwYmE4NmY1M2IzYjVlMmM0NDJhYmNlYjZjZDY1NzQyNzAyMDY3ZGMiLCJmaWxlX3BhdGhfaGFzaCI6IjIwZGM3OThiMDRlYmFiMzAxNTgxN2M4NWQyMmFlYTY0YTUyMzA1YmFkNmY3NDQ5YWNkMzgyOGM4ZDcwYzc2YTMiLCJmaWxlX25hbWUiOiIxLnR4dCIsInJlZmVyZW5jZV90eXBlIjoiZiIsImV4cGlyYXRpb24iOjE2MjY0MjA1NzQsInRpbWVzdGFtcCI6MTYxODY0NDU3NCwicmVfZW5jcnlwdGlvbl9rZXkiOiJ7XCJyMVwiOlwiOUpnci9aVDh6VnpyME1BcWFidlczdnhoWEZoVkdMSGpzcVZtVUQ1QTJEOD1cIixcInIyXCI6XCIrVEk2Z1pST3JCR3ZURG9BNFlicmNWNXpoSjJ4a0I4VU5SNTlRckwrNUhZPVwiLFwicjNcIjpcInhySjR3bENuMWhqK2Q3RXU5TXNJRzVhNnEzRXVzSlZ4a2N6YXN1K0VqQW89XCJ9Iiwic2lnbmF0dXJlIjoiZTk3NTYyOTAyODU4OTBhY2QwYTcyMzljNTFhZjc0YThmNjU2OTFjOTUwMzRjOWM0ZDJlMTFkMTQ0MTk0NmExYSJ9 @@ -1491,6 +1595,20 @@ TYPE | NAME | LOOKUP HASH Response will be metadata for the given filepath/lookuphash (if using authTicket) +**For a directory** + +``` +./zbox meta --allocation 8695b9e7f986d4a447b64de020ba86f53b3b5e2c442abceb6cd65742702067dc --remotepath /files +``` + +Response: + +``` + TYPE | NAME | PATH | LOOKUP HASH +-------+-------+--------+------------------------------------------------------------------- + d | files | /files | 9184e5f2634bd7b2cdaec97de9c3eb8f60192640d5e6f32bb3271f094ef7cc7a +``` + #### Rename `rename` command renames a file existing already on dStorage. Only the @@ -1560,7 +1678,7 @@ Response: #### Repair -Use `start-repair` command to repair a file on dStorage. +Use `start-repair` command to repair an allocation. Sometimes, your operations on the allocation files may not be successful on some blobbers (since the consensus of the operations is `data_shards + 1`) leading to incosistency of the allocation data on its hosting blobbers. In such cases, you can use the repair command to repair the allocation. The repair command will repair the allocation by downloading the files from the blobbers with the latest version and re-uploading them to the blobbers that failed before. The repair command will also update the allocation metadata on the blobbers. Only the owner of the allocation can repair the allocation. ![repair](https://user-images.githubusercontent.com/65766301/120052600-b364c680-c043-11eb-9bf2-038ab244fed6.png) \ @@ -1730,12 +1848,14 @@ Use `collect-reward` to transfer reward tokens from a stake pool in which you ha invested to your wallet. You earn rewards for: + Blobbers - File space used by allocation owners and associates. - A min lock demand for each allocation. - Block rewards. Each block a reward gets paid out to blobber stakeholders in the form of a random lottery. - Validators + +Validators - Payment for validating blobber challenge responses. The stake pool keeps an account for all stakeholders to maintain accrued rewards. @@ -1743,7 +1863,7 @@ These rewards can be accessed using this `collect-reward` command. | Parameter | Required | Description | default | Valid values | | ------------- | -------- | -------------------- | ------- | ------------ | -| provider_type | no | blobber or validator | blobber | string | +| provider_type | no | blobber or validator | blobber | "blobber" \| "validator" | | provider_id | no | id of blobber or validator | | string | ```bash @@ -1849,17 +1969,25 @@ Use `sp-info` to get your stake pool information and settings. Sample Response : ```sh -pool id: 1c9e629b3f6c2c402c5b2979ba4d618f8645de5c0152312e5b8bfff44466e56e -balance: 0 SAS -total stake: 0 SAS +pool id: 98f14362f075caf467653044cf046eb9e8a5dfee88dc8b78cad1891748245003 +balance: 12.000 ZCN +total stake: 12.000 ZCN unclaimed rewards: 0 SAS total rewards: 0 SAS -delegate_pools: no delegate pools +delegate_pools: +- id: ba6ab426644f2b326b1da3dd426229fed19eed85387deaf72e05cb0fa4c5abbb + balance: 12.000 ZCN + delegate_id: ba6ab426644f2b326b1da3dd426229fed19eed85387deaf72e05cb0fa4c5abbb + unclaimed reward: 0 SAS + total_reward: 0 SAS + total_penalty: 0 SAS + status: active + round_created: 2074 + unstake: false + staked_at: 2024-04-27 16:29:47 +0200 EET settings: - delegate_wallet: 57da19ce71f8c28b21a2db84eb27cf91874d9ca5e04455d7ee364a757f4bf920 - min_stake: 0 SAS - max_stake: 0 SAS - num_delegates: 1 + delegate_wallet: fdaa2b74e666a3f609ea714a649d44edd9c46ff468e094b797e1811c533d0b2b + num_delegates: 50 ``` #### Lock tokens into stake pool @@ -1936,6 +2064,8 @@ To unstake validator tokens: ./zbox sp-unlock --validator_id --pool_id ``` +Same for the other providers. + #### Stake pools info of user Get information about all stake pools of current user. @@ -1959,6 +2089,22 @@ Get information about all stake pools of current user. ./zbox sp-user-info ``` +Sample Response : + +``` +- blobber_id: 98f14362f075caf467653044cf046eb9e8a5dfee88dc8b78cad1891748245003 + - id: ba6ab426644f2b326b1da3dd426229fed19eed85387deaf72e05cb0fa4c5abbb + balance: 12.000 ZCN + delegate_id: ba6ab426644f2b326b1da3dd426229fed19eed85387deaf72e05cb0fa4c5abbb + unclaimed reward: 0 SAS + total rewards: 0 SAS + total penalty: 0 SAS + status: active + round_created: 2074 + unstake: false + staked_at: 2024-04-27 16:29:47 +0200 EET +``` + #### Write pool info Write pool information. Use allocation id to filter results to a singe allocation. @@ -1997,10 +2143,10 @@ All tokens will be divided between allocation blobbers depending on their write - If the user does not have a pre-existing read pool, then the smart-contract creates one. -Anyone can lock tokens with a write pool attached an allocation. These tokens can +Anyone can lock tokens with a write pool attached to an allocation. These tokens can be used to pay for the allocation updates and min lock demand as needed. Any tokens moved into the challenge pool to underwrite blobbers' min lock demands return to the -allocation's owner on closing the allocation. +allocation's owner on closing the allocation either by cancelation or expiry. | Parameter | Required | Description | default | Valid values | | ------------- | -------- | --------------------------------- | ------- | ------------ | @@ -2013,6 +2159,7 @@ allocation's owner on closing the allocation. ```shell ./zbox wp-lock --allocation --tokens 1 +``` ![image](https://user-images.githubusercontent.com/6240686/123988183-b4c93c00-d9bf-11eb-825c-9a5849fedbbf.png) @@ -2021,9 +2168,6 @@ allocation's owner on closing the allocation.
wp-lock spread across all blobbers -Tokens are spread between the blobber pools weighted by -each blobber's Terms.ReadPrice. - ```shell ./zbox wp-lock --allocation --tokens 1 ``` @@ -2032,9 +2176,6 @@ each blobber's Terms.ReadPrice.
-``` -./zbox wp-lock --allocation --duration 40m --tokens 1 -``` #### Unlock tokens from write pool @@ -2076,6 +2217,7 @@ owner, collaborator, or using an auth ticket to determine the download cost of t ![image](https://user-images.githubusercontent.com/6240686/124497750-41ef0500-ddb3-11eb-99ea-115a4e234eda.png)
+ Command: ``` ./zbox get-download-cost --allocation --remotepath /path/file.ext From 9b89f5584875524c29b1822902f978d11b449166 Mon Sep 17 00:00:00 2001 From: Gaurboy's M3Pro Date: Mon, 29 Apr 2024 02:45:16 +0530 Subject: [PATCH 045/228] resolved all the comments --- README.md | 308 ++++++++++----------- cmd/add.go | 1 + cmd/fileRefs.go | 1 + cmd/getmpt.go | 1 + cmd/rolllback.go | 1 + cmd/storage.go | 1 + cmd/stream.go | 1 + cmd/sync.go | 2 + internal.md | 148 ++++++++++ zbox_commands.txt | 682 ++++++++++++++++++++++++++++++++++++++++++++++ 10 files changed, 981 insertions(+), 165 deletions(-) create mode 100644 internal.md create mode 100644 zbox_commands.txt diff --git a/README.md b/README.md index 5fcbc097..3d7a379d 100644 --- a/README.md +++ b/README.md @@ -26,14 +26,16 @@ zbox is a command line interface (CLI) tool to understand the capabilities of Z - [List all files](#list-all-files) - [List owner's allocations](#list-owners-allocations) - [Update blobber settings](#update-blobber-settings) - - [Update Validator Settings](#update-validator-settings) + - [Update Validator Settings](#update-validator-settings) - [List All Validators](#list-all-validators) - [Get Validator Configuration](#get-validator-configuration) + - [Shutdown Blobber](#shutdown-blobber) + - [Shutdown Validator](#shutdown-validator) - [Kill Blobber](#kill-blobber) - [Kill Validator](#kill-validator) - [Uploading and Managing files](#uploading-and-managing-files) + - [Create Directory](#create-directory) - [Upload](#upload) - - [Stream](#stream) - [Feed](#feed) - [Download](#download) - [Update](#update) @@ -43,14 +45,13 @@ zbox is a command line interface (CLI) tool to understand the capabilities of Z - [List](#list) - [Copy](#copy) - [Move](#move) - - [Sync](#sync) - - [Get differences](#get-differences) - [Get wallet](#get-wallet) - [Get](#get) - [Get metadata](#get-metadata) - [Rename](#rename) - [Stats](#stats) - [Repair](#repair) + - [Decrypt](#decrypt) - [Sign data](#sign-data) - [Streaming](#streaming) - [How it works:](#how-it-works) @@ -130,7 +131,6 @@ Usage: zbox [command] Available Commands: - add Adds free storage assigner alloc-cancel Cancel an allocation alloc-fini Finalize an expired allocation bl-info Get blobber info @@ -144,9 +144,7 @@ Available Commands: delete delete file from blobbers download download file from blobbers feed download segment files from remote live feed, and upload - get-diff Get difference of local and allocation root get-download-cost Get downloading cost - get-mpt Directly view blockchain data get-upload-cost Get uploading cost getallocation Gets the allocation info getwallet Get wallet information @@ -161,10 +159,7 @@ Available Commands: meta get meta data of files from blobbers move move an object(file/folder) to another folder on blobbers newallocation Creates a new allocation - recent-refs get list of recently added refs rename rename an object(file/folder) on blobbers - reset-blobber-stats Reset blobber stats - rollback rollback file to previous version rp-create Create read pool if missing rp-info Read pool information. rp-lock Lock some tokens in read pool. @@ -180,7 +175,6 @@ Available Commands: sp-user-info Stake pool information for a user. start-repair start repair file to blobbers stats stats for file from blobbers - stream capture video and audio streaming form local devices, and upload sync Sync files to/from blobbers transferallocation Transfer an allocation from one account to another update update file to blobbers @@ -444,11 +438,11 @@ Here are the operations: Here is a sample command for --forbid_upload .Other parameters can be done the same way. -``` +```sh ./zbox updateallocation --allocation $ALLOC --forbid_upload ``` Sample Response : -``` +```sh Allocation Updated with txID : b84185dae620bbba8386286726f1efcd20d2516bcf1a448215434d87be3b30d ``` To test functionality try uploading file to allocation. You should get the following response : @@ -478,9 +472,13 @@ Cancelling an allocation can only occur if the amount of failed challenges excee Example -``` +```sh ./zbox alloc-cancel --allocation ``` +Sample Response : +```sh +Allocation canceled with txId : 501df5a8e2a6b8ebced1d1e7dc4ed17f653012dd49834801b4413786ec031cd2 +``` #### Finalise allocation @@ -507,9 +505,15 @@ An allocation can be finalised by the owner or one of the allocation blobbers. Example -``` +```sh ./zbox alloc-fini --allocation ``` + +Sample Response: + +```sh +Allocation finalized with txId : 2a6c031ced1d1e7dc4ed17801b4413786ecd2501df5ab8ebf653012dd498348e +``` #### List blobbers Use `ls-blobbers` command to show active blobbers. @@ -600,10 +604,16 @@ settings: | ---------- | -------- | ---------------------------------------------- | ------- | ------------ | | allocation | yes | allocation id, sender must be allocation owner | | string | -```shell +Sample Request : +```sh ./zbox list-all --allocation 4ebeb69feeaeb3cd308570321981d61beea55db65cbeba4ba3b75c173c0f141b ``` +Sample Response : +```sh +[{"size":0,"mimetype":"","actual_size":0,"hash":"","type":"d","encrypted_key":"","lookup_hash":"55e45925760e33f113642569a539e17a531285d2bf53dc78fde954017c8b27b3","created_at":1714335152,"updated_at":1714335152,"name":"abcd","path":"/abcd"}] +``` + #### List owner's allocations `listallocations` provides a list of all allocations owned by the user. @@ -657,20 +667,43 @@ Example Update blobber read price -``` +```sh ./zbox bl-update --blobber_id 0ece681f6b00221c5567865b56040eaab23795a843ed629ce71fb340a5566ba3 --read_price 0.1 ``` -Get Version +#### Update validator settings -The version of Zbox and Gosdk can be fetched using the ./zbox version command. +Use `./zbox validator-update ` to update a validator's configuration settings. This updates the settings +on the blockchain not the validator. + +| Parameter | Required | Description | default | Valid values | +| ------------------ | -------- | ----------------------------------------- | ------- | ------------ | +| validator_id | yes | id of validator of which to update settings | | string | +| max_stake | no | update maximum stake | | float | +| min_stake | no | update minimum stake | | float | +| num_delegates | no | update maximum number of delegates | | int | +| service_charge | no | update service charge | | float | +
+ validator-update + +Example + +Update validator service charge +```sh +./zbox validator-update --validator_id 0ece681f6b00221c5567865b56040eaab23795a843ed629ce71fb340a5566ba3 --service_charge 0.1 ``` + +#### Get Version + +The version of Zbox and Gosdk can be fetched using the ./zbox version command. + +```sh ./zbox version ``` Sample Response: -``` +```sh zbox....: v1.4.3 gosdk...: v1.8.14 ``` @@ -680,7 +713,7 @@ gosdk...: v1.8.14 List all active validators on the network Command: -``` +```sh ./zbox ls-validators ``` @@ -690,7 +723,7 @@ Command: | --json | no | Print Response as json data Response : -``` +```sh id: b9f4f244e2e483548795e42dad0c5b5bb8f5c25d70cadeafc202ce6011b7ff8c url: https://demo.zus.network/validator03/ settings: @@ -719,11 +752,11 @@ settings: | --json | optional | Print Response as json data Sample Command : -``` +```sh ./zbox validator-info --validator_id f82ab34a98406b8757f11513361752bab9cb679a5cb130b81 ``` Sample Response : -``` +```sh id: f82ab34a98406b8757f11513361752bab9cb679a5cb130b81a4e86cec50eefc3 url: https://demo2.zus.network/validator01 last_health_check: 2023-05-12 20:09:15 +0530 IST @@ -738,6 +771,45 @@ settings: num_delegates: 50 service_charge: 10 % ``` + +#### Shutdown Blobber +`./zbox shutdown-blobber` command deactivates a blobber to avoid storage of data . Required parameters are : + +| Parameter | Required | Description +| ------------------ | -------- | ----------------------------------------- +| --id | yes | Blobber Id to kill a specific blobber.Can be retrieved using [List blobbers](#list-blobbers). +| --fee | no | fee for transaction + + Sample Command : +```sh +./zbox shutdown-blobber --id $BLOBBER_ID --wallet $CHAIN_OWNER_WALLET +``` +Note : Shutdown Blobber command should be evoked from chain owner wallet only + +Sample Response : +```sh +shutdown blobber $BLOBBER_ID with txId : 2a6c031ced1d1e7dc4ed17801b4413786ecd2501df5ab8ebf653012dd498348e +``` + +#### Shutdown Validator +`./zbox shutdown-validator` command deactivates a validator. Required parameters are : + +| Parameter | Required | Description +| ------------------ | -------- | ----------------------------------------- +| --id | yes | Validator Id to kill a specific validator.Can be retrieved using [List all Validators](#list-all-validators). +| --fee | no | fee for transaction + + Sample Command : +```sh +./zbox shutdown-validator --id $VALIDATOR_ID --wallet $CHAIN_OWNER_WALLET +``` +Note : Shutdown Validator command should be evoked from chain owner wallet only + +Sample Response : +```sh +shutdown validator $VALIDATOR_ID with txId : 2a6c031ced1d1e7dc4ed17801b4413786ecd2501df5ab8ebf653012dd498348e +``` + #### Kill Blobber `./zbox kill-blobber` command deactivates a blobber to avoid storage of data . Required parameters are : @@ -766,15 +838,36 @@ killed blobber $BLOBBER_ID Sample Command : -``` +```sh ./zbox kill-validator --id $VALIDATOR_ID --wallet $CHAIN_OWNER_WALLET ``` Sample Response : -``` +```sh killed validator, id: $VALIDATOR_ID ``` ### Uploading and Managing files +#### Create Directory + +Use `createdir` command to create a directory in the specified allocation + +The user must be the owner of the allocation. + +| Parameter | Required | Description | Default | Valid values | +| ------------- | -------- | ------------------------------------------------------- | ------- | ------------ | +| allocation | yes | allocation id, sender must be allocation owner | | string | +| dirname | yes | path to directory | | string | + +Sample Request : +```sh +./zbox createdir --allocation {ALLOC_ID} --dirname /abcd/ +``` + +Sample Response : +```sh +/abcd/ directory created +``` + #### Upload Use `upload` command to upload file(s). @@ -852,30 +945,6 @@ Response: Status completed callback. Type = video/fmp4. Name = raw.samplevideo.mp4 ``` -#### Stream - -Use `stream` to capture video and audio streaming form local devices, and upload - -The user must be the owner of the allocation.You can request the file be encrypted before upload, and can send thumbnails with the file. - -| Parameter | Required | Description | Default | Valid values | -| ------------- | -------- | ------------------------------------------------------------ | ------- | ------------ | -| allocation | yes | allocation id, sender must be allocation owner | | string | -| encrypt | no | encrypt file before upload | false | boolean | -| localpath | yes | local path of segment files to download, generate and upload | | file path | -| remotepath | yes | remote path to upload file to, use to access file later | | string | -| thumbnailpath | no | local path of thumbnaSil | | file path | -| chunknumber | no | how many chunks should be uploaded in a http request | 1 | int | -| delay | no | set segment duration to seconds. | 5 | int | -| attr-who-pays-for-reads | no | Who pays for reads: owner or 3rd_party | owner | owner / 3rd_party| - -
- stream - -![image](https://github.com/0chain/blobber/wiki/uml/usecase/live_upload_live.png) - -
- #### Feed Use `feed` command to automatically download segment files from remote live feed with `--downloader-args "-q -f best"` @@ -1017,6 +1086,16 @@ can update a file. To add collaborators to an allocation, use
+Sample Command : +```sh +./zbox update --allocation {ALLOC_ID} --localpath ./zbox_commands.txt --remotepath /abcd/ --encrypt +``` + +Sample Response : +```sh +Status completed callback. Type = application/octet-stream. Name = zbox_commands.txt +``` + #### Delete Use `delete` command to delete your file on the allocation. Only the owner @@ -1283,86 +1362,6 @@ Response: /file.txt moved ``` -#### Sync - -`sync` command syncs all files from the local folder recursively to the remote. -Only the allocation's owner can successfully run `sync`. - -| Parameter | Required | Description | default | Valid values | -| ----------- | -------- | --------------------------------------------------------------------------------------------- | ------- | ------------ | -| allocation | yes | allocation id | | string | -| encryptpath | no | local directory path to be uploaded as encrypted | false | boolean | -| excludepath | no | paths to exclude from sync | | string array | -| localchache | no | local chache of remote snapshot. Used for comparsion with remote. After sync will be updated. | | string | -| localpath | yes | local directory to which to sync | | file path | -| uploadonly | no | only upload and update files | false | boolean | -| chunknumber | no | how many chunks should be uploaded in a http request | | int | -| remotepath | no | Remote dir path from where it sync | "/" | string | -| verifydownload | no | how many chunks should be uploaded in a http request | true | boolean | - -
- sync - -![image](https://user-images.githubusercontent.com/6240686/127884376-a95c4f27-4b2a-4d9b-91b6-c7e7919f88bc.png) - -
- -Example - -``` -./zbox sync --allocation 8695b9e7f986d4a447b64de020ba86f53b3b5e2c442abceb6cd65742702067dc --localpath /home/dung/Desktop/alloc --localcache /home/dung/Desktop/localcache.json -``` - -Response: - -``` - OPERATION | PATH -+-----------+----------------+ - Download | /1.txt - Download | /afolder/1.txt - Download | /d2.txt - - 4 / 4 [===========================================================================] 100.00% 0s -Status completed callback. Type = application/octet-stream. Name = 1.txt - 4 / 4 [===========================================================================] 100.00% 0s -Status completed callback. Type = application/octet-stream. Name = 1.txt - 7 / 7 [===========================================================================] 100.00% 0s -Status completed callback. Type = application/octet-stream. Name = d2.txt - -Sync Complete -Local cache saved. -``` - -It will sync your localpath with the remote and do all the required CRUD operations. - -#### Get differences - -`./zbox get-diff` command returns the differences between the local files specified by `localpath` and the files stored -on the root remotepath of the allocation.`localcache` flag can also be specified to use the local cache of remote snapshot created during [Sync](#sync) for file comparison. - -| Parameter | Required | Description | default | Valid values | -| ----------- | -------- | --------------------------------------------- | ------- | ------------ | -| allocation | yes | allocation id | | string | -| excludepath | no | remote folder paths to exclude during syncing | | string array | -| localcache | no | local cache of remote snapshot | | string | -| localpath | yes | local directory to sync | | string | - -Example - -``` -./zbox get-diff --allocation $ALLOC --localpath $local -``` - -Response: - -``` -[{"operation":"Upload","path":"/file1.txt","type":"f","attributes":{}}, -{"operation":"Upload","path":"/file2.txt","type":"f","attributes":{}}, -{"operation":"Upload","path":"/file3.txt","type":"f","attributes":{}}, -{"operation":"Download","path":"/myfiles/file1.txt","type":"f","attributes":{}}, -{"operation":"Download","path":"/myfiles/file2.txt","type":"f","attributes":{}}] -``` - #### Get wallet Use `getwallet` command to get additional wallet information including Encryption @@ -1707,6 +1706,19 @@ Response: Repair file completed, Total files repaired: 0 ``` +#### Decrypt + +`decrypt` is used to decrypt data with a passphrase + +| Parameter | Required | Description | default | Valid values | +| --------- | -------- | -------------- | ------- | ------------ | +| text | yes | string to decrypt | | string | +| passphrase | yes | passphrase to use to decrypt | | string | + +```sh +./zbox decrypt --text {encryted_data} --passphrase {passphrase} +``` + #### Sign data `sign-data` uses the information from your wallet to sign the input data string @@ -1715,7 +1727,7 @@ Repair file completed, Total files repaired: 0 | --------- | -------- | -------------- | ------- | ------------ | | data | yes | string to sign | | string | -```shell +```sh ./zbox sign-data "data to sign" Signature : 9432ab2ee602062afaf48c4016b373a65db48a8546a81c09dead40e54966399e ``` @@ -1786,12 +1798,6 @@ Status completed callback. Type = audio/mpeg. Name = audio.mp3 As we can see, the downloaded file size(393216) is less than the original(2996198), which means zbox has downloaded some blocks of the file. - - - - - - ### Lock and Unlock Tokens #### Challenge pool information @@ -2105,34 +2111,6 @@ Sample Response : staked_at: 2024-04-27 16:29:47 +0200 EET ``` -#### Write pool info - -Write pool information. Use allocation id to filter results to a singe allocation. - -| Parameter | Required | Description | default | Valid values | -| ------------- | -------- | --------------------------- | ------- | ------------ | -| allocation id | no | allocation id | | string | -| json | no | print result in json format | false | boolean | - -
- wp-info - -![image](https://user-images.githubusercontent.com/6240686/124603444-d9ab2c80-de61-11eb-82f2-900d540ba63f.png) - -
- -For all write pools. - -``` -./zbox wp-info -``` - -Filtering by allocation. - -``` -./zbox wp-info --allocation -``` - #### Lock tokens into write pool `wp-lock` can be used to lock tokens in a write pool associated with an allocation. diff --git a/cmd/add.go b/cmd/add.go index 6bf51887..917d1e55 100644 --- a/cmd/add.go +++ b/cmd/add.go @@ -12,6 +12,7 @@ var addCmd = &cobra.Command{ Short: "Adds free storage assigner", Long: "Adds free storage assigner", Args: cobra.MinimumNArgs(0), + Hidden: true, Run: func(cmd *cobra.Command, args []string) { var err error var flags = cmd.Flags() diff --git a/cmd/fileRefs.go b/cmd/fileRefs.go index 61d4f3b4..d63b19f0 100644 --- a/cmd/fileRefs.go +++ b/cmd/fileRefs.go @@ -29,6 +29,7 @@ var fileRefsCmd = &cobra.Command{ Short: "get list of recently added refs", Long: `get list of recently added refs`, Args: cobra.MinimumNArgs(0), + Hidden: true, Run: func(cmd *cobra.Command, args []string) { page, err := cmd.Flags().GetUint("page") checkError(err) diff --git a/cmd/getmpt.go b/cmd/getmpt.go index 5328325f..1799e442 100644 --- a/cmd/getmpt.go +++ b/cmd/getmpt.go @@ -16,6 +16,7 @@ var getMptKeyCommand = &cobra.Command{ Short: "Directly view blockchain data", Long: `Directly view blockchain data from MPT key`, Args: cobra.MinimumNArgs(0), + Hidden: true, Run: func(cmd *cobra.Command, args []string) { if cmd.Flags().Changed("key") == false { log.Fatal("Required Mpt key missing\n") diff --git a/cmd/rolllback.go b/cmd/rolllback.go index 6d32c414..b620757b 100644 --- a/cmd/rolllback.go +++ b/cmd/rolllback.go @@ -14,6 +14,7 @@ var rollbackCmd = &cobra.Command{ Short: "rollback file to previous version", Long: `rollback file to previous version`, Args: cobra.MinimumNArgs(0), + Hidden: true, Run: func(cmd *cobra.Command, args []string) { fflags := cmd.Flags() if !fflags.Changed("allocation") { diff --git a/cmd/storage.go b/cmd/storage.go index e3a8a097..7da2cf4a 100644 --- a/cmd/storage.go +++ b/cmd/storage.go @@ -294,6 +294,7 @@ var resetBlobberStatsCmd = &cobra.Command{ Short: "Reset blobber stats", Long: `Reset blobber stats`, Args: cobra.MinimumNArgs(0), + Hidden: true, Run: func(cmd *cobra.Command, args []string) { var ( flags = cmd.Flags() diff --git a/cmd/stream.go b/cmd/stream.go index d5550395..2212d74f 100644 --- a/cmd/stream.go +++ b/cmd/stream.go @@ -16,6 +16,7 @@ var streamCmd = &cobra.Command{ Short: "capture video and audio streaming form local devices, and upload", Long: "capture video and audio streaming form local devices, and upload", Args: cobra.MinimumNArgs(0), + Hidden: true, Run: func(cmd *cobra.Command, args []string) { fflags := cmd.Flags() // fflags is a *flag.FlagSet if !fflags.Changed("allocation") { // check if the flag "path" is set diff --git a/cmd/sync.go b/cmd/sync.go index a013815b..6c4bf64c 100644 --- a/cmd/sync.go +++ b/cmd/sync.go @@ -152,6 +152,7 @@ var syncCmd = &cobra.Command{ Short: "Sync files to/from blobbers", Long: `Sync all files to/from blobbers from/to a localpath`, Args: cobra.MinimumNArgs(0), + Hidden: true, Run: func(cmd *cobra.Command, args []string) { fflags := cmd.Flags() // fflags is a *flag.FlagSet if fflags.Changed("localpath") == false { @@ -333,6 +334,7 @@ var getDiffCmd = &cobra.Command{ Short: "Get difference of local and allocation root", Long: `Get difference of local and allocation root`, Args: cobra.MinimumNArgs(0), + Hidden: true, Run: func(cmd *cobra.Command, args []string) { fflags := cmd.Flags() // fflags is a *flag.FlagSet diff --git a/internal.md b/internal.md new file mode 100644 index 00000000..9169947b --- /dev/null +++ b/internal.md @@ -0,0 +1,148 @@ +Contents : +[Sync](#sync) +[Get Differences](#get-differences) +[Stream](#stream) +[Get MPT](#get-mpt) +[Rollback Allocation](#rollback-allocation) + +#### Sync + +`sync` command syncs all files from the local folder recursively to the remote. +Only the allocation's owner can successfully run `sync`. + +| Parameter | Required | Description | default | Valid values | +| ----------- | -------- | --------------------------------------------------------------------------------------------- | ------- | ------------ | +| allocation | yes | allocation id | | string | +| encryptpath | no | local directory path to be uploaded as encrypted | false | boolean | +| excludepath | no | paths to exclude from sync | | string array | +| localchache | no | local chache of remote snapshot. Used for comparsion with remote. After sync will be updated. | | string | +| localpath | yes | local directory to which to sync | | file path | +| uploadonly | no | only upload and update files | false | boolean | +| chunknumber | no | how many chunks should be uploaded in a http request | | int | +| remotepath | no | Remote dir path from where it sync | "/" | string | +| verifydownload | no | how many chunks should be uploaded in a http request | true | boolean | + +
+ sync + +![image](https://user-images.githubusercontent.com/6240686/127884376-a95c4f27-4b2a-4d9b-91b6-c7e7919f88bc.png) + +
+ +Example + +``` +./zbox sync --allocation 8695b9e7f986d4a447b64de020ba86f53b3b5e2c442abceb6cd65742702067dc --localpath /home/dung/Desktop/alloc --localcache /home/dung/Desktop/localcache.json +``` + +Response: + +``` + OPERATION | PATH ++-----------+----------------+ + Download | /1.txt + Download | /afolder/1.txt + Download | /d2.txt + + 4 / 4 [===========================================================================] 100.00% 0s +Status completed callback. Type = application/octet-stream. Name = 1.txt + 4 / 4 [===========================================================================] 100.00% 0s +Status completed callback. Type = application/octet-stream. Name = 1.txt + 7 / 7 [===========================================================================] 100.00% 0s +Status completed callback. Type = application/octet-stream. Name = d2.txt + +Sync Complete +Local cache saved. +``` + +It will sync your localpath with the remote and do all the required CRUD operations. + + +#### Get differences + +`get-diff` command returns the differences between the local files specified by `localpath` and the files stored +on the root remotepath of the allocation.`localcache` flag can also be specified to use the local cache of remote snapshot created during [Sync](#sync) for file comparison. + +| Parameter | Required | Description | default | Valid values | +| ----------- | -------- | --------------------------------------------- | ------- | ------------ | +| allocation | yes | allocation id | | string | +| excludepath | no | remote folder paths to exclude during syncing | | string array | +| localcache | no | local cache of remote snapshot | | string | +| localpath | yes | local directory to sync | | string | + +Example + +```sh +./zbox get-diff --allocation $ALLOC --localpath $local +``` + +Response: + +```sh +[{"operation":"Upload","path":"/file1.txt","type":"f","attributes":{}}, +{"operation":"Upload","path":"/file2.txt","type":"f","attributes":{}}, +{"operation":"Upload","path":"/file3.txt","type":"f","attributes":{}}, +{"operation":"Download","path":"/myfiles/file1.txt","type":"f","attributes":{}}, +{"operation":"Download","path":"/myfiles/file2.txt","type":"f","attributes":{}}] +``` + +#### Stream + +Use `stream` to capture video and audio streaming form local devices, and upload + +The user must be the owner of the allocation.You can request the file be encrypted before upload, and can send thumbnails with the file. + +| Parameter | Required | Description | Default | Valid values | +| ------------- | -------- | ------------------------------------------------------------ | ------- | ------------ | +| allocation | yes | allocation id, sender must be allocation owner | | string | +| encrypt | no | encrypt file before upload | false | boolean | +| localpath | yes | local path of segment files to download, generate and upload | | file path | +| remotepath | yes | remote path to upload file to, use to access file later | | string | +| thumbnailpath | no | local path of thumbnaSil | | file path | +| chunknumber | no | how many chunks should be uploaded in a http request | 1 | int | +| delay | no | set segment duration to seconds. | 5 | int | +| attr-who-pays-for-reads | no | Who pays for reads: owner or 3rd_party | owner | owner / 3rd_party| + +
+ stream + +![image](https://github.com/0chain/blobber/wiki/uml/usecase/live_upload_live.png) + +
+ + +#### Get MPT + +`get-mpt` is used to directly get blockchain data from the MPT key + +| Parameter | Required | Description | default | Valid values | +| --------- | -------- | -------------- | ------- | ------------ | +| key | yes | Key in MPT datastore | | string | + +Sample Command : +```sh +./zbox get-mpt --key {MPT_KEY} +``` + +Sample Response : +```sh + +``` + +#### Rollback Allocation + +`rollback` is used to directly get blockchain data from the MPT key + +| Parameter | Required | Description | default | Valid values | +| --------- | -------- | -------------- | ------- | ------------ | +| allocation | yes | Allocation ID | | string | + +Sample Command : +```sh +./zbox rollback --allocation $ALLOC +``` + +Sample Response : +```sh +Rollback successful +``` diff --git a/zbox_commands.txt b/zbox_commands.txt new file mode 100644 index 00000000..4d6f7b4f --- /dev/null +++ b/zbox_commands.txt @@ -0,0 +1,682 @@ +Usage: zbox + +Short: zbox is a decentralized storage application written on the 0Chain platform +Long: zbox is a decentralized storage application written on the 0Chain platform. + Complete documentation is available at https://docs.zus.network/guides/zbox-cli + +LocalFlags: +-c, --config config file (default is config.yaml) +-c, --configDir configuration directory (default is $HOME/.zcn) +-f, --fee transaction fee for the given transaction (if unset, it will be set to blockchain min fee) +-n, --network network file to overwrite the network details (if required, default is network.yaml) +-s, --silent (default false) Do not show interactive sdk logs (shown by default) +-w, --wallet wallet file (default is wallet.json) +-w, --wallet_client_id wallet client_id +-w, --wallet_client_key wallet client_key +-w, --withNonce nonce that will be used in transaction (default is 0) + +Subcommands: +Usage: add + +Short: Adds free storage assigner +Long: Adds free storage assigner + +LocalFlags: +-k, --key the public key used for singing markers +-l, --limit maximum number of tokens to use in a free allocation +-m, --max the total number of tokens that can be given in free allocations +-n, --name the account number that will be creating free storage markers + +Usage: alloc-cancel + +Short: Cancel an allocation +Long: Cancel allocation used to terminate an allocation where, because +of blobbers, it can't be used. Thus, the blobbers will not receive their +min_lock_demand. Other aspects of the cancellation follows the finalize +allocation flow. + +LocalFlags: +-a, --allocation Allocation ID + +Usage: alloc-fini + +Short: Finalize an expired allocation +Long: Finalize an expired allocation by allocation owner or one of +blobbers of the allocation. It moves all tokens have to be moved between pools +and empties write pool moving left tokens to client. + +LocalFlags: +-a, --allocation Allocation ID + +Usage: bl-info + +Short: Get blobber info +Long: Get blobber info + +LocalFlags: +-b, --blobber_id blobber ID, required +-j, --json (default false) pass this option to print response as json data + +Usage: bl-update + +Short: Update blobber settings by its delegate_wallet owner +Long: Update blobber settings by its delegate_wallet owner + +LocalFlags: +-b, --blobber_id blobber ID, required +-c, --capacity update blobber capacity bid, optional +-i, --is_restricted (default false) set is_restricted +-m, --max_offer_duration update max_offer_duration, optional +-m, --max_stake update max_stake, optional +-m, --min_stake update min_stake, optional +-n, --not_available (default false) set blobber's availability for new allocations +-n, --num_delegates update num_delegates, optional +-r, --read_price update read_price, optional +-s, --service_charge update service_charge, optional +-u, --url update the url of the blobber, optional +-w, --write_price update write_price, optional + +Usage: collect-reward + +Short: Collect accrued rewards for a stake pool. +Long: Collect accrued rewards for a stake pool. + +LocalFlags: +-p, --provider_id blobber or validator id +-p, --provider_type provider type + +Usage: copy + +Short: copy an object(file/folder) to another folder on blobbers +Long: copy an object to another folder on blobbers + +LocalFlags: +-a, --allocation Allocation ID +-d, --destpath Destination path for the object. Existing directory the object should be copied to +-r, --remotepath Remote path of object to copy + +Usage: cp-info + +Short: Challenge pool information. +Long: Challenge pool information. + +LocalFlags: +-a, --allocation allocation identifier, required +-j, --json (default false) pass this option to print response as json data + +Usage: createdir + +Short: Create directory +Long: Create directory + +LocalFlags: +-a, --allocation Allocation ID +-d, --dirname New directory name + +Usage: decrypt + +Short: Decrypt text with passphrase +Long: Decrypt text with passphrase + +LocalFlags: +-p, --passphrase Passphrase to decrypt text +-t, --text Encrypted text + +Usage: delete + +Short: delete file from blobbers +Long: delete file from blobbers + +LocalFlags: +-a, --allocation Allocation ID +-r, --remotepath Remote path of the object to delete + +Usage: download + +Short: download file from blobbers +Long: download file from blobbers + +LocalFlags: +-a, --allocation Allocation ID +-a, --authticket Auth ticket fot the file to download if you dont own it +-b, --blockspermarker pass this option to download multiple blocks per marker +-d, --delay pass segment duration to generate media playlist(m3u8). only works with --live. default duration is 5s. +-e, --endblock pass this option to download till specific block number +-l, --live (default false) start m3u8 downloader,and automatically generate media playlist(m3u8) on --localpath +-l, --localpath Local path of file to download +-l, --lookuphash The remote lookuphash of the object retrieved from the list +-m, --multidownloadjson A JSON file containing multi download options +-r, --remotepath Remote path to download +-s, --startblock Pass this option to download from specific block number. It should not be less than 1 +-t, --thumbnail (default false) pass this option to download only the thumbnail +-v, --verifydownload (default false) pass this option to verify downloaded blocks + +Usage: feed + +Short: download segment files from remote live feed, and upload +Long: download segment files from remote live feed, and upload + +LocalFlags: +-a, --allocation Allocation ID +-a, --attr-who-pays-for-reads Who pays for reads: owner or 3rd_party +-c, --chunknumber how many chunks should be uploaded in a http request +-d, --delay set segment duration to seconds. +-d, --downloader-args pass args to youtube-dl to download video. default is "-q". +-e, --encrypt (default false) pass this option to encrypt and upload the file +-f, --feed set remote live feed to url. +-f, --ffmpeg-args pass args to ffmpeg to build segments. default is "-loglevel warning". +-l, --localpath Local path of file to upload +-r, --remotepath Remote path to upload +-t, --thumbnailpath Local thumbnail path of file to upload + +Usage: get-diff + +Short: Get difference of local and allocation root +Long: Get difference of local and allocation root + +LocalFlags: +-a, --allocation Allocation ID +-e, --excludepath Remote folder paths exclude to sync +-l, --localcache Local cache of remote snapshot. +If file exists, this will be used for comparison with remote. +After sync complete, remote snapshot will be updated to the same file for next use. +-l, --localpath Local dir path to sync + +Usage: get-download-cost + +Short: Get downloading cost +Long: Get downloading cost + +LocalFlags: +-a, --allocation allocation ID, required +-a, --authticket authticket +-b, --blocks-per-marker blocks signed per Read Marker +-l, --lookuphash lookuphash, for the remote file +-r, --remotepath remote path of file + +Usage: get-mpt + +Short: Directly view blockchain data +Long: Directly view blockchain data from MPT key + +LocalFlags: +-k, --key Key into MPT datastore + +Usage: get-upload-cost + +Short: Get uploading cost +Long: Get uploading cost + +LocalFlags: +-a, --allocation allocation ID, required +-d, --duration expected duration keep uploaded file +-e, --end (default false) use the duration until allocation ends +-l, --localpath local file path, required + +Usage: getallocation + +Short: Gets the allocation info +Long: Gets the allocation info + +LocalFlags: +-a, --allocation Allocation ID +-b, --blocks-per-marker blocks signed per Read Marker +-j, --json (default false) pass this option to print response as json data + +Usage: getwallet + +Short: Get wallet information +Long: Get wallet information + +LocalFlags: +-j, --json (default false) pass this option to print response as json data + +Usage: kill-blobber + +Short: punitively deactivate a blobber +Long: punitively deactivate a blobber + +LocalFlags: +-i, --id blobber's id + +Usage: kill-validator + +Short: punitively deactivate a validator +Long: punitively deactivate a validator + +LocalFlags: +-i, --id validator's id + +Usage: list + +Short: list files from blobbers +Long: list files from blobbers + +LocalFlags: +-a, --allocation Allocation ID +-a, --authticket Auth ticket fot the file to download if you dont own it +-j, --json (default false) pass this option to print response as json data +-l, --lookuphash The remote lookuphash of the object retrieved from the list +-r, --remotepath Remote path to list from + +Usage: list-all + +Short: list all files from blobbers +Long: list all files from blobbers + +LocalFlags: +-a, --allocation Allocation ID + +Usage: listallocations + +Short: List allocations for the client +Long: List allocations for the client + +LocalFlags: +-j, --json (default false) pass this option to print response as json data + +Usage: ls-blobbers + +Short: Show active blobbers in storage SC. +Long: Show active blobbers in storage SC. + +LocalFlags: +-a, --all (default false) shows active and non active list of blobbers on ls-blobbers +-j, --json (default false) pass this option to print response as json data +-s, --stakable (default false) gets only stakable list of blobbers if set to true + +Usage: ls-validators + +Short: Show active Validators. +Long: Show active Validators in the network. + +LocalFlags: +-j, --json (default false) pass this flag to get response as json object +-s, --stakable (default false) Gets only validators that can be staked if set to true + +Usage: meta + +Short: get meta data of files from blobbers +Long: get meta data of files from blobbers + +LocalFlags: +-a, --allocation Allocation ID +-a, --authticket Auth ticket fot the file to download if you dont own it +-j, --json (default false) pass this option to print response as json data +-l, --lookuphash The remote lookuphash of the object retrieved from the list +-r, --remotepath Remote path to list from + +Usage: move + +Short: move an object(file/folder) to another folder on blobbers +Long: move an object to another folder on blobbers + +LocalFlags: +-a, --allocation Allocation ID +-d, --destpath Destination path for the object. Existing directory the object should be copied to +-r, --remotepath Remote path of object to move + +Usage: newallocation + +Short: Creates a new allocation +Long: Creates a new allocation + +LocalFlags: +-a, --allocationFileName name of the file in configDir to store the generated allocationID +-b, --blobber_auth_tickets coma seperated list of blobber auth tickets +-c, --cost pass this option to only get the min lock demand +-d, --data the number of blobbers to be used as data shards +-f, --forbid_copy (default false) specify if the users cannot copy object from this allocation +-f, --forbid_delete (default false) specify if the users cannot delete objects from this allocation +-f, --forbid_move (default false) specify if the users cannot move objects from this allocation +-f, --forbid_rename (default false) specify if the users cannot rename objects in this allocation +-f, --forbid_update (default false) specify if the users cannot update objects in this allocation +-f, --forbid_upload (default false) specify if users cannot upload to this allocation +-f, --force (default false) force to get blobbers even if required number of blobbers are not available (should be passed true in case of restricted blobbers) +-f, --free_storage json file containing marker for free storage +-l, --lock lock write pool with given number of tokens, required +-n, --name allocation name +-o, --owner create an allocation with someone else as owner +-o, --owner_public_key public key of owner, user when creating an allocation for somone else +-p, --parity the number of blobber to be used as parity shards +-p, --preferred_blobbers coma seperated list of preferred blobbers +-r, --read_price select blobbers by provided read price range, use form 0.5-1.5, default is [0; inf) +-s, --size the size of the allocation +-t, --third_party_extendable (default false) specify if the allocation can be extended by users other than the owner +-u, --usd pass this option to give token value in USD +-w, --write_price select blobbers by provided write price range, use form 1.5-2.5, default is [0; inf) + +Usage: recent-refs + +Short: get list of recently added refs +Long: get list of recently added refs + +LocalFlags: +-a, --allocation Allocation ID +-i, --in Recent refs in this duration +-j, --json (default false) pass this option to print response as json data +-p, --page Page to get refs from +-p, --page_limit Number of refs to return in the page + +Usage: rename + +Short: rename an object(file/folder) on blobbers +Long: rename an object on blobbers + +LocalFlags: +-a, --allocation Allocation ID +-d, --destname New Name for the object (Only the name and not the path). Include the file extension if applicable +-r, --remotepath Remote path of object to rename + +Usage: reset-blobber-stats + +Short: Reset blobber stats +Long: Reset blobber stats + +LocalFlags: +-b, --blobber_id blobber_id is required +-n, --new_allocated new_allocated is required +-n, --new_saved_data new_saved_data is required +-p, --prev_allocated prev_allocated is required +-p, --prev_saved_data prev_saved_data is required + +Usage: rollback + +Short: rollback file to previous version +Long: rollback file to previous version + +LocalFlags: +-a, --allocation Allocation ID + +Usage: rp-create + +Short: Create read pool if missing +Long: Create read pool in storage SC if the pool is missing. + +Usage: rp-info + +Short: Read pool information. +Long: Read pool information. + +LocalFlags: +-j, --json (default false) pass this option to print response as json data + +Usage: rp-lock + +Short: Lock some tokens in read pool. +Long: Lock some tokens in read pool. + +LocalFlags: +-f, --fee transaction fee, default 0 +-t, --tokens lock tokens number, required + +Usage: rp-unlock + +Short: Unlock some expired tokens in a read pool. +Long: Unlock some expired tokens in a read pool. + +LocalFlags: +-f, --fee transaction fee, default 0 + +Usage: sc-config + +Short: Show storage SC configuration. +Long: Show storage SC configuration. + +LocalFlags: +-j, --json (default false) pass this option to print response as json data + +Usage: share + +Short: share files from blobbers +Long: share files from blobbers + +LocalFlags: +-a, --allocation Allocation ID +-a, --available-after Timelock for private file that makes the file available for download at certain time. 4 input formats are supported: +1h30m, +30, 1647858200 and 2022-03-21 10:21:38. Default value is current local time. +-c, --clientid ClientID of the user to share with. Leave blank for public share +-e, --encryptionpublickey Encryption public key of the client you want to share with. Can be retrieved by the getwallet command +-e, --expiration-seconds Authticket will expire when the seconds specified have elapsed after the instant of its creation +-r, --remotepath Remote path to share +-r, --revoke (default false) Revoke share for remotepath + +Usage: shutdown-blobber + +Short: deactivate a blobber +Long: deactivate a blobber, it will not be used for any new allocations + +LocalFlags: +-f, --fee fee for transaction +-i, --id the blobber id which you want to shut down + +Usage: shutdown-validator + +Short: deactivate a validator +Long: deactivate a validator, it will not be used for any new challenge validations + +LocalFlags: +-f, --fee fee for transaction +-i, --id the validator id which you want to shut down + +Usage: sign-data + +Short: Sign given data +Long: Sign given data + +LocalFlags: +-d, --data give data for signing, Default will be clientID + +Usage: sp-info + +Short: Stake pool information. +Long: Stake pool information. + +LocalFlags: +-a, --authorizer_id for given authorizer +-b, --blobber_id for given blobber +-j, --json (default false) pass this option to print response as json data +-m, --miner_id for given miner +-s, --sharder_id for given sharder +-v, --validator_id for given validator + +Usage: sp-lock + +Short: Lock tokens lacking in stake pool. +Long: Lock tokens lacking in stake pool. + +LocalFlags: +-a, --authorizer_id for given authorizer +-b, --blobber_id for given blobber +-f, --fee transaction fee, default 0 +-m, --miner_id for given miner +-s, --sharder_id for given sharder +-t, --tokens tokens to lock, required +-v, --validator_id for given validator + +Usage: sp-unlock + +Short: Unlock tokens in stake pool. +Long: Unlock tokens in stake pool. + +LocalFlags: +-a, --authorizer_id for given authorizer +-b, --blobber_id for given blobber +-f, --fee transaction fee, default 0 +-m, --miner_id for given miner +-s, --sharder_id for given sharder +-v, --validator_id for given validator + +Usage: sp-user-info + +Short: Stake pool information for a user. +Long: Stake pool information for a user. + +LocalFlags: +-a, --all (default false) pass this option to get all the pools +-c, --client_id pass for given client +-j, --json (default false) pass this option to print response as json data +-l, --limit pass this option to limit the number of records returned +-o, --offset pass this option to skip the number of rows before beginning + +Usage: start-repair + +Short: start repair file to blobbers +Long: start repair file to blobbers + +LocalFlags: +-a, --allocation Allocation ID +-r, --repairpath Path to repair +-r, --rootpath File path for local files + +Usage: stats + +Short: stats for file from blobbers +Long: stats for file from blobbers + +LocalFlags: +-a, --allocation Allocation ID +-j, --json (default false) pass this option to print response as json data +-r, --remotepath Remote path to list from + +Usage: stream + +Short: capture video and audio streaming form local devices, and upload +Long: capture video and audio streaming form local devices, and upload + +LocalFlags: +-a, --allocation Allocation ID +-a, --attr-who-pays-for-reads Who pays for reads: owner or 3rd_party +-c, --chunknumber how many chunks should be uploaded in a http request +-d, --delay set segment duration to seconds. +-e, --encrypt (default false) pass this option to encrypt and upload the file +-l, --localpath Local path of file to upload +-r, --remotepath Remote path to upload +-t, --thumbnailpath Local thumbnail path of file to upload + +Usage: sync + +Short: Sync files to/from blobbers +Long: Sync all files to/from blobbers from/to a localpath + +LocalFlags: +-a, --allocation Allocation ID +-c, --chunknumber how many chunks should be uploaded in a http request +-e, --encryptpath Local dir path to upload as encrypted +-e, --excludepath Remote folder paths exclude to sync +-l, --localcache Local cache of remote snapshot. +If file exists, this will be used for comparison with remote. +After sync complete, remote snapshot will be updated to the same file for next use. +-l, --localpath Local dir path to sync +-r, --remotepath Remote dir path from where it sync +-u, --uploadonly (default false) pass this option to only upload/update the files +-v, --verifydownload pass this option to verify downloaded blocks + +Usage: transferallocation + +Short: Transfer an allocation from one account to another +Long: Transfer an allocation between accounts, only current owner can transfer the allocation + +LocalFlags: +-a, --allocation allocation which is to have its ownership changed +-n, --new_owner id of the new owner +-n, --new_owner_key the public key of the new owner + +Usage: update + +Short: update file to blobbers +Long: update file to blobbers + +LocalFlags: +-a, --allocation Allocation ID +-c, --chunknumber how many chunks should be updated in a http request +-e, --encrypt (default false) pass this option to encrypt and update the file +-l, --localpath Local path of file to update +-r, --remotepath Remote path of file to update +-t, --thumbnailpath Local thumbnail path of file to update + +Usage: updateallocation + +Short: Updates allocation's expiry and size +Long: Updates allocation's expiry and size + +LocalFlags: +-a, --add_blobber ID of blobber to add to the allocation +-a, --add_blobber_auth_ticket Auth ticket of blobber to add to the allocation +-a, --allocation Allocation ID +-e, --extend (default false) adjust storage expiration time, duration +-f, --forbid_copy (default false) specify if the users cannot copy object from this allocation +-f, --forbid_delete (default false) specify if the users cannot delete objects from this allocation +-f, --forbid_move (default false) specify if the users cannot move objects from this allocation +-f, --forbid_rename (default false) specify if the users cannot rename objects in this allocation +-f, --forbid_update (default false) specify if the users cannot update objects in this allocation +-f, --forbid_upload (default false) specify if users cannot upload to this allocation +-l, --lock lock write pool with given number of tokens, required +-n, --name allocation name +-r, --remove_blobber ID of blobber to remove from the allocation +-s, --set_third_party_extendable (default false) specify if the allocation can be extended by users other than the owner +-s, --size adjust allocation size, bytes + +Usage: upload + +Short: upload file to blobbers +Long: upload file to blobbers + +LocalFlags: +-a, --allocation Allocation ID +-a, --attr-who-pays-for-reads Who pays for reads: owner or 3rd_party +-c, --chunknumber how many chunks should be uploaded in a http request +-e, --encrypt (default false) pass this option to encrypt and upload the file +-l, --localpath Local path of file to upload +-m, --multiuploadjson A JSON file containing multiupload options +-r, --remotepath Remote path to upload +-t, --thumbnailpath Local thumbnail path of file to upload +-w, --web-streaming (default false) pass this option to enable web streaming support + +Usage: validator-info + +Short: Get validator info +Long: Get validator info + +LocalFlags: +-j, --json (default false) pass this option to print response as json data +-v, --validator_id validator ID, required + +Usage: validator-update + +Short: Update validator settings by its delegate_wallet owner +Long: Update validator settings by its delegate_wallet owner + +LocalFlags: +-m, --max_stake update max_stake, optional +-m, --min_stake update min_stake, optional +-n, --num_delegates update num_delegates, optional +-s, --service_charge update service_charge, optional +-v, --validator_id validator ID, required + +Usage: version + +Short: Prints version information +Long: Prints version information + +LocalFlags: +-j, --json (default false) pass this option to print response as json data + +Usage: wp-lock + +Short: Lock some tokens in write pool. +Long: Lock some tokens in write pool. + +LocalFlags: +-a, --allocation allocation id to lock for, required +-f, --fee transaction fee, default 0 +-t, --tokens lock tokens number, required + +Usage: wp-unlock + +Short: Unlock some expired tokens in a write pool. +Long: Unlock some expired tokens in a write pool. + +LocalFlags: +-a, --allocation allocation id from which to unlock tokens +-f, --fee transaction fee, default 0 + From 7f576b3cd92fdf27c102a65499f685b9d1d74b64 Mon Sep 17 00:00:00 2001 From: Gaurboy's M3Pro Date: Mon, 29 Apr 2024 02:55:07 +0530 Subject: [PATCH 046/228] fixes --- README.md | 70 +---------------------------------------------------- internal.md | 67 +++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 67 insertions(+), 70 deletions(-) diff --git a/README.md b/README.md index 3d7a379d..542ae467 100644 --- a/README.md +++ b/README.md @@ -53,9 +53,7 @@ zbox is a command line interface (CLI) tool to understand the capabilities of Z - [Repair](#repair) - [Decrypt](#decrypt) - [Sign data](#sign-data) - - [Streaming](#streaming) - - [How it works:](#how-it-works) - - [Usage](#usage) + - [Lock and Unlock Tokens](#lock-and-unlock-tokens) - [Challenge pool information](#challenge-pool-information) - [Create read pool](#create-read-pool) @@ -1732,72 +1730,6 @@ Repair file completed, Total files repaired: 0 Signature : 9432ab2ee602062afaf48c4016b373a65db48a8546a81c09dead40e54966399e ``` ---- - -#### Streaming - -Video streaming with Zbox CLI can be implemented with players for different operating platforms(iOS, Android Mac).Zbox CLI does not have a player itself and use the the downloadFileByBlocks helper function to properly returns file-chunks with correct byte range. - -![streaming-android](https://user-images.githubusercontent.com/65766301/120052635-ce373b00-c043-11eb-94a5-a9711078ee54.png) - -##### How it works: - -When the user starts the video player (ExoPlayer for Android or AVPlayer for iOS), A ZChainDataSource starts chunked download and requests chunks of video from the buffer(a Middleman between streaming player and Zbox). - -After the arrival of the first chunk, the player starts requesting more chunks from the buffer, which requests the Zbox SDK. Zbox SDK, which is built using GO, makes use of the downloadFileByBlocks method to reliably download large files by chunking them into a sequence of parts that can be downloaded individually. Once the blocks are downloaded, they are read into input streams and added to the media source of the streaming player. - -The task of downloading files and writing them to buffer using Zbox SDK happens constantly, and If players request random bits of video, they are delivered instantly by a buffer. - -In a case, if the player didn't receive chunks (for example, it's still not downloaded), then the player switches to STALE state, and the video stream will pause. During the STALE state, a player tries to make multiple requests for chunks; if didn't receive a response, the video stream stops. - -##### Usage - -To understand how Zbox CLI provides downloading of files by blocks. Let's consider an allocation that has `audio. mp3 ` file stored on dStorage. Make sure the file has a large size(more than 64 kB(64000 bytes)) to download the file by blocks. The size and other attributes of the sample `audio. mp3` file can be viewed using - -``` -./zbox list --allocation $ALLOC --remotepath /myfiles -``` - -Response: - -``` - TYPE | NAME | PATH | SIZE | NUM BLOCKS |LOOKUP HASH | IS ENCRYPTED | DOWNLOADS PAYER -+------+-----------+--------------------+---------+------------+---------------- - f | audio.mp3 | /myfiles/audio.mp3 | 5992396 | 92 | 3cea39505cc30fb9f6fc5c6045284188feb14eac8ff3a19577701c4f6d973239 | NO | owner - -``` -Here we can see the `audio.mp3` file of size (5993286) bytes having 92 blocks.If we want to download a certain number of blocks for the `audio.mp3` file we can use the `--endblock` or `--startblock` flag with `./zbox download` command. Other flags for download can be viewed using `./zbox download --help` - -``` -Flags: - - -b, --blockspermarker int pass this option to download multiple blocks per marker (default 10) - -e, --endblock int pass this option to download till specific block number - -h, --help help for download - --localpath string Local path of file to download - --remotepath string Remote path to download - -s, --startblock int Pass this option to download from specific block number -``` - -For only downloading three blocks of `audio.mp3` file, we specify `--startblock` and`--endblock` with integer value of 1 and 3. `--blockspermarker` flag can also be specified to download multiple blocks at a time(default is 10). - -Sample command for downloading till 3rd block of the `audio.mp3` file would be: - -``` -./zbox download --localpath /root --remotepath /myfiles/audio.mp3 --allocation $ALLOC --startblock 1 --endblock 3 -``` - -Response: - -``` - 393216 / 2996198 [====================>-----------------------------------------------------------------------------------------------------------------------------------------] 13.12% 1s -Status completed callback. Type = audio/mpeg. Name = audio.mp3 - -``` - -As we can see, the downloaded file size(393216) is less than the original(2996198), which means zbox has downloaded some blocks of the file. - - ### Lock and Unlock Tokens #### Challenge pool information diff --git a/internal.md b/internal.md index 9169947b..7344f31b 100644 --- a/internal.md +++ b/internal.md @@ -4,7 +4,9 @@ Contents : [Stream](#stream) [Get MPT](#get-mpt) [Rollback Allocation](#rollback-allocation) - +[Streaming](#streaming) + - [How it works:](#how-it-works) + - [Usage](#usage) #### Sync `sync` command syncs all files from the local folder recursively to the remote. @@ -146,3 +148,66 @@ Sample Response : ```sh Rollback successful ``` + +#### Streaming + +Video streaming with Zbox CLI can be implemented with players for different operating platforms(iOS, Android Mac).Zbox CLI does not have a player itself and use the the downloadFileByBlocks helper function to properly returns file-chunks with correct byte range. + +![streaming-android](https://user-images.githubusercontent.com/65766301/120052635-ce373b00-c043-11eb-94a5-a9711078ee54.png) + +##### How it works: + +When the user starts the video player (ExoPlayer for Android or AVPlayer for iOS), A ZChainDataSource starts chunked download and requests chunks of video from the buffer(a Middleman between streaming player and Zbox). + +After the arrival of the first chunk, the player starts requesting more chunks from the buffer, which requests the Zbox SDK. Zbox SDK, which is built using GO, makes use of the downloadFileByBlocks method to reliably download large files by chunking them into a sequence of parts that can be downloaded individually. Once the blocks are downloaded, they are read into input streams and added to the media source of the streaming player. + +The task of downloading files and writing them to buffer using Zbox SDK happens constantly, and If players request random bits of video, they are delivered instantly by a buffer. + +In a case, if the player didn't receive chunks (for example, it's still not downloaded), then the player switches to STALE state, and the video stream will pause. During the STALE state, a player tries to make multiple requests for chunks; if didn't receive a response, the video stream stops. + +##### Usage + +To understand how Zbox CLI provides downloading of files by blocks. Let's consider an allocation that has `audio. mp3 ` file stored on dStorage. Make sure the file has a large size(more than 64 kB(64000 bytes)) to download the file by blocks. The size and other attributes of the sample `audio. mp3` file can be viewed using + +``` +./zbox list --allocation $ALLOC --remotepath /myfiles +``` + +Response: + +``` + TYPE | NAME | PATH | SIZE | NUM BLOCKS |LOOKUP HASH | IS ENCRYPTED | DOWNLOADS PAYER ++------+-----------+--------------------+---------+------------+---------------- + f | audio.mp3 | /myfiles/audio.mp3 | 5992396 | 92 | 3cea39505cc30fb9f6fc5c6045284188feb14eac8ff3a19577701c4f6d973239 | NO | owner + +``` +Here we can see the `audio.mp3` file of size (5993286) bytes having 92 blocks.If we want to download a certain number of blocks for the `audio.mp3` file we can use the `--endblock` or `--startblock` flag with `./zbox download` command. Other flags for download can be viewed using `./zbox download --help` + +``` +Flags: + + -b, --blockspermarker int pass this option to download multiple blocks per marker (default 10) + -e, --endblock int pass this option to download till specific block number + -h, --help help for download + --localpath string Local path of file to download + --remotepath string Remote path to download + -s, --startblock int Pass this option to download from specific block number +``` + +For only downloading three blocks of `audio.mp3` file, we specify `--startblock` and`--endblock` with integer value of 1 and 3. `--blockspermarker` flag can also be specified to download multiple blocks at a time(default is 10). + +Sample command for downloading till 3rd block of the `audio.mp3` file would be: + +``` +./zbox download --localpath /root --remotepath /myfiles/audio.mp3 --allocation $ALLOC --startblock 1 --endblock 3 +``` + +Response: + +``` + 393216 / 2996198 [====================>-----------------------------------------------------------------------------------------------------------------------------------------] 13.12% 1s +Status completed callback. Type = audio/mpeg. Name = audio.mp3 + +``` + +As we can see, the downloaded file size(393216) is less than the original(2996198), which means zbox has downloaded some blocks of the file. From 1474130265095a5b5b313a59b3463919bd99a3b1 Mon Sep 17 00:00:00 2001 From: Gaurboy's M3Pro Date: Mon, 29 Apr 2024 02:59:06 +0530 Subject: [PATCH 047/228] removed garbage --- zbox_commands.txt | 682 ---------------------------------------------- 1 file changed, 682 deletions(-) delete mode 100644 zbox_commands.txt diff --git a/zbox_commands.txt b/zbox_commands.txt deleted file mode 100644 index 4d6f7b4f..00000000 --- a/zbox_commands.txt +++ /dev/null @@ -1,682 +0,0 @@ -Usage: zbox - -Short: zbox is a decentralized storage application written on the 0Chain platform -Long: zbox is a decentralized storage application written on the 0Chain platform. - Complete documentation is available at https://docs.zus.network/guides/zbox-cli - -LocalFlags: --c, --config config file (default is config.yaml) --c, --configDir configuration directory (default is $HOME/.zcn) --f, --fee transaction fee for the given transaction (if unset, it will be set to blockchain min fee) --n, --network network file to overwrite the network details (if required, default is network.yaml) --s, --silent (default false) Do not show interactive sdk logs (shown by default) --w, --wallet wallet file (default is wallet.json) --w, --wallet_client_id wallet client_id --w, --wallet_client_key wallet client_key --w, --withNonce nonce that will be used in transaction (default is 0) - -Subcommands: -Usage: add - -Short: Adds free storage assigner -Long: Adds free storage assigner - -LocalFlags: --k, --key the public key used for singing markers --l, --limit maximum number of tokens to use in a free allocation --m, --max the total number of tokens that can be given in free allocations --n, --name the account number that will be creating free storage markers - -Usage: alloc-cancel - -Short: Cancel an allocation -Long: Cancel allocation used to terminate an allocation where, because -of blobbers, it can't be used. Thus, the blobbers will not receive their -min_lock_demand. Other aspects of the cancellation follows the finalize -allocation flow. - -LocalFlags: --a, --allocation Allocation ID - -Usage: alloc-fini - -Short: Finalize an expired allocation -Long: Finalize an expired allocation by allocation owner or one of -blobbers of the allocation. It moves all tokens have to be moved between pools -and empties write pool moving left tokens to client. - -LocalFlags: --a, --allocation Allocation ID - -Usage: bl-info - -Short: Get blobber info -Long: Get blobber info - -LocalFlags: --b, --blobber_id blobber ID, required --j, --json (default false) pass this option to print response as json data - -Usage: bl-update - -Short: Update blobber settings by its delegate_wallet owner -Long: Update blobber settings by its delegate_wallet owner - -LocalFlags: --b, --blobber_id blobber ID, required --c, --capacity update blobber capacity bid, optional --i, --is_restricted (default false) set is_restricted --m, --max_offer_duration update max_offer_duration, optional --m, --max_stake update max_stake, optional --m, --min_stake update min_stake, optional --n, --not_available (default false) set blobber's availability for new allocations --n, --num_delegates update num_delegates, optional --r, --read_price update read_price, optional --s, --service_charge update service_charge, optional --u, --url update the url of the blobber, optional --w, --write_price update write_price, optional - -Usage: collect-reward - -Short: Collect accrued rewards for a stake pool. -Long: Collect accrued rewards for a stake pool. - -LocalFlags: --p, --provider_id blobber or validator id --p, --provider_type provider type - -Usage: copy - -Short: copy an object(file/folder) to another folder on blobbers -Long: copy an object to another folder on blobbers - -LocalFlags: --a, --allocation Allocation ID --d, --destpath Destination path for the object. Existing directory the object should be copied to --r, --remotepath Remote path of object to copy - -Usage: cp-info - -Short: Challenge pool information. -Long: Challenge pool information. - -LocalFlags: --a, --allocation allocation identifier, required --j, --json (default false) pass this option to print response as json data - -Usage: createdir - -Short: Create directory -Long: Create directory - -LocalFlags: --a, --allocation Allocation ID --d, --dirname New directory name - -Usage: decrypt - -Short: Decrypt text with passphrase -Long: Decrypt text with passphrase - -LocalFlags: --p, --passphrase Passphrase to decrypt text --t, --text Encrypted text - -Usage: delete - -Short: delete file from blobbers -Long: delete file from blobbers - -LocalFlags: --a, --allocation Allocation ID --r, --remotepath Remote path of the object to delete - -Usage: download - -Short: download file from blobbers -Long: download file from blobbers - -LocalFlags: --a, --allocation Allocation ID --a, --authticket Auth ticket fot the file to download if you dont own it --b, --blockspermarker pass this option to download multiple blocks per marker --d, --delay pass segment duration to generate media playlist(m3u8). only works with --live. default duration is 5s. --e, --endblock pass this option to download till specific block number --l, --live (default false) start m3u8 downloader,and automatically generate media playlist(m3u8) on --localpath --l, --localpath Local path of file to download --l, --lookuphash The remote lookuphash of the object retrieved from the list --m, --multidownloadjson A JSON file containing multi download options --r, --remotepath Remote path to download --s, --startblock Pass this option to download from specific block number. It should not be less than 1 --t, --thumbnail (default false) pass this option to download only the thumbnail --v, --verifydownload (default false) pass this option to verify downloaded blocks - -Usage: feed - -Short: download segment files from remote live feed, and upload -Long: download segment files from remote live feed, and upload - -LocalFlags: --a, --allocation Allocation ID --a, --attr-who-pays-for-reads Who pays for reads: owner or 3rd_party --c, --chunknumber how many chunks should be uploaded in a http request --d, --delay set segment duration to seconds. --d, --downloader-args pass args to youtube-dl to download video. default is "-q". --e, --encrypt (default false) pass this option to encrypt and upload the file --f, --feed set remote live feed to url. --f, --ffmpeg-args pass args to ffmpeg to build segments. default is "-loglevel warning". --l, --localpath Local path of file to upload --r, --remotepath Remote path to upload --t, --thumbnailpath Local thumbnail path of file to upload - -Usage: get-diff - -Short: Get difference of local and allocation root -Long: Get difference of local and allocation root - -LocalFlags: --a, --allocation Allocation ID --e, --excludepath Remote folder paths exclude to sync --l, --localcache Local cache of remote snapshot. -If file exists, this will be used for comparison with remote. -After sync complete, remote snapshot will be updated to the same file for next use. --l, --localpath Local dir path to sync - -Usage: get-download-cost - -Short: Get downloading cost -Long: Get downloading cost - -LocalFlags: --a, --allocation allocation ID, required --a, --authticket authticket --b, --blocks-per-marker blocks signed per Read Marker --l, --lookuphash lookuphash, for the remote file --r, --remotepath remote path of file - -Usage: get-mpt - -Short: Directly view blockchain data -Long: Directly view blockchain data from MPT key - -LocalFlags: --k, --key Key into MPT datastore - -Usage: get-upload-cost - -Short: Get uploading cost -Long: Get uploading cost - -LocalFlags: --a, --allocation allocation ID, required --d, --duration expected duration keep uploaded file --e, --end (default false) use the duration until allocation ends --l, --localpath local file path, required - -Usage: getallocation - -Short: Gets the allocation info -Long: Gets the allocation info - -LocalFlags: --a, --allocation Allocation ID --b, --blocks-per-marker blocks signed per Read Marker --j, --json (default false) pass this option to print response as json data - -Usage: getwallet - -Short: Get wallet information -Long: Get wallet information - -LocalFlags: --j, --json (default false) pass this option to print response as json data - -Usage: kill-blobber - -Short: punitively deactivate a blobber -Long: punitively deactivate a blobber - -LocalFlags: --i, --id blobber's id - -Usage: kill-validator - -Short: punitively deactivate a validator -Long: punitively deactivate a validator - -LocalFlags: --i, --id validator's id - -Usage: list - -Short: list files from blobbers -Long: list files from blobbers - -LocalFlags: --a, --allocation Allocation ID --a, --authticket Auth ticket fot the file to download if you dont own it --j, --json (default false) pass this option to print response as json data --l, --lookuphash The remote lookuphash of the object retrieved from the list --r, --remotepath Remote path to list from - -Usage: list-all - -Short: list all files from blobbers -Long: list all files from blobbers - -LocalFlags: --a, --allocation Allocation ID - -Usage: listallocations - -Short: List allocations for the client -Long: List allocations for the client - -LocalFlags: --j, --json (default false) pass this option to print response as json data - -Usage: ls-blobbers - -Short: Show active blobbers in storage SC. -Long: Show active blobbers in storage SC. - -LocalFlags: --a, --all (default false) shows active and non active list of blobbers on ls-blobbers --j, --json (default false) pass this option to print response as json data --s, --stakable (default false) gets only stakable list of blobbers if set to true - -Usage: ls-validators - -Short: Show active Validators. -Long: Show active Validators in the network. - -LocalFlags: --j, --json (default false) pass this flag to get response as json object --s, --stakable (default false) Gets only validators that can be staked if set to true - -Usage: meta - -Short: get meta data of files from blobbers -Long: get meta data of files from blobbers - -LocalFlags: --a, --allocation Allocation ID --a, --authticket Auth ticket fot the file to download if you dont own it --j, --json (default false) pass this option to print response as json data --l, --lookuphash The remote lookuphash of the object retrieved from the list --r, --remotepath Remote path to list from - -Usage: move - -Short: move an object(file/folder) to another folder on blobbers -Long: move an object to another folder on blobbers - -LocalFlags: --a, --allocation Allocation ID --d, --destpath Destination path for the object. Existing directory the object should be copied to --r, --remotepath Remote path of object to move - -Usage: newallocation - -Short: Creates a new allocation -Long: Creates a new allocation - -LocalFlags: --a, --allocationFileName name of the file in configDir to store the generated allocationID --b, --blobber_auth_tickets coma seperated list of blobber auth tickets --c, --cost pass this option to only get the min lock demand --d, --data the number of blobbers to be used as data shards --f, --forbid_copy (default false) specify if the users cannot copy object from this allocation --f, --forbid_delete (default false) specify if the users cannot delete objects from this allocation --f, --forbid_move (default false) specify if the users cannot move objects from this allocation --f, --forbid_rename (default false) specify if the users cannot rename objects in this allocation --f, --forbid_update (default false) specify if the users cannot update objects in this allocation --f, --forbid_upload (default false) specify if users cannot upload to this allocation --f, --force (default false) force to get blobbers even if required number of blobbers are not available (should be passed true in case of restricted blobbers) --f, --free_storage json file containing marker for free storage --l, --lock lock write pool with given number of tokens, required --n, --name allocation name --o, --owner create an allocation with someone else as owner --o, --owner_public_key public key of owner, user when creating an allocation for somone else --p, --parity the number of blobber to be used as parity shards --p, --preferred_blobbers coma seperated list of preferred blobbers --r, --read_price select blobbers by provided read price range, use form 0.5-1.5, default is [0; inf) --s, --size the size of the allocation --t, --third_party_extendable (default false) specify if the allocation can be extended by users other than the owner --u, --usd pass this option to give token value in USD --w, --write_price select blobbers by provided write price range, use form 1.5-2.5, default is [0; inf) - -Usage: recent-refs - -Short: get list of recently added refs -Long: get list of recently added refs - -LocalFlags: --a, --allocation Allocation ID --i, --in Recent refs in this duration --j, --json (default false) pass this option to print response as json data --p, --page Page to get refs from --p, --page_limit Number of refs to return in the page - -Usage: rename - -Short: rename an object(file/folder) on blobbers -Long: rename an object on blobbers - -LocalFlags: --a, --allocation Allocation ID --d, --destname New Name for the object (Only the name and not the path). Include the file extension if applicable --r, --remotepath Remote path of object to rename - -Usage: reset-blobber-stats - -Short: Reset blobber stats -Long: Reset blobber stats - -LocalFlags: --b, --blobber_id blobber_id is required --n, --new_allocated new_allocated is required --n, --new_saved_data new_saved_data is required --p, --prev_allocated prev_allocated is required --p, --prev_saved_data prev_saved_data is required - -Usage: rollback - -Short: rollback file to previous version -Long: rollback file to previous version - -LocalFlags: --a, --allocation Allocation ID - -Usage: rp-create - -Short: Create read pool if missing -Long: Create read pool in storage SC if the pool is missing. - -Usage: rp-info - -Short: Read pool information. -Long: Read pool information. - -LocalFlags: --j, --json (default false) pass this option to print response as json data - -Usage: rp-lock - -Short: Lock some tokens in read pool. -Long: Lock some tokens in read pool. - -LocalFlags: --f, --fee transaction fee, default 0 --t, --tokens lock tokens number, required - -Usage: rp-unlock - -Short: Unlock some expired tokens in a read pool. -Long: Unlock some expired tokens in a read pool. - -LocalFlags: --f, --fee transaction fee, default 0 - -Usage: sc-config - -Short: Show storage SC configuration. -Long: Show storage SC configuration. - -LocalFlags: --j, --json (default false) pass this option to print response as json data - -Usage: share - -Short: share files from blobbers -Long: share files from blobbers - -LocalFlags: --a, --allocation Allocation ID --a, --available-after Timelock for private file that makes the file available for download at certain time. 4 input formats are supported: +1h30m, +30, 1647858200 and 2022-03-21 10:21:38. Default value is current local time. --c, --clientid ClientID of the user to share with. Leave blank for public share --e, --encryptionpublickey Encryption public key of the client you want to share with. Can be retrieved by the getwallet command --e, --expiration-seconds Authticket will expire when the seconds specified have elapsed after the instant of its creation --r, --remotepath Remote path to share --r, --revoke (default false) Revoke share for remotepath - -Usage: shutdown-blobber - -Short: deactivate a blobber -Long: deactivate a blobber, it will not be used for any new allocations - -LocalFlags: --f, --fee fee for transaction --i, --id the blobber id which you want to shut down - -Usage: shutdown-validator - -Short: deactivate a validator -Long: deactivate a validator, it will not be used for any new challenge validations - -LocalFlags: --f, --fee fee for transaction --i, --id the validator id which you want to shut down - -Usage: sign-data - -Short: Sign given data -Long: Sign given data - -LocalFlags: --d, --data give data for signing, Default will be clientID - -Usage: sp-info - -Short: Stake pool information. -Long: Stake pool information. - -LocalFlags: --a, --authorizer_id for given authorizer --b, --blobber_id for given blobber --j, --json (default false) pass this option to print response as json data --m, --miner_id for given miner --s, --sharder_id for given sharder --v, --validator_id for given validator - -Usage: sp-lock - -Short: Lock tokens lacking in stake pool. -Long: Lock tokens lacking in stake pool. - -LocalFlags: --a, --authorizer_id for given authorizer --b, --blobber_id for given blobber --f, --fee transaction fee, default 0 --m, --miner_id for given miner --s, --sharder_id for given sharder --t, --tokens tokens to lock, required --v, --validator_id for given validator - -Usage: sp-unlock - -Short: Unlock tokens in stake pool. -Long: Unlock tokens in stake pool. - -LocalFlags: --a, --authorizer_id for given authorizer --b, --blobber_id for given blobber --f, --fee transaction fee, default 0 --m, --miner_id for given miner --s, --sharder_id for given sharder --v, --validator_id for given validator - -Usage: sp-user-info - -Short: Stake pool information for a user. -Long: Stake pool information for a user. - -LocalFlags: --a, --all (default false) pass this option to get all the pools --c, --client_id pass for given client --j, --json (default false) pass this option to print response as json data --l, --limit pass this option to limit the number of records returned --o, --offset pass this option to skip the number of rows before beginning - -Usage: start-repair - -Short: start repair file to blobbers -Long: start repair file to blobbers - -LocalFlags: --a, --allocation Allocation ID --r, --repairpath Path to repair --r, --rootpath File path for local files - -Usage: stats - -Short: stats for file from blobbers -Long: stats for file from blobbers - -LocalFlags: --a, --allocation Allocation ID --j, --json (default false) pass this option to print response as json data --r, --remotepath Remote path to list from - -Usage: stream - -Short: capture video and audio streaming form local devices, and upload -Long: capture video and audio streaming form local devices, and upload - -LocalFlags: --a, --allocation Allocation ID --a, --attr-who-pays-for-reads Who pays for reads: owner or 3rd_party --c, --chunknumber how many chunks should be uploaded in a http request --d, --delay set segment duration to seconds. --e, --encrypt (default false) pass this option to encrypt and upload the file --l, --localpath Local path of file to upload --r, --remotepath Remote path to upload --t, --thumbnailpath Local thumbnail path of file to upload - -Usage: sync - -Short: Sync files to/from blobbers -Long: Sync all files to/from blobbers from/to a localpath - -LocalFlags: --a, --allocation Allocation ID --c, --chunknumber how many chunks should be uploaded in a http request --e, --encryptpath Local dir path to upload as encrypted --e, --excludepath Remote folder paths exclude to sync --l, --localcache Local cache of remote snapshot. -If file exists, this will be used for comparison with remote. -After sync complete, remote snapshot will be updated to the same file for next use. --l, --localpath Local dir path to sync --r, --remotepath Remote dir path from where it sync --u, --uploadonly (default false) pass this option to only upload/update the files --v, --verifydownload pass this option to verify downloaded blocks - -Usage: transferallocation - -Short: Transfer an allocation from one account to another -Long: Transfer an allocation between accounts, only current owner can transfer the allocation - -LocalFlags: --a, --allocation allocation which is to have its ownership changed --n, --new_owner id of the new owner --n, --new_owner_key the public key of the new owner - -Usage: update - -Short: update file to blobbers -Long: update file to blobbers - -LocalFlags: --a, --allocation Allocation ID --c, --chunknumber how many chunks should be updated in a http request --e, --encrypt (default false) pass this option to encrypt and update the file --l, --localpath Local path of file to update --r, --remotepath Remote path of file to update --t, --thumbnailpath Local thumbnail path of file to update - -Usage: updateallocation - -Short: Updates allocation's expiry and size -Long: Updates allocation's expiry and size - -LocalFlags: --a, --add_blobber ID of blobber to add to the allocation --a, --add_blobber_auth_ticket Auth ticket of blobber to add to the allocation --a, --allocation Allocation ID --e, --extend (default false) adjust storage expiration time, duration --f, --forbid_copy (default false) specify if the users cannot copy object from this allocation --f, --forbid_delete (default false) specify if the users cannot delete objects from this allocation --f, --forbid_move (default false) specify if the users cannot move objects from this allocation --f, --forbid_rename (default false) specify if the users cannot rename objects in this allocation --f, --forbid_update (default false) specify if the users cannot update objects in this allocation --f, --forbid_upload (default false) specify if users cannot upload to this allocation --l, --lock lock write pool with given number of tokens, required --n, --name allocation name --r, --remove_blobber ID of blobber to remove from the allocation --s, --set_third_party_extendable (default false) specify if the allocation can be extended by users other than the owner --s, --size adjust allocation size, bytes - -Usage: upload - -Short: upload file to blobbers -Long: upload file to blobbers - -LocalFlags: --a, --allocation Allocation ID --a, --attr-who-pays-for-reads Who pays for reads: owner or 3rd_party --c, --chunknumber how many chunks should be uploaded in a http request --e, --encrypt (default false) pass this option to encrypt and upload the file --l, --localpath Local path of file to upload --m, --multiuploadjson A JSON file containing multiupload options --r, --remotepath Remote path to upload --t, --thumbnailpath Local thumbnail path of file to upload --w, --web-streaming (default false) pass this option to enable web streaming support - -Usage: validator-info - -Short: Get validator info -Long: Get validator info - -LocalFlags: --j, --json (default false) pass this option to print response as json data --v, --validator_id validator ID, required - -Usage: validator-update - -Short: Update validator settings by its delegate_wallet owner -Long: Update validator settings by its delegate_wallet owner - -LocalFlags: --m, --max_stake update max_stake, optional --m, --min_stake update min_stake, optional --n, --num_delegates update num_delegates, optional --s, --service_charge update service_charge, optional --v, --validator_id validator ID, required - -Usage: version - -Short: Prints version information -Long: Prints version information - -LocalFlags: --j, --json (default false) pass this option to print response as json data - -Usage: wp-lock - -Short: Lock some tokens in write pool. -Long: Lock some tokens in write pool. - -LocalFlags: --a, --allocation allocation id to lock for, required --f, --fee transaction fee, default 0 --t, --tokens lock tokens number, required - -Usage: wp-unlock - -Short: Unlock some expired tokens in a write pool. -Long: Unlock some expired tokens in a write pool. - -LocalFlags: --a, --allocation allocation id from which to unlock tokens --f, --fee transaction fee, default 0 - From 8f02916d8554d33e046f19d176a0e8e830f0880f Mon Sep 17 00:00:00 2001 From: Gaurboy's M3Pro Date: Mon, 29 Apr 2024 22:09:54 +0530 Subject: [PATCH 048/228] fixes --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 542ae467..53e9d71b 100644 --- a/README.md +++ b/README.md @@ -669,6 +669,11 @@ Update blobber read price ./zbox bl-update --blobber_id 0ece681f6b00221c5567865b56040eaab23795a843ed629ce71fb340a5566ba3 --read_price 0.1 ``` +Response : +```sh +blobber settings updated successfully +``` + #### Update validator settings Use `./zbox validator-update ` to update a validator's configuration settings. This updates the settings From 2feeca55cdd8a46c869f58bfd9d86c3eed7dfb22 Mon Sep 17 00:00:00 2001 From: Hitenjain14 Date: Tue, 30 Apr 2024 21:29:55 +0530 Subject: [PATCH 049/228] update gosdk --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index c333b995..34b103a8 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.14.0-RC5 + github.com/0chain/gosdk v1.14.0-RC7 github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 diff --git a/go.sum b/go.sum index f1376aea..8dc372d6 100644 --- a/go.sum +++ b/go.sum @@ -44,6 +44,8 @@ github.com/0chain/gosdk v1.14.0-RC2 h1:OIpjj7mDKxVqJVlxJKm8/fPzdJRN5roXO7/plBCtm github.com/0chain/gosdk v1.14.0-RC2/go.mod h1:tgAiVAuIy+Vs1tGfKCPEuuWWARwNQBEw32y950LrqrU= github.com/0chain/gosdk v1.14.0-RC5 h1:3/K++2jreD9jaZDAYkGXQ41ywANUq6KlIO9vjVZ3d3A= github.com/0chain/gosdk v1.14.0-RC5/go.mod h1:tgAiVAuIy+Vs1tGfKCPEuuWWARwNQBEw32y950LrqrU= +github.com/0chain/gosdk v1.14.0-RC7 h1:hrxt3IGqUBMlZp3QrT1Tx5hTilt1biAAdh9V1SJOTc0= +github.com/0chain/gosdk v1.14.0-RC7/go.mod h1:tgAiVAuIy+Vs1tGfKCPEuuWWARwNQBEw32y950LrqrU= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= From b5714a05324680e04e4c9c379257e8ad4c7a3e47 Mon Sep 17 00:00:00 2001 From: devyetii Date: Thu, 2 May 2024 11:29:25 +0200 Subject: [PATCH 050/228] fnialize list command --- README.md | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 53e9d71b..0d9a238c 100644 --- a/README.md +++ b/README.md @@ -781,13 +781,13 @@ settings: | Parameter | Required | Description | ------------------ | -------- | ----------------------------------------- | --id | yes | Blobber Id to kill a specific blobber.Can be retrieved using [List blobbers](#list-blobbers). -| --fee | no | fee for transaction +| --fee | no | Custom fee for transaction Sample Command : ```sh ./zbox shutdown-blobber --id $BLOBBER_ID --wallet $CHAIN_OWNER_WALLET ``` -Note : Shutdown Blobber command should be evoked from chain owner wallet only +Note : Shutdown Blobber command should be invoked from chain owner wallet only Sample Response : ```sh @@ -800,13 +800,13 @@ shutdown blobber $BLOBBER_ID with txId : 2a6c031ced1d1e7dc4ed17801b4413786ecd250 | Parameter | Required | Description | ------------------ | -------- | ----------------------------------------- | --id | yes | Validator Id to kill a specific validator.Can be retrieved using [List all Validators](#list-all-validators). -| --fee | no | fee for transaction +| --fee | no | Custom fee for transaction Sample Command : ```sh ./zbox shutdown-validator --id $VALIDATOR_ID --wallet $CHAIN_OWNER_WALLET ``` -Note : Shutdown Validator command should be evoked from chain owner wallet only +Note : Shutdown Validator command should be invoked from chain owner wallet only Sample Response : ```sh @@ -1039,6 +1039,7 @@ Use `download` command to download your own or a shared file. | multidownloadjson | no | A JSON file containing multi download options | | string | | verifydownload | no | pass this option to verify downloaded blocks | false | boolean | +
download @@ -1046,12 +1047,20 @@ Use `download` command to download your own or a shared file.
-Example +Example (for owner) ``` ./zbox download --allocation 3c0d32560ea18d9d0d76808216a9c634f661979d29ba59cc8dafccb3e5b95341 --remotepath /myfiles/horse.jpeg --localpath ../horse.jpeg ``` +Example (for non-owner) with authticket + +``` +./zbox download --allocation 3c0d32560ea18d9d0d76808216a9c634f661979d29ba59cc8dafccb3e5b95341 --authticket eyJjbGllbnRfaWQiOiIiLCJvd25lcl9pZCI6IiIsImFsbG9jYXRpb24iOiIzYzBkMzI1NjBlYTE4ZDlkMGQ3NjgwODIxNmE5YzYzNGY2NjE5NzlkMjliYTU5Y2M4ZGFjYmMzZTViOTUzNDEiLCJyZW1vdGVwYXRoIjoiL215ZmlsZXMvaG9yc2UuanBlZyIsImV4cG9ydCI6IjIwMjEtMDctMjFUMDk6MjA6MjAuMDAwWiJ9 --localpath ../horse.jpeg +``` +If the authticket is for a directory, not a file, then you need to provide the lookup hash of the file you want to download. You can get the lookup hash from the [list](#list) command. + + Response: ``` @@ -1289,19 +1298,27 @@ contents.
-Example +Example (for owner) ``` ./zbox list --allocation 8695b9e7f986d4a447b64de020ba86f53b3b5e2c442abceb6cd65742702067dc --remotepath / ``` -Response: +Example (for non-owner with auth ticket) + +``` +./zbox list --allocation 39c41dcc1f3fd5154e92e6285dd18ed869b72662198839a862d8f1fa627ec256 --authticket eyJjbGllbnRfaWQiOiIiLCJvd25lcl9pZCI6ImJhNmFiNDI2NjQ0ZjJiMzI2YjFkYTNkZDQyNjIyOWZlZDE5ZWVkODUzODdkZWFmNzJlMDVjYjBmYTRjNWFiYmIiLCJhbGxvY2F0aW9uX2lkIjoiMzljNDFkY2MxZjNmZDUxNTRlOTJlNjI4NWRkMThlZDg2OWI3MjY2MjE5ODgzOWE4NjJkOGYxZmE2MjdlYzI1NiIsImZpbGVfcGF0aF9oYXNoIjoiNDIzYjRhZTE0Y2YxZWNhMDViYzg1M2E0ZmJiMWVmZGU5ZWU4NzJkYmQxM2M0M2RmZjY4MmVlMTI3ZWU4ZjQ1NyIsImFjdHVhbF9maWxlX2hhc2giOiIiLCJmaWxlX25hbWUiOiJmaWxlcyIsInJlZmVyZW5jZV90eXBlIjoiZCIsImV4cGlyYXRpb24iOjAsInRpbWVzdGFtcCI6MTcxNDY0MTcxNiwiZW5jcnlwdGVkIjpmYWxzZSwic2lnbmF0dXJlIjoiMTNhNzk0YTNjZTczZDFmNjE2ZmY3Njc0MjNhNzBlMzZlNDMwZWYyYTA1MWQyOGViZjQ1YTkzMjIzNjliNTMwYyJ9 +``` + +Example Response: ``` -auth ticket :eyJjbGllbnRfaWQiOiJiNmRlNTYyYjU3YTBiNTkzZDA0ODA2MjRmNzlhNTVlZDQ2ZGJhNTQ0NDA0NTk1YmVlMDI3MzE0NGUwMTAzNGFlIiwib3duZXJfaWQiOiJiNmRlNTYyYjU3YTBiNTkzZDA0ODA2MjRmNzlhNTVlZDQ2ZGJhNTQ0NDA0NTk1YmVlMDI3MzE0NGUwMTAzNGFlIiwiYWxsb2NhdGlvbl9pZCI6Ijg2OTViOWU3Zjk4NmQ0YTQ0N2I2NGRlMDIwYmE4NmY1M2IzYjVlMmM0NDJhYmNlYjZjZDY1NzQyNzAyMDY3ZGMiLCJmaWxlX3BhdGhfaGFzaCI6IjIwZGM3OThiMDRlYmFiMzAxNTgxN2M4NWQyMmFlYTY0YTUyMzA1YmFkNmY3NDQ5YWNkMzgyOGM4ZDcwYzc2YTMiLCJmaWxlX25hbWUiOiIxLnR4dCIsInJlZmVyZW5jZV90eXBlIjoiZiIsImV4cGlyYXRpb24iOjE2MjY0MjA1NzQsInRpbWVzdGFtcCI6MTYxODY0NDU3NCwicmVfZW5jcnlwdGlvbl9rZXkiOiJ7XCJyMVwiOlwiOUpnci9aVDh6VnpyME1BcWFidlczdnhoWEZoVkdMSGpzcVZtVUQ1QTJEOD1cIixcInIyXCI6XCIrVEk2Z1pST3JCR3ZURG9BNFlicmNWNXpoSjJ4a0I4VU5SNTlRckwrNUhZPVwiLFwicjNcIjpcInhySjR3bENuMWhqK2Q3RXU5TXNJRzVhNnEzRXVzSlZ4a2N6YXN1K0VqQW89XCJ9Iiwic2lnbmF0dXJlIjoiZTk3NTYyOTAyODU4OTBhY2QwYTcyMzljNTFhZjc0YThmNjU2OTFjOTUwMzRjOWM0ZDJlMTFkMTQ0MTk0NmExYSJ9 + TYPE | NAME | PATH | SIZE | NUM BLOCKS | ACTUAL SIZE | ACTUAL NUM BLOCKS | LOOKUP HASH | IS ENCRYPTED +-------+--------+---------------+------+------------+-------------+-------------------+------------------------------------------------------------------+--------------- + f | one.js | /files/one.js | 5 | 1 | 19 | 1 | 566669a0240db1ca5d48ab0e013f125faf3beb34f01ef065ffb31255d9e63f43 | NO ``` -Response will be a list with information for each file/folder in the given path. The information includes lookuphash which is require for download via authticket. +Response will be a list with information for each file/folder in the given path. **The information includes lookuphash which is require for download via authticket**. #### Copy @@ -1974,9 +1991,7 @@ To stake tokens for validators: #### Unlock tokens from stake pool -Unlock a stake pool by pool owner. If the stake pool cannot be unlocked as -it would leave insufficient funds for opened offers, then `sp-unlock` tags -the stake pool to be unlocked later. This tag prevents the stake pool affecting +Unlock a stake pool by pool owner. This tag prevents the stake pool affecting blobber allocation for any new allocations. | Parameter | Required | Description | default | Valid values | From 5ec6811ba48556467c237e515cd4df7382cfffff Mon Sep 17 00:00:00 2001 From: shahnawaz-creator <117025384+shahnawaz-creator@users.noreply.github.com> Date: Sun, 5 May 2024 23:41:28 +0530 Subject: [PATCH 051/228] Update gosdk.yml (#615) --- .github/workflows/gosdk.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gosdk.yml b/.github/workflows/gosdk.yml index 45403195..d576178b 100644 --- a/.github/workflows/gosdk.yml +++ b/.github/workflows/gosdk.yml @@ -43,5 +43,5 @@ jobs: 0Chain GoSDK `${{ github.event.inputs.gosdk }}` is released. see full changelog on https://github.com/0chain/gosdk/releases/tag/${{ github.event.inputs.gosdk }} draft: false - reviewers: cnlangzi + reviewers: guruhubb labels: GoSDK From f179af5f57b17173ede495dd1180a513877c5542 Mon Sep 17 00:00:00 2001 From: dabasov Date: Sun, 5 May 2024 22:12:27 +0300 Subject: [PATCH 052/228] updated gosdk --- go.mod | 2 +- go.sum | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index 34b103a8..7eaa96d8 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.14.0-RC7 + github.com/0chain/gosdk v1.14.0 github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 diff --git a/go.sum b/go.sum index 8dc372d6..7929c6c5 100644 --- a/go.sum +++ b/go.sum @@ -40,12 +40,8 @@ github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565 h1:z+DtCR8mBsjPnEs github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565/go.mod h1:UyDC8Qyl5z9lGkCnf9RHJPMektnFX8XtCJZHXCCVj8E= 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.14.0-RC2 h1:OIpjj7mDKxVqJVlxJKm8/fPzdJRN5roXO7/plBCtmTg= -github.com/0chain/gosdk v1.14.0-RC2/go.mod h1:tgAiVAuIy+Vs1tGfKCPEuuWWARwNQBEw32y950LrqrU= -github.com/0chain/gosdk v1.14.0-RC5 h1:3/K++2jreD9jaZDAYkGXQ41ywANUq6KlIO9vjVZ3d3A= -github.com/0chain/gosdk v1.14.0-RC5/go.mod h1:tgAiVAuIy+Vs1tGfKCPEuuWWARwNQBEw32y950LrqrU= -github.com/0chain/gosdk v1.14.0-RC7 h1:hrxt3IGqUBMlZp3QrT1Tx5hTilt1biAAdh9V1SJOTc0= -github.com/0chain/gosdk v1.14.0-RC7/go.mod h1:tgAiVAuIy+Vs1tGfKCPEuuWWARwNQBEw32y950LrqrU= +github.com/0chain/gosdk v1.14.0 h1:jmvfnPphIXQo8YQcRvEEvN7S+mBZQSURmmI7FsmL2YA= +github.com/0chain/gosdk v1.14.0/go.mod h1:tgAiVAuIy+Vs1tGfKCPEuuWWARwNQBEw32y950LrqrU= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= From bbab9c828a022b0d4ac418f668a2ccfaf4f93a52 Mon Sep 17 00:00:00 2001 From: Ash-KODES Date: Sun, 12 May 2024 01:03:22 +0530 Subject: [PATCH 053/228] Adding authorizer in sp-unlock and sp-info --- cmd/stakepool.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/cmd/stakepool.go b/cmd/stakepool.go index 3ed00bc0..2142fc2b 100644 --- a/cmd/stakepool.go +++ b/cmd/stakepool.go @@ -91,10 +91,16 @@ var spInfo = &cobra.Command{ } else { providerType = sdk.ProviderValidator } + } else if flags.Changed("authorizer_id") { + if providerID, err = flags.GetString("authorizer_id"); err != nil { + log.Fatalf("Error: cannot get the value of authorizer_id") + } else { + providerType = sdk.ProviderValidator + } } if providerType == 0 || providerID == "" { - log.Fatal("Error: missing flag: one of 'blobber_id' or 'validator_id' is required") + log.Fatal("Error: missing flag: one of 'blobber_id','validator_id' or authorizer_id is required") } var info *sdk.StakePoolInfo @@ -292,10 +298,16 @@ var spUnlock = &cobra.Command{ } else { providerType = sdk.ProviderValidator } + } else if flags.Changed("authorizer_id") { + if providerID, err = flags.GetString("authorizer_id"); err != nil { + log.Fatalf("invalid 'authorizer_id' flag: %v", err) + } else { + providerType = sdk.ProviderValidator + } } if providerType == 0 || providerID == "" { - log.Fatal("missing flag: one of 'blobber_id' or 'validator_id' is required") + log.Fatal("missing flag: one of 'blobber_id','validator_id' or authorizer_id is required") } if flags.Changed("fee") { From 70dcc5af821f895a652131792565e331584c103a Mon Sep 17 00:00:00 2001 From: Ash-KODES Date: Sun, 12 May 2024 21:39:32 +0530 Subject: [PATCH 054/228] Bug fix --- cmd/stakepool.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/stakepool.go b/cmd/stakepool.go index 2142fc2b..87b1cf94 100644 --- a/cmd/stakepool.go +++ b/cmd/stakepool.go @@ -95,7 +95,7 @@ var spInfo = &cobra.Command{ if providerID, err = flags.GetString("authorizer_id"); err != nil { log.Fatalf("Error: cannot get the value of authorizer_id") } else { - providerType = sdk.ProviderValidator + providerType = sdk.ProviderAuthorizer } } @@ -302,7 +302,7 @@ var spUnlock = &cobra.Command{ if providerID, err = flags.GetString("authorizer_id"); err != nil { log.Fatalf("invalid 'authorizer_id' flag: %v", err) } else { - providerType = sdk.ProviderValidator + providerType = sdk.ProviderAuthorizer } } From 3c6ac4e97e73ec0d6b6e949da47816afb819e3e6 Mon Sep 17 00:00:00 2001 From: Hitenjain14 Date: Tue, 21 May 2024 18:11:35 +0530 Subject: [PATCH 055/228] update gosdk --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 7eaa96d8..78e48405 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.14.0 + github.com/0chain/gosdk v1.14.7 github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 diff --git a/go.sum b/go.sum index 7929c6c5..3495241f 100644 --- a/go.sum +++ b/go.sum @@ -40,8 +40,8 @@ github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565 h1:z+DtCR8mBsjPnEs github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565/go.mod h1:UyDC8Qyl5z9lGkCnf9RHJPMektnFX8XtCJZHXCCVj8E= 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.14.0 h1:jmvfnPphIXQo8YQcRvEEvN7S+mBZQSURmmI7FsmL2YA= -github.com/0chain/gosdk v1.14.0/go.mod h1:tgAiVAuIy+Vs1tGfKCPEuuWWARwNQBEw32y950LrqrU= +github.com/0chain/gosdk v1.14.7 h1:Tvsmy1wYqrCnND44EaJ+ei4mUE26AWNSI0UQJqDYD+c= +github.com/0chain/gosdk v1.14.7/go.mod h1:tgAiVAuIy+Vs1tGfKCPEuuWWARwNQBEw32y950LrqrU= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= From 112908cbcef4a713fd90fa23b0f75bee7e4ec30f Mon Sep 17 00:00:00 2001 From: Ebrahim Gomaa Date: Wed, 22 May 2024 11:58:20 +0300 Subject: [PATCH 056/228] refactor intro and add config section --- README.md | 111 +++++++++++++++++++++++++++++++++++------------------- 1 file changed, 72 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index 0d9a238c..3763b089 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,13 @@ # zbox - a CLI for Züs dStorage -zbox is a command line interface (CLI) tool to understand the capabilities of Züs dStorage and prototype your app. The utility is built using Züs [GoSDK](https://github.com/0chain/gosdk) . +zbox is a command line interface (CLI) tool to understand the capabilities of Züs dStorage and prototype your app. The utility is built using Züs [GoSDK](https://github.com/0chain/gosdk). For more information on Züs Network and the system overview, refer to [docs.zus.network](https://docs.zus.network). ![Storage](https://user-images.githubusercontent.com/65766301/120052450-0ab66700-c043-11eb-91ab-1f7aa69e133a.png) - [zbox - a CLI for Züs dStorage](#zbox---a-cli-for-züs-dstorage) - - [Züs Overview](#züs-overview) - - [Installation Instructions](#installation-instructions) - - [Build Instructions for Linux Windows Mac](#build-instructions-for-linux-windows-mac) - - [Other Platform Builds](#other-platform-builds) - - [Use custom miner/sharder](#use-custom-minersharder) + - [Getting Started](#getting-started) + - [1. Installation](#1-installation) + - [2. Run `zbox` commands](#2-run-zbox-commands) - [Running zbox](#running-zbox) - [Global Flags](#global-flags) - [Commands](#commands) @@ -71,58 +69,60 @@ zbox is a command line interface (CLI) tool to understand the capabilities of Z - [Unlock tokens from write pool](#unlock-tokens-from-write-pool) - [Download cost](#download-cost) - [Upload cost](#upload-cost) + - [Config](#config) + - [~/.zcn/config.yaml](#zcnconfigyaml) + - [Override Network](#override-network) - [Troubleshooting](#troubleshooting) -## Züs Overview -[Züs](https://zus.network/) is a high-performance cloud on a fast blockchain offering privacy and configurable uptime. It is an alternative to traditional cloud S3 and has shown better performance on a test network due to its parallel data architecture. The technology uses erasure code to distribute the data between data and parity servers. Züs storage is configurable to provide flexibility for IT managers to design for desired security and uptime, and can design a hybrid or a multi-cloud architecture with a few clicks using [Blimp's](https://blimp.software/) workflow, and can change redundancy and providers on the fly. +## Getting started -For instance, the user can start with 10 data and 5 parity providers and select where they are located globally, and later decide to add a provider on-the-fly to increase resilience, performance, or switch to a lower cost provider. +### 1. Installation -Users can also add their own servers to the network to operate in a hybrid cloud architecture. Such flexibility allows the user to improve their regulatory, content distribution, and security requirements with a true multi-cloud architecture. Users can also construct a private cloud with all of their own servers rented across the globe to have a better content distribution, highly available network, higher performance, and lower cost. +**Prerequisites** -[The QoS protocol](https://medium.com/0chain/qos-protocol-weekly-debrief-april-12-2023-44524924381f) is time-based where the blockchain challenges a provider on a file that the provider must respond within a certain time based on its size to pass. This forces the provider to have a good server and data center performance to earn rewards and income. +- Go: Installation instructions for Mac, Linux and Windows can be found [here](https://go.dev/doc/install). -The [privacy protocol](https://zus.network/build) from Züs is unique where a user can easily share their encrypted data with their business partners, friends, and family through a proxy key sharing protocol, where the key is given to the providers, and they re-encrypt the data using the proxy key so that only the recipient can decrypt it with their private key. +**Procedures** -Züs has ecosystem apps to encourage traditional storage consumption such as [Blimp](https://blimp.software/), a S3 server and cloud migration platform, and [Vult](https://vult.network/), a personal cloud app to store encrypted data and share privately with friends and family, and [Chalk](https://chalk.software/), a high-performance story-telling storage solution for NFT artists. +1. Clone the `zboxcli` repo and install -Other apps are [Bolt](https://bolt.holdings/), a wallet that is very secure with air-gapped 2FA split-key protocol to prevent hacks from compromising your digital assets, and it enables you to stake and earn from the storage providers; [Atlus](https://atlus.cloud/), a blockchain explorer and [Chimney](https://demo.chimney.software/), which allows anyone to join the network and earn using their server or by just renting one, with no prior knowledge required. - -## Installation Instructions - -### [Build Instructions for Linux Windows Mac](https://github.com/0chain/zboxcli/wiki/Build-Instructions) - -### [Other Platform Builds](https://github.com/0chain/zboxcli/wiki/Alternative-Platform-Builds) +```sh +git clone https://github.com/0chain/zboxcli.git +cd zboxcli +make install +``` -### Use custom miner/sharder +2. Add config yaml at `~/.zcn/config.yaml` -As mentioned in build guides, a ./zcn folder is created to store configuration files for zboxcli. Here is a sample network config file +The following script sets `https://demo.zus.network` as your network. +```sh +cat > ~/.zcn/config.yaml << EOF +block_worker: https://demo.zus.network/dns +signature_scheme: bls0chain +min_submit: 50 # in percentage +min_confirmation: 50 # in percentage +confirmation_chain_length: 3 +EOF ``` - --- - block_worker: https://demo.zus.network/dns - signature_scheme: bls0chain - min_submit: 50 # in percentage - min_confirmation: 50 # in percentage - confirmation_chain_length: 3 +3. Run `zboxcli` to display the list of supported commands. + +```sh +./zbox ``` +---- +For machine requirements and pre-requisites, follow the guides below: -A blockWorker is used to connect to the network instead of giving network details directly, It will fetch the network details automatically from the blockWorker's network API. By default it will use the miner/sharder values which it will get using the `block_worker_url/network`. In case you want to override those values and give custom miner/sharder to use, You have to create a `network.yaml` in your ~/.zcn (config) folder and paste the miner/sharder values in below format. +- [How to build on Linux/Mac](https://github.com/0chain/zboxcli/wiki/Build-Instructions) +- [How to build on other platforms](https://github.com/0chain/zboxcli/wiki/Alternative-Platform-Builds) -``` -miners: - - http://localhost:7071 - - http://localhost:7072 - - http://localhost:7073 -sharders: - - http://localhost:7171 -``` +### 2. Run `zbox` commands -Note: This is helpful for the Mac OS users running local cluster and having trouble with docker internal IPs (block_worker return docker IPs in local) +The following steps assume that your terminal's working directory is inside the `zboxcli` repo. ## Running zbox -When you run the `./zbox` command in terminal with no arguments, it will list all the available commands and the global flags.For working of specific command check [commands](#commands) section. +When you run the `./zbox` command in terminal with no arguments, it will list all the available commands and the global flags. For working of specific command check [commands](#commands) section. ``` Usage: @@ -2189,6 +2189,39 @@ Response: 0.0000000028 tokens / 720h0m0s for 24 B of ``` +## Config + +### ~/.zcn/config.yaml + +`~/.zcn/config.yaml` is a required `zboxcli` config. + +| Field | Description | Value type | +| --------------------------- | ------------------------------------------------------------ | ---------- | +| `block_worker` | The URL to chain network DNS that provides the lists of miners and sharders | string | +| `signature_scheme` | The signature scheme used in the network. This would be `bls0chain` for most networks | string | +| `min_submit` | The desired minimum success ratio (in percent) to meet when submitting transactions to miners | integer | +| `min_confirmation` | The desired minimum success ratio (in percent) to meet when verifying transactions on sharders | integer | +| `confirmation_chain_length` | The desired chain length to meet when verifying transactions | integer | + +### Override Network + +Network nodes are automatically discovered using the `block_worker` provided on [config file](https://github.com/0chain/zwalletcli/blob/staging/network/config.yaml). + +To override/limit the nodes used on `zbox`, create `~/.zcn/network.yaml` as shown below. + +```sh +cat > ~/.zcn/network.yaml << EOF +miners: + - http://demo1.zus.network:31201 + - http://demo1.zus.network:31202 + - http://demo1.zus.network:31203 +sharders: + - http://demo1.zus.network:31101 +EOF +``` + +Overriding the nodes can be useful in local chain setup. In some cases, the block worker might return URLs with IP/alias only accessible within the docker network. + ## Troubleshooting 1. Both `rp-info` and `rp-lock` are not working. From 902a9d3ec272b4de0cebabdfb4fc6e3543f2710a Mon Sep 17 00:00:00 2001 From: dabasov Date: Thu, 30 May 2024 23:11:37 +0300 Subject: [PATCH 057/228] updated gosdk --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 78e48405..a6ecd910 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.14.7 + github.com/0chain/gosdk v1.15.0 github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 @@ -33,7 +33,7 @@ require ( github.com/hashicorp/golang-lru/v2 v2.0.1 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/herumi/bls-go-binary v1.31.0 // indirect - github.com/hitenjain14/fasthttp v0.0.0-20240229173600-722723e15e17 // indirect + github.com/hitenjain14/fasthttp v0.0.0-20240527123209-06019e79bff9 // indirect github.com/inconshreveable/mousetrap v1.0.1 // indirect github.com/klauspost/compress v1.17.0 // indirect github.com/klauspost/cpuid/v2 v2.2.4 // indirect diff --git a/go.sum b/go.sum index 3495241f..37a27358 100644 --- a/go.sum +++ b/go.sum @@ -40,8 +40,8 @@ github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565 h1:z+DtCR8mBsjPnEs github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565/go.mod h1:UyDC8Qyl5z9lGkCnf9RHJPMektnFX8XtCJZHXCCVj8E= 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.14.7 h1:Tvsmy1wYqrCnND44EaJ+ei4mUE26AWNSI0UQJqDYD+c= -github.com/0chain/gosdk v1.14.7/go.mod h1:tgAiVAuIy+Vs1tGfKCPEuuWWARwNQBEw32y950LrqrU= +github.com/0chain/gosdk v1.15.0 h1:yPIc1MejN/NHivMP5oRUBVzZ/JbcomnqWNR2tJZXgrQ= +github.com/0chain/gosdk v1.15.0/go.mod h1:Hzl56JJ66ZmoyNS7CbTJue7wUugBYvNx8/qJzTRWmkI= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= @@ -215,8 +215,8 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/herumi/bls-go-binary v1.31.0 h1:L1goQ2tMtGgpXCg5AwHAdJQpLs/pfnWWEc3Wog6OhmI= github.com/herumi/bls-go-binary v1.31.0/go.mod h1:O4Vp1AfR4raRGwFeQpr9X/PQtncEicMoOe6BQt1oX0Y= -github.com/hitenjain14/fasthttp v0.0.0-20240229173600-722723e15e17 h1:FbyIK0BfvXVZTOxKOe2dlxJqSPSF2ZXOv2Mc7dvS7sc= -github.com/hitenjain14/fasthttp v0.0.0-20240229173600-722723e15e17/go.mod h1:RZMcXy7u4S+E97IXYTe7WHZ3+mCYOh4vys8PkIGZeXk= +github.com/hitenjain14/fasthttp v0.0.0-20240527123209-06019e79bff9 h1:Z6Mu2JCsW2hbqx91L0HNPRPQ10RyAFvPocQHlrRo1Jk= +github.com/hitenjain14/fasthttp v0.0.0-20240527123209-06019e79bff9/go.mod h1:RZMcXy7u4S+E97IXYTe7WHZ3+mCYOh4vys8PkIGZeXk= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= github.com/holiman/uint256 v1.2.2-0.20230321075855-87b91420868c h1:DZfsyhDK1hnSS5lH8l+JggqzEleHteTYfutAiVlSUM8= From b0fed8e928583cf385ae9ffbf8a0586a693977f7 Mon Sep 17 00:00:00 2001 From: devyetii Date: Mon, 3 Jun 2024 21:18:03 +0200 Subject: [PATCH 058/228] fix readme --- README.md | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/README.md b/README.md index 3763b089..0e76cd90 100644 --- a/README.md +++ b/README.md @@ -686,8 +686,6 @@ on the blockchain not the validator. | min_stake | no | update minimum stake | | float | | num_delegates | no | update maximum number of delegates | | int | | service_charge | no | update service charge | | float | -
- validator-update Example @@ -2221,19 +2219,3 @@ EOF ``` Overriding the nodes can be useful in local chain setup. In some cases, the block worker might return URLs with IP/alias only accessible within the docker network. - -## Troubleshooting - -1. Both `rp-info` and `rp-lock` are not working. - -``` -./zbox rp-info -``` - -Response: - -``` -Failed to get read pool info: error requesting read pool info: consensus_failed: consensus failed on sharders -``` - -This can happen if read pool is not yet created for wallet. Read pool is usually created when new wallet is created by `zbox` or `zwallet`. However, if wallet is recovered through `zwallet recoverwallet`, read pool may not have been created. Simply run `zbox rp-create` to create a read pool. From 88986f474bedc78b39740cbb45aed5f16ce237c7 Mon Sep 17 00:00:00 2001 From: Hitenjain14 Date: Tue, 11 Jun 2024 11:57:22 +0530 Subject: [PATCH 059/228] add flag for skip check --- cmd/delete.go | 3 +++ go.mod | 2 +- go.sum | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/cmd/delete.go b/cmd/delete.go index 9259efcf..f712e2f4 100644 --- a/cmd/delete.go +++ b/cmd/delete.go @@ -33,6 +33,8 @@ var deleteCmd = &cobra.Command{ os.Exit(1) } remotePath := cmd.Flag("remotepath").Value.String() + skipCheck, _ := cmd.Flags().GetBool("skipcheck") + allocationObj.SetCheckStatus(!skipCheck) err = allocationObj.DoMultiOperation([]sdk.OperationRequest{ { @@ -53,6 +55,7 @@ func init() { rootCmd.AddCommand(deleteCmd) deleteCmd.PersistentFlags().String("allocation", "", "Allocation ID") deleteCmd.PersistentFlags().String("remotepath", "", "Remote path of the object to delete") + deleteCmd.PersistentFlags().Bool("skipcheck", false, "Skip the repair check") deleteCmd.MarkFlagRequired("allocation") deleteCmd.MarkFlagRequired("remotepath") diff --git a/go.mod b/go.mod index a6ecd910..c66d2cbe 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.15.0 + github.com/0chain/gosdk v1.15.2 github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 diff --git a/go.sum b/go.sum index 37a27358..f3fa97d3 100644 --- a/go.sum +++ b/go.sum @@ -40,8 +40,8 @@ github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565 h1:z+DtCR8mBsjPnEs github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565/go.mod h1:UyDC8Qyl5z9lGkCnf9RHJPMektnFX8XtCJZHXCCVj8E= 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.15.0 h1:yPIc1MejN/NHivMP5oRUBVzZ/JbcomnqWNR2tJZXgrQ= -github.com/0chain/gosdk v1.15.0/go.mod h1:Hzl56JJ66ZmoyNS7CbTJue7wUugBYvNx8/qJzTRWmkI= +github.com/0chain/gosdk v1.15.2 h1:fsWl/kiJ5QW/vLVqfwlcG50JmQ6u1lchPyUiMIlOPrw= +github.com/0chain/gosdk v1.15.2/go.mod h1:Hzl56JJ66ZmoyNS7CbTJue7wUugBYvNx8/qJzTRWmkI= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= From 55da438fed6d68671f2abe4fe388767591fc5324 Mon Sep 17 00:00:00 2001 From: Hitenjain14 Date: Tue, 11 Jun 2024 12:55:08 +0530 Subject: [PATCH 060/228] fix status check --- cmd/delete.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/delete.go b/cmd/delete.go index f712e2f4..ced6e257 100644 --- a/cmd/delete.go +++ b/cmd/delete.go @@ -34,7 +34,7 @@ var deleteCmd = &cobra.Command{ } remotePath := cmd.Flag("remotepath").Value.String() skipCheck, _ := cmd.Flags().GetBool("skipcheck") - allocationObj.SetCheckStatus(!skipCheck) + allocationObj.SetCheckStatus(skipCheck) err = allocationObj.DoMultiOperation([]sdk.OperationRequest{ { From 0b4220fa6df850c3e9102d8a519eec78704e9728 Mon Sep 17 00:00:00 2001 From: storybehind Date: Fri, 14 Jun 2024 13:48:21 +0530 Subject: [PATCH 061/228] repair-size command --- cmd/repair.go | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/cmd/repair.go b/cmd/repair.go index 5131d58e..1bc09731 100644 --- a/cmd/repair.go +++ b/cmd/repair.go @@ -1,6 +1,8 @@ package cmd import ( + "encoding/json" + "fmt" "os" "sync" @@ -55,12 +57,60 @@ var startRepair = &cobra.Command{ }, } +var repairSize = &cobra.Command{ + Use: "repair-size", + Short: "gets only size to repair file to blobbers", + Long: `gets only size to repair file to blobbers`, + Args: cobra.MinimumNArgs(0), + Run: func(cmd *cobra.Command, args []string) { + fflags := cmd.Flags() + if !fflags.Changed("allocation") { + PrintError("Error: allocation flag is missing") + os.Exit(1) + } + + repairPath := "/" + var err error + if fflags.Changed("repairpath") { + if repairPath, err = fflags.GetString("repairpath"); err != nil { + PrintError("Error: repairpath is not of string type", err) + os.Exit(1) + } + } + + allocationID := cmd.Flag("allocation").Value.String() + allocationObj, err := sdk.GetAllocation(allocationID) + if err != nil { + PrintError("Error fetching the allocation.", err) + os.Exit(1) + } + + size, err := allocationObj.RepairSize(repairPath) + if err != nil { + PrintError("get repair size failed: ", err) + os.Exit(1) + } + + jsonBytes, err := json.Marshal(size) + if err != nil { + PrintError("error marshaling size: ", err) + os.Exit(1) + } + fmt.Println(string(jsonBytes)) + }, +} + func init() { rootCmd.AddCommand(startRepair) + rootCmd.AddCommand(repairSize) startRepair.PersistentFlags().String("allocation", "", "Allocation ID") startRepair.PersistentFlags().String("rootpath", "", "File path for local files ") startRepair.PersistentFlags().String("repairpath", "", "Path to repair") startRepair.MarkFlagRequired("allocation") startRepair.MarkFlagRequired("rootpath") startRepair.MarkFlagRequired("repairpath") + + repairSize.PersistentFlags().String("allocation", "", "Allocation ID") + repairSize.PersistentFlags().String("repairpath", "", "Path to repair") + repairSize.MarkFlagRequired("allocation") } From 1897610fb150450f2d75ac56ab8cbd4a6c13063a Mon Sep 17 00:00:00 2001 From: storybehind Date: Fri, 14 Jun 2024 14:00:36 +0530 Subject: [PATCH 062/228] update gosdk version --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index a6ecd910..fb7de37b 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.15.0 + github.com/0chain/gosdk v1.15.2-0.20240614082721-1b8ad4f48bc6 github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 diff --git a/go.sum b/go.sum index 37a27358..49ba661c 100644 --- a/go.sum +++ b/go.sum @@ -42,6 +42,8 @@ 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.15.0 h1:yPIc1MejN/NHivMP5oRUBVzZ/JbcomnqWNR2tJZXgrQ= github.com/0chain/gosdk v1.15.0/go.mod h1:Hzl56JJ66ZmoyNS7CbTJue7wUugBYvNx8/qJzTRWmkI= +github.com/0chain/gosdk v1.15.2-0.20240614082721-1b8ad4f48bc6 h1:f8fN6PuvE/Iu1LqrJH5q20eWOFB/NjlDA8TIDMqZgAg= +github.com/0chain/gosdk v1.15.2-0.20240614082721-1b8ad4f48bc6/go.mod h1:Hzl56JJ66ZmoyNS7CbTJue7wUugBYvNx8/qJzTRWmkI= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= From 586c46710ef59ce5cc795841414182f85e52c19a Mon Sep 17 00:00:00 2001 From: dabasov Date: Wed, 26 Jun 2024 23:39:31 +0300 Subject: [PATCH 063/228] updated gosdk --- go.mod | 2 +- go.sum | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index c66d2cbe..1eee8e89 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.15.2 + github.com/0chain/gosdk v1.16.0-RC1 github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 diff --git a/go.sum b/go.sum index f3fa97d3..9aafe919 100644 --- a/go.sum +++ b/go.sum @@ -42,6 +42,7 @@ 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.15.2 h1:fsWl/kiJ5QW/vLVqfwlcG50JmQ6u1lchPyUiMIlOPrw= github.com/0chain/gosdk v1.15.2/go.mod h1:Hzl56JJ66ZmoyNS7CbTJue7wUugBYvNx8/qJzTRWmkI= +github.com/0chain/gosdk v1.16.0-RC1/go.mod h1:y7Ucdmv40VltqulZnncMNjNQ4piX5Dta5ujNmPmXnxg= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= From 0c8e40489b0ddd15902ec2965cfb7ef615103f0a Mon Sep 17 00:00:00 2001 From: dabasov Date: Wed, 26 Jun 2024 23:46:10 +0300 Subject: [PATCH 064/228] updated gosdk --- go.mod | 2 ++ go.sum | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 1eee8e89..0727ad1e 100644 --- a/go.mod +++ b/go.mod @@ -29,6 +29,8 @@ require ( github.com/google/uuid v1.3.0 // indirect github.com/gorilla/websocket v1.5.0 // indirect github.com/h2non/filetype v1.1.4-0.20231228185113-6469358c2bcb // indirect + github.com/hack-pad/go-webworkers v0.1.0 // indirect + github.com/hack-pad/safejs v0.1.1 // indirect github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect github.com/hashicorp/golang-lru/v2 v2.0.1 // indirect github.com/hashicorp/hcl v1.0.0 // indirect diff --git a/go.sum b/go.sum index 9aafe919..1cda9020 100644 --- a/go.sum +++ b/go.sum @@ -40,8 +40,7 @@ github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565 h1:z+DtCR8mBsjPnEs github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565/go.mod h1:UyDC8Qyl5z9lGkCnf9RHJPMektnFX8XtCJZHXCCVj8E= 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.15.2 h1:fsWl/kiJ5QW/vLVqfwlcG50JmQ6u1lchPyUiMIlOPrw= -github.com/0chain/gosdk v1.15.2/go.mod h1:Hzl56JJ66ZmoyNS7CbTJue7wUugBYvNx8/qJzTRWmkI= +github.com/0chain/gosdk v1.16.0-RC1 h1:X/tRIwEQP86boEqH+L3f67QsMbzy2I9MR2jEf+JopTA= github.com/0chain/gosdk v1.16.0-RC1/go.mod h1:y7Ucdmv40VltqulZnncMNjNQ4piX5Dta5ujNmPmXnxg= 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= @@ -204,6 +203,10 @@ github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWm github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/h2non/filetype v1.1.4-0.20231228185113-6469358c2bcb h1:GlQyMv2C48qmfPItvAXFoyN341Swxp9JNVeUZxnmbJw= github.com/h2non/filetype v1.1.4-0.20231228185113-6469358c2bcb/go.mod h1:319b3zT68BvV+WRj7cwy856M2ehB3HqNOt6sy1HndBY= +github.com/hack-pad/go-webworkers v0.1.0 h1:QHBJpkXJgW0QRi2iiUGcxwGnmy7lQJL0F8UfsgMXKhA= +github.com/hack-pad/go-webworkers v0.1.0/go.mod h1:/rmjjgnlw0CursmeqRtP0NGIqo8CR+0o6AtzFydUHJ4= +github.com/hack-pad/safejs v0.1.1 h1:d5qPO0iQ7h2oVtpzGnLExE+Wn9AtytxIfltcS2b9KD8= +github.com/hack-pad/safejs v0.1.1/go.mod h1:HdS+bKF1NrE72VoXZeWzxFOVQVUSqZJAG0xNCnb+Tio= github.com/hashicorp/go-bexpr v0.1.10 h1:9kuI5PFotCboP3dkDYFr/wi0gg0QVbSNz5oFRpxn4uE= github.com/hashicorp/go-bexpr v0.1.10/go.mod h1:oxlubA2vC/gFVfX1A6JGp7ls7uCDlfJn732ehYYg+g0= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= From d593e1de52333a11e9d703e9a82f1fb6ea96fe33 Mon Sep 17 00:00:00 2001 From: Jayash Satolia <73050737+Jayashsatolia403@users.noreply.github.com> Date: Fri, 28 Jun 2024 00:07:30 +0530 Subject: [PATCH 065/228] Update gosdk --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 0727ad1e..2c96b7e6 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.16.0-RC1 + github.com/0chain/gosdk v1.16.0-RC2 github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 diff --git a/go.sum b/go.sum index 1cda9020..eb51e813 100644 --- a/go.sum +++ b/go.sum @@ -40,8 +40,8 @@ github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565 h1:z+DtCR8mBsjPnEs github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565/go.mod h1:UyDC8Qyl5z9lGkCnf9RHJPMektnFX8XtCJZHXCCVj8E= 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.16.0-RC1 h1:X/tRIwEQP86boEqH+L3f67QsMbzy2I9MR2jEf+JopTA= -github.com/0chain/gosdk v1.16.0-RC1/go.mod h1:y7Ucdmv40VltqulZnncMNjNQ4piX5Dta5ujNmPmXnxg= +github.com/0chain/gosdk v1.16.0-RC2 h1:S8vp6GROrhizUqUYZCG71hP27p/lAFoSy0J5chJCwug= +github.com/0chain/gosdk v1.16.0-RC2/go.mod h1:y7Ucdmv40VltqulZnncMNjNQ4piX5Dta5ujNmPmXnxg= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= From 64e7f289654f5c83e57c405b01caf2dc01a1f0d4 Mon Sep 17 00:00:00 2001 From: Yaroslav Svitlytskyi <53532703+YarikRevich@users.noreply.github.com> Date: Sat, 6 Jul 2024 09:52:51 +0200 Subject: [PATCH 066/228] Feature: migrate from the usage of Tenderly forks in favour of Tenderly virtual testnets for ST (#629) * feature: performed tenderly virtual testnets migration * fix: fixed bugs --- .github/workflows/tests.yml | 91 ++++++------------------------------- 1 file changed, 13 insertions(+), 78 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 85c66bf8..87c1865a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -95,83 +95,18 @@ jobs: version: '1.7' force: 'false' - - name: "Create Tenderly fork" + - name: "Create Tenderly virtual testnet" run: | echo "TENDERLY_CREATION_INFO=$(curl -X POST \ - -H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \ - -H "Content-Type: application/json" \ - -d '{"alias":"mainnet-dev-${{ env.RUNNER_NUMBER }}-${{ github.run_id }}${{ github.run_attempt }}", "description":"", "block_number": 18539779, "network_id":"1"}' \ - https://api.tenderly.co/api/v1/account/zus_network/project/project/fork)" >> $GITHUB_ENV + -H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \ + -H "Content-Type: application/json" \ + -d '{"slug":"mainnet-dev-${{ env.RUNNER_NUMBER }}-${{ github.run_id }}","displayName":"mainnet-dev-${{ env.RUNNER_NUMBER }}-${{ github.run_id }}","description":"","visibility":"TEAM","tags":{"purpose":"development"},"networkConfig":{"networkId":"1","blockNumber":"18512782","chainConfig":{"chainId":"1"},"baseFeePerGas":"1"},"explorerConfig":{"enabled":false,"verificationVisibility":"bytecode"},"syncState":false}' \ + https://api.tenderly.co/api/v1/account/zus_network/project/project/testnet/container)" >> $GITHUB_ENV - - name: "Parse Tenderly fork creation transaction result" + - name: "Parse Tenderly virtual testnet creation transaction result" run: | - echo "TENDERLY_FORK_ID=$(echo '${{ env.TENDERLY_CREATION_INFO }}' | jq -r '.simulation_fork.id')" >> $GITHUB_ENV - echo "TENDERLY_ROOT_TRANSACTION_ID=$(echo '${{ env.TENDERLY_CREATION_INFO }}' | jq -r '.root_transaction.id')" >> $GITHUB_ENV - - - name: "Retrieve Tenderly fork block number" - run: | - echo "TENDERLY_FORK_BLOCK_NUMBER=$(curl -X GET \ - -H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \ - -H "Content-Type: application/json" \ - https://api.tenderly.co/api/v1/network/1/block-number | jq -r '.block_number')" >> $GITHUB_ENV - - echo "TENDERLY_FORK_BLOCK_NUMBER=$((${{ env.TENDERLY_FORK_BLOCK_NUMBER }} + 1))" >> GITHUB_ENV - - - name: "Transfer Bridge ownership in Tenderly fork" - run: | - echo "TENDERLY_ROOT_TRANSACTION_ID=$(curl -X POST \ - -H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \ - -H "Content-Type: application/json" \ - -d '{ - "network_id": "1", - "block_number": ${{ env.TENDERLY_FORK_BLOCK_NUMBER }}, - "transaction_index": null, - "from": "0xed8f3170db6d1a71c8fa6d8d73cc2c51db95d5a4", - "input": "0xf2fde38b0000000000000000000000008e25cfd9bd6c0ca67a5522cd920b3c66d39d6e97", - "to": "0x7700d773022b19622095118fadf46f7b9448be9b", - "gas": 8000000, - "gas_price": "0", - "value": "0", - "access_list": [], - "generate_access_list": true, - "save": true, - "source": "dashboard", - "block_header": null, - "root": "${{ env.TENDERLY_ROOT_TRANSACTION_ID }}", - "skip_fork_head_update": false, - "alias": "", - "description": "Transfer ownership to 0x8E25cfd9bd6c0ca67a5522cd920b3c66D39d6E97" - }' \ - https://api.tenderly.co/api/v1/account/zus_network/project/project/fork/${{ env.TENDERLY_FORK_ID }}/simulate | jq -r '.simulation.id')" >> $GITHUB_ENV - - echo "TENDERLY_FORK_BLOCK_NUMBER=$((${{ env.TENDERLY_FORK_BLOCK_NUMBER }} + 1))" >> GITHUB_ENV - - - name: "Transfer Authorizers ownership in Tenderly fork" - run: | - curl -X POST \ - -H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \ - -H "Content-Type: application/json" \ - -d '{ - "network_id": "1", - "block_number": ${{ env.TENDERLY_FORK_BLOCK_NUMBER }}, - "transaction_index": null, - "from": "0xed8f3170db6d1a71c8fa6d8d73cc2c51db95d5a4", - "input": "0xf2fde38b0000000000000000000000008e25cfd9bd6c0ca67a5522cd920b3c66d39d6e97", - "to": "0x481dab4407b9880de0a68dc62e6af611c4949e42", - "gas": 8000000, - "gas_price": "0", - "value": "0", - "access_list": [], - "generate_access_list": true, - "save": true, - "source": "dashboard", - "block_header": null, - "root": "${{ env.TENDERLY_ROOT_TRANSACTION_ID }}", - "skip_fork_head_update": false, - "alias": "", - "description": "Transfer ownership to 0x8E25cfd9bd6c0ca67a5522cd920b3c66D39d6E97" - }' \ - https://api.tenderly.co/api/v1/account/zus_network/project/project/fork/${{ env.TENDERLY_FORK_ID }}/simulate + echo "TENDERLY_VIRTUAL_TESTNET_ID=$(echo '${{ env.TENDERLY_CREATION_INFO }}' | jq -r '.container.id')" >> $GITHUB_ENV + echo "TENDERLY_VIRTUAL_TESTNET_RPC_ID=$(echo '${{ env.TENDERLY_CREATION_INFO }}' | jq -r '.container.connectivityConfig.endpoints[0].id')" >> $GITHUB_ENV - name: "Deploy 0Chain" uses: 0chain/actions/deploy-0chain@master @@ -181,10 +116,10 @@ jobs: teardown_condition: "TESTS_PASSED" zbox_cli_branch: ${{ env.CURRENT_BRANCH }} SUBGRAPH_API_URL: ${{ secrets.SUBGRAPH_API_URL }} - TENDERLY_FORK_ID: ${{ env.TENDERLY_FORK_ID }} + TENDERLY_VIRTUAL_TESTNET_RPC_ID: ${{ env.TENDERLY_VIRTUAL_TESTNET_RPC_ID }} graphnode_sc: ${{ secrets.GRAPHNODE_SC }} graphnode_network: ${{ secrets.GRAPHNODE_NETWORK }} - graphnode_ethereum_node_url: https://rpc.tenderly.co/fork/${{ env.TENDERLY_FORK_ID }} + graphnode_ethereum_node_url: https://virtual.mainnet.rpc.tenderly.co/${{ env.TENDERLY_VIRTUAL_TESTNET_RPC_ID }} svc_account_secret: ${{ secrets.SVC_ACCOUNT_SECRET }} - name: "Run System tests" @@ -198,19 +133,19 @@ jobs: archive_results: true run_flaky_tests: false retry_failures: true - TENDERLY_FORK_ID: ${{ env.TENDERLY_FORK_ID }} + TENDERLY_VIRTUAL_TESTNET_RPC_ID: ${{ env.TENDERLY_VIRTUAL_TESTNET_RPC_ID }} DEVOPS_CHANNEL_WEBHOOK_URL: ${{ secrets.DEVOPS_CHANNEL_WEBHOOK_URL }} S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }} S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }} run_smoke_tests: ${{ github.ref != 'refs/heads/staging' && github.base_ref != 'staging' && github.ref != 'refs/heads/master' && github.base_ref != 'master' }} - - name: "Remove Tenderly fork" + - name: "Remove Tenderly virtual testnet" if: always() run: | curl -X DELETE \ -H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \ -H "Content-Type: application/json" \ - https://api.tenderly.co/api/v1/account/zus_network/project/project/fork/${{ env.TENDERLY_FORK_ID }} + https://api.tenderly.co/api/v1/account/zus_network/project/project/testnet/container/${{ env.TENDERLY_VIRTUAL_TESTNET_ID }} - name: "Set PR status as ${{ job.status }}" if: ${{ (success() || failure()) && steps.findPr.outputs.number }} From 0921b57821151e63118169c38227aabc0f8ffd38 Mon Sep 17 00:00:00 2001 From: dabasov Date: Tue, 9 Jul 2024 22:16:34 +0300 Subject: [PATCH 067/228] updated gosdk --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 2c96b7e6..536876ae 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.16.0-RC2 + github.com/0chain/gosdk v1.16.0 github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 diff --git a/go.sum b/go.sum index eb51e813..6c3b152e 100644 --- a/go.sum +++ b/go.sum @@ -40,8 +40,8 @@ github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565 h1:z+DtCR8mBsjPnEs github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565/go.mod h1:UyDC8Qyl5z9lGkCnf9RHJPMektnFX8XtCJZHXCCVj8E= 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.16.0-RC2 h1:S8vp6GROrhizUqUYZCG71hP27p/lAFoSy0J5chJCwug= -github.com/0chain/gosdk v1.16.0-RC2/go.mod h1:y7Ucdmv40VltqulZnncMNjNQ4piX5Dta5ujNmPmXnxg= +github.com/0chain/gosdk v1.16.0 h1:3CKuU9i9d+X2/htJOIyxNwviKG5H/lp+q8ogzCgnoQI= +github.com/0chain/gosdk v1.16.0/go.mod h1:y7Ucdmv40VltqulZnncMNjNQ4piX5Dta5ujNmPmXnxg= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= From c87e0d6c962d6f60f281b620cb4f09fe2d950cde Mon Sep 17 00:00:00 2001 From: storybehind Date: Mon, 22 Jul 2024 19:56:29 +0530 Subject: [PATCH 068/228] basic workflow to build and distribute --- .github/workflows/distribute-zboxcli.yml | 142 +++++++++++++++++++++++ scripts/debian/Dockerfile | 51 ++++++++ 2 files changed, 193 insertions(+) create mode 100644 .github/workflows/distribute-zboxcli.yml create mode 100644 scripts/debian/Dockerfile diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml new file mode 100644 index 00000000..445a5333 --- /dev/null +++ b/.github/workflows/distribute-zboxcli.yml @@ -0,0 +1,142 @@ +name: Build, Distribute and Test zbox + +on: + push: + branches: + - main + - packaging + +env: + APP_NAME: zbox + APP_VERSION: 1.16.0-1 + GO_VERSION: 1.21.0 + SRC_DIR: ${{ github.workspace }}/src + OUTPUT_DIR: ${{ github.workspace }}/output + PACKAGE_DIR: ${{ github.workspace }}/package + DEB_DIR: ${{ github.workspace }}/deb + REPO_DIR: ${{ github.workspace }}/aptrepo + GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }} + DISTRIBUTIONS: focal + ARCHITECTURES: amd64 + REMOTE_SERVER: + REMOTE_USER: + REMOTE_PATH: + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + distro: + - name: focal + base_image: ubuntu-20.04 + arch: + - name: amd64 + platform: linux/amd64 + + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + path: ${{ env.SRC_DIR }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y docker-ce docker-ce-cli containerd.io tar gnupg dpkg-sig + + - name: Setup directories + run: | + mkdir -p ${{ env.DEB_DIR }} + mkdir -p ${{ env.OUTPUT_DIR }} + mkdir -p ${{ env.PACKAGE_DIR }} + + - name: Build Docker image + run: | + docker buildx build \ + --platform ${{ matrix.arch.platform }} \ + --build-arg GO_VERSION=${{ env.GO_VERSION }} \ + --build-arg BASE_IMAGE=${{ matrix.distro.base_image }} \ + --build-arg TARGETARCH=${{ matrix.arch.name }} \ + --build-arg VERSION=${{ env.APP_VERSION }} \ + --tag ${{ env.APP_NAME }}-${{ env.APP_VERSION }}-${{ matrix.distro.name }}-${{ matrix.arch.name }} \ + --load \ + --output type=docker,dest=${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}-${{ env.APP_VERSION }}-${{ matrix.distro.name }}-${{ matrix.arch.name }}.tar \ + -f ${{ env.SRC_DIR }}/scripts/debian/Dockerfile ${{ env.SRC_DIR }} + + - name: Load Docker image + run: | + docker load -i ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}-${{ env.APP_VERSION }}-${{ matrix.distro.name }}-${{ matrix.arch.name }}.tar + + - name: Extract binary from container + run: | + CONTAINER_ID=$(docker create ${{ env.APP_NAME }}-${{ env.APP_VERSION }}-${{ matrix.distro.name }}-${{ matrix.arch.name }}) + docker cp ${CONTAINER_ID}:/zbox ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}_${{ env.APP_VERSION }}~${{ matrix.distro.name }}_${{ matrix.arch.name }} + docker rm ${CONTAINER_ID} + + - name: Package binary + run: | + mkdir -p ${{ env.PACKAGE_DIR }}/DEBIAN + mkdir -p ${{ env.PACKAGE_DIR }}/usr/local/bin + + cp ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}_${{ env.APP_VERSION }}~${{ matrix.distro.name }}_${{ matrix.arch.name }} ${{ env.PACKAGE_DIR }}/usr/local/bin/ + + cat < ${{ env.PACKAGE_DIR }}/DEBIAN/control + Package: ${{ env.APP_NAME }} + Version: ${{ env.APP_VERSION }} + Architecture: ${{ matrix.arch.name }} + Maintainer: none + Description: zbox is a command line interface (CLI) tool to understand the capabilities of Züs dStorage and prototype your app + EOT + + tar czf "${{ env.OUTPUT_DIR }}/data.tar.gz" -C "${{ env.PACKAGE_DIR }}" . + echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --batch --yes --passphrase-fd 0 --pinentry-mode loopback --detach-sign --armor -o "${{ env.PACKAGE_DIR }}/DEBIAN/signature.asc" "${{ env.OUTPUT_DIR }}/data.tar.gz" + dpkg-deb -b ${{ env.PACKAGE_DIR }} ${{ env.DEB_DIR }}/${{ env.APP_NAME }}_${{ env.APP_VERSION }}~${{ matrix.distro.name }}_${{ matrix.arch.name }}.deb + + distribute: + runs-on: ubuntu-latest + needs: build + + steps: + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y apt-utils dpkg-sig gnupg + + - name: Download APT repo + run: | + mkdir -p ${{ env.REPO_DIR }} + scp -i ${{ secrets.SSH_KEY }} ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:${{ env.REMOTE_PATH }}/* ${{ env.REPO_DIR }} + + - name: Copy debian packages + run : | + mkdir -p ${{ env.REPO_DIR }}/pool/main/z/${APP_NAME}/ + cp ${{ env.DEB_DIR }}/*.deb ${{ env.REPO_DIR }}/pool/main/z/${APP_NAME}/ + + - name: Update APT repo + run: | + cd ${{ env.REPO_DIR }} + for dist in ${{ env.DISTRIBUTIONS }}; do + for arch in ${{ env.ARCHITECTURES }}; do + mkdir -p dists/${dist}/main/binary-${arch} + apt-ftparchive packages pool/main > dists/${dist}/main/binary-${arch}/Packages + done + apt-ftparchive release -o APT::FTPArchive::Release::Origin="${{ env.APP_NAME }}" \ + -o APT::FTPArchive::Release::Label="${{ env.APP_NAME }}" \ + -o APT::FTPArchive::Release::Suite="${dist}" \ + -o APT::FTPArchive::Release::Codename="${dist}" \ + -o APT::FTPArchive::Release::Version="${{ env.APP_VERSION }}" \ + -o APT::FTPArchive::Release::Architectures="${{ env.ARCHITECTURES }}" \ + -o APT::FTPArchive::Release::Components="main" \ + dists/${dist} > dists/${dist}/Release + + echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --default-key ${GPG_KEY_ID} --batch --yes --passphrase-fd 0 -abs -o dists/${dist}/Release.gpg dists/${dist}/Release + echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --default-key ${GPG_KEY_ID} --batch --yes --passphrase-fd 0 --clearsign -o dists/${dist}/InRelease dists/${dist}/Release + done + + - name: Upload APT repo to remote + run: | + scp -i ${{ secrets.SSH_KEY }} -r ${{ env.REPO_DIR }}/* ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:${{ env.REMOTE_PATH }} \ No newline at end of file diff --git a/scripts/debian/Dockerfile b/scripts/debian/Dockerfile new file mode 100644 index 00000000..e56a92e1 --- /dev/null +++ b/scripts/debian/Dockerfile @@ -0,0 +1,51 @@ +# syntax=docker/dockerfile:latest + +ARG BASE_IMAGE + +# Stage 1: Build zboxcli on the base image +FROM --platform=$BUILDPLATFORM ${BASE_IMAGE} AS builder + +# Enable shell debugging +SHELL ["/bin/bash", "-o", "pipefail", "-c"] +RUN set -x + +# Install dependencies +RUN echo "Installing dependencies" \ + && apt-get update && \ + apt-get install -y wget tar software-properties-common && \ + add-apt-repository ppa:ubuntu-toolchain-r/test && \ + apt-get update && \ + apt-get install -y gcc-11 g++-11 + +# Set gcc-11 as default +RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100 && \ + update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 100 && \ + update-alternatives --set gcc /usr/bin/gcc-11 && \ + update-alternatives --set g++ /usr/bin/g++-11 + + +# Download and install Go +ARG GO_VERSION=1.21.0 +ARG TARGETARCH +RUN echo "Downloading and installing Go version ${GO_VERSION} for architecture ${TARGETARCH}" && \ + wget https://go.dev/dl/go${GO_VERSION}.linux-${TARGETARCH}.tar.gz -O /tmp/go.tar.gz && \ + tar -C /usr/local -xzf /tmp/go.tar.gz && \ + ln -s /usr/local/go/bin/go /usr/local/bin/go + +# Set Go environment variables +ENV GOROOT=/usr/local/go +ENV GOPATH=/root/go +ENV PATH=$GOPATH/bin:$GOROOT/bin:$PATH + +# Setting up working directory and copying files +WORKDIR /zboxcli +COPY . . + +# Building zboxcli +ARG VERSION +RUN go env +RUN CGO_ENABLED=1 GOOS=linux GOARCH=${TARGETARCH} go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${VERSION}" -o /zbox . + +# Stage 2: Create a minimal image with the binary +# FROM scratch +# COPY --from=builder /zbox /zbox From cea40dbf5bcc12497d7cbb8bccf5f934f2dab5b8 Mon Sep 17 00:00:00 2001 From: storybehind Date: Mon, 22 Jul 2024 20:04:33 +0530 Subject: [PATCH 069/228] update docker image --- .github/workflows/distribute-zboxcli.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index 445a5333..18d32cb4 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -29,7 +29,7 @@ jobs: matrix: distro: - name: focal - base_image: ubuntu-20.04 + base_image: ubuntu:20.04 arch: - name: amd64 platform: linux/amd64 From 5ca81f7fa8c17971fe28e7542442b1e3d513e1bb Mon Sep 17 00:00:00 2001 From: storybehind Date: Mon, 22 Jul 2024 20:32:09 +0530 Subject: [PATCH 070/228] update workflow --- .github/workflows/distribute-zboxcli.yml | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index 18d32cb4..5280bc9b 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -15,7 +15,6 @@ env: PACKAGE_DIR: ${{ github.workspace }}/package DEB_DIR: ${{ github.workspace }}/deb REPO_DIR: ${{ github.workspace }}/aptrepo - GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }} DISTRIBUTIONS: focal ARCHITECTURES: amd64 REMOTE_SERVER: @@ -43,13 +42,10 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - - name: Install dependencies + - name: Setup run: | sudo apt-get update sudo apt-get install -y docker-ce docker-ce-cli containerd.io tar gnupg dpkg-sig - - - name: Setup directories - run: | mkdir -p ${{ env.DEB_DIR }} mkdir -p ${{ env.OUTPUT_DIR }} mkdir -p ${{ env.PACKAGE_DIR }} @@ -92,6 +88,19 @@ jobs: Description: zbox is a command line interface (CLI) tool to understand the capabilities of Züs dStorage and prototype your app EOT + echo "Configuring GPG for batch mode and loopback pinentry..." + mkdir -p ~/.gnupg + echo "use-agent" >> ~/.gnupg/gpg.conf + echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf + echo "allow-loopback-pinentry" >> ~/.gnupg/gpg-agent.conf + gpg-connect-agent reloadagent /bye + + echo "Importing GPG private key..." + echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --batch --import + + echo "Trusting the GPG key..." + echo -e "5\ny\n" | gpg --command-fd 0 --batch --yes --pinentry-mode loopback --edit-key ${{ secrets.GPG_KEY_ID }} trust quit + tar czf "${{ env.OUTPUT_DIR }}/data.tar.gz" -C "${{ env.PACKAGE_DIR }}" . echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --batch --yes --passphrase-fd 0 --pinentry-mode loopback --detach-sign --armor -o "${{ env.PACKAGE_DIR }}/DEBIAN/signature.asc" "${{ env.OUTPUT_DIR }}/data.tar.gz" dpkg-deb -b ${{ env.PACKAGE_DIR }} ${{ env.DEB_DIR }}/${{ env.APP_NAME }}_${{ env.APP_VERSION }}~${{ matrix.distro.name }}_${{ matrix.arch.name }}.deb @@ -133,8 +142,8 @@ jobs: -o APT::FTPArchive::Release::Components="main" \ dists/${dist} > dists/${dist}/Release - echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --default-key ${GPG_KEY_ID} --batch --yes --passphrase-fd 0 -abs -o dists/${dist}/Release.gpg dists/${dist}/Release - echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --default-key ${GPG_KEY_ID} --batch --yes --passphrase-fd 0 --clearsign -o dists/${dist}/InRelease dists/${dist}/Release + echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --default-key ${{ secrets.GPG_KEY_ID }} --batch --yes --passphrase-fd 0 -abs -o dists/${dist}/Release.gpg dists/${dist}/Release + echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --default-key ${{ secrets.GPG_KEY_ID }} --batch --yes --passphrase-fd 0 --clearsign -o dists/${dist}/InRelease dists/${dist}/Release done - name: Upload APT repo to remote From 7ff0b7d9f3aca7e08999b34e35d9b5372d6b7246 Mon Sep 17 00:00:00 2001 From: storybehind Date: Wed, 24 Jul 2024 12:27:29 +0530 Subject: [PATCH 071/228] update workflow env --- .github/workflows/distribute-zboxcli.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index 5280bc9b..fb0f132d 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -17,13 +17,13 @@ env: REPO_DIR: ${{ github.workspace }}/aptrepo DISTRIBUTIONS: focal ARCHITECTURES: amd64 - REMOTE_SERVER: - REMOTE_USER: - REMOTE_PATH: + REMOTE_SERVER: 5.9.151.246 + REMOTE_USER: root + REMOTE_PATH: /var/www/html/aptrepo/ jobs: build: - runs-on: ubuntu-latest + runs-on: [self-hosted, arc-runner] strategy: matrix: distro: @@ -106,7 +106,7 @@ jobs: dpkg-deb -b ${{ env.PACKAGE_DIR }} ${{ env.DEB_DIR }}/${{ env.APP_NAME }}_${{ env.APP_VERSION }}~${{ matrix.distro.name }}_${{ matrix.arch.name }}.deb distribute: - runs-on: ubuntu-latest + runs-on: [self-hosted, arc-runner] needs: build steps: From ad8baba0303cfb9a325730f72cf38d56b0502825 Mon Sep 17 00:00:00 2001 From: storybehind Date: Wed, 24 Jul 2024 12:42:51 +0530 Subject: [PATCH 072/228] update docker buildx setup --- .github/workflows/distribute-zboxcli.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index fb0f132d..be5c32ef 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -39,13 +39,15 @@ jobs: with: path: ${{ env.SRC_DIR }} - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 + # - name: Set up Docker Buildx + # uses: docker/setup-buildx-action@v1 - name: Setup run: | sudo apt-get update - sudo apt-get install -y docker-ce docker-ce-cli containerd.io tar gnupg dpkg-sig + sudo apt-get install -y docker-ce docker-ce-cli docker.io containerd.io tar gnupg dpkg-sig + docker buildx create --name mybuilder --use + docker buildx inspect --bootstrap mkdir -p ${{ env.DEB_DIR }} mkdir -p ${{ env.OUTPUT_DIR }} mkdir -p ${{ env.PACKAGE_DIR }} From 6e2afbfafbde55481522fb40179880dcaa945ddc Mon Sep 17 00:00:00 2001 From: storybehind Date: Wed, 24 Jul 2024 12:48:54 +0530 Subject: [PATCH 073/228] update docker buildx setup --- .github/workflows/distribute-zboxcli.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index be5c32ef..f2c1d964 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -45,8 +45,10 @@ jobs: - name: Setup run: | sudo apt-get update - sudo apt-get install -y docker-ce docker-ce-cli docker.io containerd.io tar gnupg dpkg-sig - docker buildx create --name mybuilder --use + sudo apt-get install -y curl tar gnupg dpkg-sig + curl -fsSL https://get.docker.com -o get-docker.sh + sudo sh get-docker.sh + docker buildx create --name builder --use docker buildx inspect --bootstrap mkdir -p ${{ env.DEB_DIR }} mkdir -p ${{ env.OUTPUT_DIR }} From 46bba3d2c509dee3f3986828ac7ebdb01b602231 Mon Sep 17 00:00:00 2001 From: storybehind Date: Wed, 24 Jul 2024 13:01:05 +0530 Subject: [PATCH 074/228] install scp --- .github/workflows/distribute-zboxcli.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index f2c1d964..af9499e1 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -117,7 +117,7 @@ jobs: - name: Install dependencies run: | sudo apt-get update - sudo apt-get install -y apt-utils dpkg-sig gnupg + sudo apt-get install -y apt-utils dpkg-sig gnupg scp - name: Download APT repo run: | From 924e71f2b871d9609f396c1ac061fd58bee96a0e Mon Sep 17 00:00:00 2001 From: storybehind Date: Wed, 24 Jul 2024 13:08:42 +0530 Subject: [PATCH 075/228] install openssh-client --- .github/workflows/distribute-zboxcli.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index af9499e1..5e51437f 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -117,7 +117,7 @@ jobs: - name: Install dependencies run: | sudo apt-get update - sudo apt-get install -y apt-utils dpkg-sig gnupg scp + sudo apt-get install -y apt-utils dpkg-sig gnupg openssh-client - name: Download APT repo run: | From 784ca55fee844db6673f0c6042d990698edaf860 Mon Sep 17 00:00:00 2001 From: storybehind Date: Wed, 24 Jul 2024 13:28:33 +0530 Subject: [PATCH 076/228] setup ssh_key handling --- .github/workflows/distribute-zboxcli.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index 5e51437f..5dadb290 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -114,15 +114,19 @@ jobs: needs: build steps: - - name: Install dependencies + - name: Setup run: | sudo apt-get update sudo apt-get install -y apt-utils dpkg-sig gnupg openssh-client + mkdir -p ~/.ssh + echo "${{ secrets.SSH_KEY }}" > ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + ssh-keyscan -H ${{ secrets.REMOTE_SERVER }} >> ~/.ssh/known_hosts - name: Download APT repo run: | mkdir -p ${{ env.REPO_DIR }} - scp -i ${{ secrets.SSH_KEY }} ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:${{ env.REMOTE_PATH }}/* ${{ env.REPO_DIR }} + scp -i ~/.ssh/id_rsa -r ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:${{ env.REMOTE_PATH }}/* ${{ env.REPO_DIR }} - name: Copy debian packages run : | @@ -152,4 +156,4 @@ jobs: - name: Upload APT repo to remote run: | - scp -i ${{ secrets.SSH_KEY }} -r ${{ env.REPO_DIR }}/* ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:${{ env.REMOTE_PATH }} \ No newline at end of file + scp -i ~/.ssh/id_rsa -r ${{ env.REPO_DIR }}/* ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:${{ env.REMOTE_PATH }} \ No newline at end of file From 661e72e912b753d9832dfc2d39a0a1f348d1fc07 Mon Sep 17 00:00:00 2001 From: storybehind Date: Wed, 24 Jul 2024 13:56:07 +0530 Subject: [PATCH 077/228] remove docker setup and upload gpg public key --- .github/workflows/distribute-zboxcli.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index 5dadb290..3d82c703 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -19,7 +19,7 @@ env: ARCHITECTURES: amd64 REMOTE_SERVER: 5.9.151.246 REMOTE_USER: root - REMOTE_PATH: /var/www/html/aptrepo/ + REMOTE_PATH: /var/www/html jobs: build: @@ -46,10 +46,6 @@ jobs: run: | sudo apt-get update sudo apt-get install -y curl tar gnupg dpkg-sig - curl -fsSL https://get.docker.com -o get-docker.sh - sudo sh get-docker.sh - docker buildx create --name builder --use - docker buildx inspect --bootstrap mkdir -p ${{ env.DEB_DIR }} mkdir -p ${{ env.OUTPUT_DIR }} mkdir -p ${{ env.PACKAGE_DIR }} @@ -126,7 +122,7 @@ jobs: - name: Download APT repo run: | mkdir -p ${{ env.REPO_DIR }} - scp -i ~/.ssh/id_rsa -r ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:${{ env.REMOTE_PATH }}/* ${{ env.REPO_DIR }} + scp -i ~/.ssh/id_rsa -r ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:${{ env.REMOTE_PATH }}/aptrepo/* ${{ env.REPO_DIR }} - name: Copy debian packages run : | @@ -156,4 +152,9 @@ jobs: - name: Upload APT repo to remote run: | - scp -i ~/.ssh/id_rsa -r ${{ env.REPO_DIR }}/* ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:${{ env.REMOTE_PATH }} \ No newline at end of file + scp -i ~/.ssh/id_rsa -r ${{ env.REPO_DIR }}/* ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:${{ env.REMOTE_PATH }}/aptrepo/ + + - name: Upload GPG public key to remote server + run: | + echo "${{ secrets.GPG_PUBLIC_KEY }}" > zus.asc + scp -i ~/.ssh/id_rsa zus.asc ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:${{ env.REMOTE_PATH }}/keys/ From 5ae3cb72c7029846316cd68d13c74eec764d50ca Mon Sep 17 00:00:00 2001 From: storybehind Date: Wed, 24 Jul 2024 14:12:02 +0530 Subject: [PATCH 078/228] use docker buildx --- .github/workflows/distribute-zboxcli.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index 3d82c703..3b94eaad 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -52,6 +52,7 @@ jobs: - name: Build Docker image run: | + docker buildx create --use docker buildx build \ --platform ${{ matrix.arch.platform }} \ --build-arg GO_VERSION=${{ env.GO_VERSION }} \ @@ -157,4 +158,4 @@ jobs: - name: Upload GPG public key to remote server run: | echo "${{ secrets.GPG_PUBLIC_KEY }}" > zus.asc - scp -i ~/.ssh/id_rsa zus.asc ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:${{ env.REMOTE_PATH }}/keys/ + scp -i ~/.ssh/id_rsa zus.asc ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:${{ env.REMOTE_PATH }}/ From daa222c78062b9a2a78c60d64218cade1043efc6 Mon Sep 17 00:00:00 2001 From: storybehind Date: Wed, 24 Jul 2024 14:22:54 +0530 Subject: [PATCH 079/228] update docker buildx setup --- .github/workflows/distribute-zboxcli.yml | 26 ++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index 3b94eaad..64001e71 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -39,20 +39,34 @@ jobs: with: path: ${{ env.SRC_DIR }} - # - name: Set up Docker Buildx - # uses: docker/setup-buildx-action@v1 - - - name: Setup + - name: Install dependencies run: | sudo apt-get update - sudo apt-get install -y curl tar gnupg dpkg-sig + sudo apt-get install -y \ + apt-transport-https \ + software-properties-common \ + tar \ + gnupg \ + lsb-release \ + dpkg-sig + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Create and use Buildx builder + run: | + docker buildx create --name builder + docker buildx use builder + docker buildx inspect --bootstrap + + - name: Setup directories + run: | mkdir -p ${{ env.DEB_DIR }} mkdir -p ${{ env.OUTPUT_DIR }} mkdir -p ${{ env.PACKAGE_DIR }} - name: Build Docker image run: | - docker buildx create --use docker buildx build \ --platform ${{ matrix.arch.platform }} \ --build-arg GO_VERSION=${{ env.GO_VERSION }} \ From e20e1100e56569be002396f3519bf1f69c79f748 Mon Sep 17 00:00:00 2001 From: storybehind Date: Wed, 24 Jul 2024 14:31:29 +0530 Subject: [PATCH 080/228] update docker buildx setup --- .github/workflows/distribute-zboxcli.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index 64001e71..b7eaefcc 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -50,13 +50,12 @@ jobs: lsb-release \ dpkg-sig - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - name: Create and use Buildx builder run: | - docker buildx create --name builder - docker buildx use builder + docker context create mycontext || echo "Context already exists" + docker context use mycontext + docker buildx create --name mybuilder + docker buildx use mybuilder docker buildx inspect --bootstrap - name: Setup directories From 01a1fa5a3ec48518e91f06139fa95c64d30124dd Mon Sep 17 00:00:00 2001 From: storybehind Date: Wed, 24 Jul 2024 14:38:13 +0530 Subject: [PATCH 081/228] install docker latest --- .github/workflows/distribute-zboxcli.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index b7eaefcc..62d1b5d6 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -52,6 +52,8 @@ jobs: - name: Create and use Buildx builder run: | + curl -fsSL https://get.docker.com -o get-docker.sh + sudo sh get-docker.sh docker context create mycontext || echo "Context already exists" docker context use mycontext docker buildx create --name mybuilder From f200cd2566ad82af1f9429727ea3e102b404d28d Mon Sep 17 00:00:00 2001 From: storybehind Date: Wed, 24 Jul 2024 14:50:15 +0530 Subject: [PATCH 082/228] unset docker host --- .github/workflows/distribute-zboxcli.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index 62d1b5d6..4006385c 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -54,10 +54,11 @@ jobs: run: | curl -fsSL https://get.docker.com -o get-docker.sh sudo sh get-docker.sh - docker context create mycontext || echo "Context already exists" - docker context use mycontext - docker buildx create --name mybuilder - docker buildx use mybuilder + unset DOCKER_HOST + docker context create dist-context || echo "Context already exists" + docker context use dist-context + docker buildx create --name dist-builder + docker buildx use dist-builder docker buildx inspect --bootstrap - name: Setup directories From fbce2c52bff513a37e6a678172e91cbf821e6767 Mon Sep 17 00:00:00 2001 From: storybehind Date: Wed, 24 Jul 2024 14:56:30 +0530 Subject: [PATCH 083/228] use containerd driver --- .github/workflows/distribute-zboxcli.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index 4006385c..51d92859 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -57,9 +57,8 @@ jobs: unset DOCKER_HOST docker context create dist-context || echo "Context already exists" docker context use dist-context - docker buildx create --name dist-builder - docker buildx use dist-builder - docker buildx inspect --bootstrap + docker buildx create --name dist-builder --use --driver containerd + docker buildx inspect dist-builder --bootstrap - name: Setup directories run: | From 4ee865e2649f2ddd94e04a3ccb120d8cc58433d7 Mon Sep 17 00:00:00 2001 From: storybehind Date: Wed, 24 Jul 2024 15:06:05 +0530 Subject: [PATCH 084/228] use ubuntu-latest --- .github/workflows/distribute-zboxcli.yml | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index 51d92859..f26c2ad2 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -23,7 +23,7 @@ env: jobs: build: - runs-on: [self-hosted, arc-runner] + runs-on: [ubuntu-latest] strategy: matrix: distro: @@ -39,7 +39,7 @@ jobs: with: path: ${{ env.SRC_DIR }} - - name: Install dependencies + - name: Setup run: | sudo apt-get update sudo apt-get install -y \ @@ -49,25 +49,13 @@ jobs: gnupg \ lsb-release \ dpkg-sig - - - name: Create and use Buildx builder - run: | - curl -fsSL https://get.docker.com -o get-docker.sh - sudo sh get-docker.sh - unset DOCKER_HOST - docker context create dist-context || echo "Context already exists" - docker context use dist-context - docker buildx create --name dist-builder --use --driver containerd - docker buildx inspect dist-builder --bootstrap - - - name: Setup directories - run: | mkdir -p ${{ env.DEB_DIR }} mkdir -p ${{ env.OUTPUT_DIR }} mkdir -p ${{ env.PACKAGE_DIR }} - name: Build Docker image run: | + docker buildx create --use docker buildx build \ --platform ${{ matrix.arch.platform }} \ --build-arg GO_VERSION=${{ env.GO_VERSION }} \ @@ -122,7 +110,7 @@ jobs: dpkg-deb -b ${{ env.PACKAGE_DIR }} ${{ env.DEB_DIR }}/${{ env.APP_NAME }}_${{ env.APP_VERSION }}~${{ matrix.distro.name }}_${{ matrix.arch.name }}.deb distribute: - runs-on: [self-hosted, arc-runner] + runs-on: [ubuntu-latest] needs: build steps: From d63dbfd58f151a34a46875f693dc436a1c190852 Mon Sep 17 00:00:00 2001 From: storybehind Date: Wed, 24 Jul 2024 15:16:52 +0530 Subject: [PATCH 085/228] fix incorrect usage of ssh-keyscan --- .github/workflows/distribute-zboxcli.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index f26c2ad2..820381cd 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -121,7 +121,7 @@ jobs: mkdir -p ~/.ssh echo "${{ secrets.SSH_KEY }}" > ~/.ssh/id_rsa chmod 600 ~/.ssh/id_rsa - ssh-keyscan -H ${{ secrets.REMOTE_SERVER }} >> ~/.ssh/known_hosts + ssh-keyscan -H ${{ env.REMOTE_SERVER }} >> ~/.ssh/known_hosts - name: Download APT repo run: | From 4d0d4732e59d93efff969e864f53ca22e59600d0 Mon Sep 17 00:00:00 2001 From: storybehind Date: Wed, 24 Jul 2024 16:16:22 +0530 Subject: [PATCH 086/228] use self-hosted runner --- .github/workflows/distribute-zboxcli.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index 820381cd..21664b1a 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -23,7 +23,7 @@ env: jobs: build: - runs-on: [ubuntu-latest] + runs-on: [self-hosted, arc-runner] strategy: matrix: distro: @@ -110,7 +110,7 @@ jobs: dpkg-deb -b ${{ env.PACKAGE_DIR }} ${{ env.DEB_DIR }}/${{ env.APP_NAME }}_${{ env.APP_VERSION }}~${{ matrix.distro.name }}_${{ matrix.arch.name }}.deb distribute: - runs-on: [ubuntu-latest] + runs-on: [self-hosted, arc-runner] needs: build steps: From 484978de51fef4b7d3184a13a0a68f1c28a7405e Mon Sep 17 00:00:00 2001 From: Jayash Satolia Date: Thu, 25 Jul 2024 02:03:57 +0530 Subject: [PATCH 087/228] Enterprise blobber --- cmd/newallocation.go | 4 +++- go.mod | 2 +- go.sum | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cmd/newallocation.go b/cmd/newallocation.go index c640d27f..eeacef67 100755 --- a/cmd/newallocation.go +++ b/cmd/newallocation.go @@ -183,6 +183,7 @@ var newallocationCmd = &cobra.Command{ } thirdPartyExtendable, _ := flags.GetBool("third_party_extendable") + isEnterprise, _ := flags.GetBool("enterprise") force, _ := flags.GetBool("force") // Read the file options flags @@ -273,7 +274,7 @@ var newallocationCmd = &cobra.Command{ } allocationID, _, _, err = sdk.CreateAllocationForOwner(owner, ownerPublicKey, *datashards, *parityshards, - *size, readPrice, writePrice, lock, preferred_blobbers, blobber_auth_tickets, thirdPartyExtendable, force, &fileOptionParams) + *size, readPrice, writePrice, lock, preferred_blobbers, blobber_auth_tickets, thirdPartyExtendable, isEnterprise, force, &fileOptionParams) if err != nil { log.Fatal("Error creating allocation: ", err) } @@ -346,6 +347,7 @@ func init() { newallocationCmd.Flags().Bool("force", false, "(default false) force to get blobbers even if required number of blobbers are not available (should be passed true in case of restricted blobbers)") newallocationCmd.Flags().Bool("third_party_extendable", false, "(default false) specify if the allocation can be extended by users other than the owner") + newallocationCmd.Flags().Bool("enterprise", false, "(default false) specify if the allocation is for enterprise") newallocationCmd.Flags().Bool("forbid_upload", false, "(default false) specify if users cannot upload to this allocation") newallocationCmd.Flags().Bool("forbid_delete", false, "(default false) specify if the users cannot delete objects from this allocation") newallocationCmd.Flags().Bool("forbid_update", false, "(default false) specify if the users cannot update objects in this allocation") diff --git a/go.mod b/go.mod index 536876ae..4b23f528 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.16.0 + github.com/0chain/gosdk v1.16.3-0.20240723235848-5a022363a8b1 github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 diff --git a/go.sum b/go.sum index 6c3b152e..9f30f2c9 100644 --- a/go.sum +++ b/go.sum @@ -42,6 +42,8 @@ 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.16.0 h1:3CKuU9i9d+X2/htJOIyxNwviKG5H/lp+q8ogzCgnoQI= github.com/0chain/gosdk v1.16.0/go.mod h1:y7Ucdmv40VltqulZnncMNjNQ4piX5Dta5ujNmPmXnxg= +github.com/0chain/gosdk v1.16.3-0.20240723235848-5a022363a8b1 h1:ZQr+brw+pG9nM5rLk006cS1fSSrzwhv6HLe0BLeIxwI= +github.com/0chain/gosdk v1.16.3-0.20240723235848-5a022363a8b1/go.mod h1:y7Ucdmv40VltqulZnncMNjNQ4piX5Dta5ujNmPmXnxg= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= From 871445ec6b751c0089a7438b117c647b0b11e1e4 Mon Sep 17 00:00:00 2001 From: storybehind Date: Thu, 25 Jul 2024 23:21:49 +0530 Subject: [PATCH 088/228] install script and test --- .github/workflows/distribute-zboxcli.yml | 41 +++++++- scripts/debian/Dockerfile | 4 +- scripts/debian/Dockerfile.install_test | 17 ++++ scripts/debian/install.sh | 119 +++++++++++++++++++++++ 4 files changed, 174 insertions(+), 7 deletions(-) create mode 100644 scripts/debian/Dockerfile.install_test create mode 100755 scripts/debian/install.sh diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index 21664b1a..531b118c 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -23,7 +23,7 @@ env: jobs: build: - runs-on: [self-hosted, arc-runner] + runs-on: [ubuntu-latest] strategy: matrix: distro: @@ -82,7 +82,7 @@ jobs: mkdir -p ${{ env.PACKAGE_DIR }}/DEBIAN mkdir -p ${{ env.PACKAGE_DIR }}/usr/local/bin - cp ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}_${{ env.APP_VERSION }}~${{ matrix.distro.name }}_${{ matrix.arch.name }} ${{ env.PACKAGE_DIR }}/usr/local/bin/ + cp ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}_${{ env.APP_VERSION }}~${{ matrix.distro.name }}_${{ matrix.arch.name }} ${{ env.PACKAGE_DIR }}/usr/local/bin/${APP_NAME} cat < ${{ env.PACKAGE_DIR }}/DEBIAN/control Package: ${{ env.APP_NAME }} @@ -110,7 +110,7 @@ jobs: dpkg-deb -b ${{ env.PACKAGE_DIR }} ${{ env.DEB_DIR }}/${{ env.APP_NAME }}_${{ env.APP_VERSION }}~${{ matrix.distro.name }}_${{ matrix.arch.name }}.deb distribute: - runs-on: [self-hosted, arc-runner] + runs-on: [ubuntu-latest] needs: build steps: @@ -161,4 +161,37 @@ jobs: - name: Upload GPG public key to remote server run: | echo "${{ secrets.GPG_PUBLIC_KEY }}" > zus.asc - scp -i ~/.ssh/id_rsa zus.asc ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:${{ env.REMOTE_PATH }}/ + scp -i ~/.ssh/id_rsa zus.asc ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:${{ env.REMOTE_PATH }}/zus.asc + + - name: Upload install script to remote server + run: | + scp -i ~/.ssh/id_rsa ${{ env.SRC_DIR }}/scripts/debian/install.sh ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:${{ env.REMOTE_PATH }}/deb_install.sh + + + + test: + runs-on: [ubuntu-latest] + needs: distribute + strategy: + matrix: + distro: + - name: focal + base_image: ubuntu:20.04 + arch: + - name: amd64 + platform: linux/amd64 + steps: + - name: Build Docker image + run: | + docker buildx create --use + docker buildx build \ + --platform ${{ matrix.arch.platform }} \ + --build-arg BASE_IMAGE=${{ matrix.distro.base_image }} \ + --build-arg LOC="https://packages.zus.network/deb_install.sh" + --tag ${{ env.APP_NAME }}-${{ env.APP_VERSION }}-${{ matrix.distro.name }}-${{ matrix.arch.name }} \ + -f ${{ env.SRC_DIR }}/scripts/debian/Dockerfile.install_test . + + - name: Test zbox + run: | + docker run --rm ${{ env.APP_NAME }}-${{ env.APP_VERSION }}-${{ matrix.distro.name }}-${{ matrix.arch.name }} || { echo "Test installation failed"; exit 1; } + diff --git a/scripts/debian/Dockerfile b/scripts/debian/Dockerfile index e56a92e1..170d40c4 100644 --- a/scripts/debian/Dockerfile +++ b/scripts/debian/Dockerfile @@ -5,9 +5,7 @@ ARG BASE_IMAGE # Stage 1: Build zboxcli on the base image FROM --platform=$BUILDPLATFORM ${BASE_IMAGE} AS builder -# Enable shell debugging -SHELL ["/bin/bash", "-o", "pipefail", "-c"] -RUN set -x +RUN set -e # Install dependencies RUN echo "Installing dependencies" \ diff --git a/scripts/debian/Dockerfile.install_test b/scripts/debian/Dockerfile.install_test new file mode 100644 index 00000000..cf96ec0a --- /dev/null +++ b/scripts/debian/Dockerfile.install_test @@ -0,0 +1,17 @@ +# syntax=docker/dockerfile:latest + +ARG BASE_IMAGE + +FROM --platform=$BUILDPLATFORM ${BASE_IMAGE} + +# Install necessary packages +RUN apt-get update && apt-get install -y curl + +# Download and install the app +ARG LOC=https://packages.zus.network/deb_install.sh +RUN set -e; \ + curl -sL ${LOC} | bash -s -- -y + +# Check the app version +CMD ["zbox", "version"] + diff --git a/scripts/debian/install.sh b/scripts/debian/install.sh new file mode 100755 index 00000000..9d246d6c --- /dev/null +++ b/scripts/debian/install.sh @@ -0,0 +1,119 @@ +#!/usr/bin/env bash + +set -e + +if [[ $# -ge 1 && $1 == "-y" ]]; then + global_consent=0 +else + global_consent=1 +fi + +function assert_consent { + if [[ $2 -eq 0 ]]; then + return 0 + fi + + echo -n "$1 [Y/n] " + read consent + if [[ ! "${consent}" == "y" && ! "${consent}" == "Y" && ! "${consent}" == "" ]]; then + echo "'${consent}'" + exit 1 + fi +} + +setup() { + + assert_consent "Add packages necessary to modify your apt-package sources?" ${global_consent} + set -v + export DEBIAN_FRONTEND=noninteractive + apt-get update + apt-get install --assume-yes --no-install-recommends apt-transport-https ca-certificates curl gnupg lsb-release + set +v + + assert_consent "Add Züs as a trusted package signer?" ${global_consent} + set -v + mkdir -p /etc/apt/keyrings + curl -sLS https://packages.zus.network/zus.asc | + gpg --dearmor > /etc/apt/keyrings/zus.gpg + chmod go+r /etc/apt/keyrings/zus.gpg + set +v + + assert_consent "Add the zbox Repository to your apt sources?" ${global_consent} + set -v + # Use env var DIST_CODE for the package dist name if provided + if [[ -z $DIST_CODE ]]; then + CLI_REPO=$(lsb_release -cs) + shopt -s nocasematch + ERROR_MSG="Unable to find a package for your system. Please check if an existing package in https://packages.zus.network/aptrepo/dists/ can be used in your system and install with the dist name: 'curl -sL https://packages.zus.network/aptrepo/ | sudo DIST_CODE= bash'" + if [[ ! $(curl -sL https://packages.zus.network/aptrepo/dists/) =~ $CLI_REPO ]]; then + DIST=$(lsb_release -is) + if [[ $DIST =~ "Ubuntu" ]]; then + CLI_REPO="jammy" + elif [[ $DIST =~ "Debian" ]]; then + CLI_REPO="bookworm" + elif [[ $DIST =~ "LinuxMint" ]]; then + CLI_REPO=$(grep -Po 'UBUNTU_CODENAME=\K.*' /etc/os-release) || true + if [[ -z $CLI_REPO ]]; then + echo "$ERROR_MSG" + exit 1 + fi + else + echo "$ERROR_MSG" + exit 1 + fi + fi + else + CLI_REPO=$DIST_CODE + if [[ ! $(curl -sL https://packages.zus.network/aptrepo/dists/) =~ $CLI_REPO ]]; then + echo "Unable to find an zbox-cli package with DIST_CODE=$CLI_REPO in https://packages.zus.network/aptrepo/dists/" + exit 1 + fi + fi + + if [ -f /etc/apt/sources.list.d/zbox.list ]; then + rm /etc/apt/sources.list.d/zbox.list + fi + + echo "Types: deb +URIs: https://packages.zus.network/aptrepo/ +Suites: ${CLI_REPO} +Components: main +Architectures: $(dpkg --print-architecture) +Signed-by: /etc/apt/keyrings/zus.gpg" | tee /etc/apt/sources.list.d/zbox.sources + apt-get update + set +v + + assert_consent "Install the zbox?" ${global_consent} + apt-get install --assume-yes zbox + + # Check if config.yaml already exists + CONFIG_DIR="${HOME}/.zcn" + CONFIG_PATH="${CONFIG_DIR}/config.yaml" + if [ -f "${CONFIG_PATH}" ]; then + assert_consent "The configuration file ${CONFIG_PATH} already exists. Do you want to update it?" ${global_consent} + fi + + # Create or update the config.yaml file + echo "Creating/updating configuration file at ${CONFIG_PATH}..." + mkdir -p $CONFIG_DIR + touch $CONFIG_PATH + cat < ${CONFIG_PATH} +--- +block_worker: https://dev.zus.network +signature_scheme: bls0chain +min_submit: 50 +min_confirmation: 50 +confirmation_chain_length: 3 + +# # OPTIONAL - Uncomment to use/ Add more if you want +# preferred_blobbers: +# - http://one.devnet-0chain.net:31051 +# - http://one.devnet-0chain.net:31052 +# - http://one.devnet-0chain.net:31053 +EOT + + echo "Installation and configuration complete." + +} + +setup # ensure the whole file is downloaded before executing \ No newline at end of file From 0d8af60326d77588dbd4fadabbe4df819f00afa6 Mon Sep 17 00:00:00 2001 From: storybehind Date: Thu, 25 Jul 2024 23:28:46 +0530 Subject: [PATCH 089/228] fix workflow syntax --- .github/workflows/distribute-zboxcli.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index 531b118c..7ac66238 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -192,6 +192,5 @@ jobs: -f ${{ env.SRC_DIR }}/scripts/debian/Dockerfile.install_test . - name: Test zbox - run: | - docker run --rm ${{ env.APP_NAME }}-${{ env.APP_VERSION }}-${{ matrix.distro.name }}-${{ matrix.arch.name }} || { echo "Test installation failed"; exit 1; } + run: docker run --rm ${{ env.APP_NAME }}-${{ env.APP_VERSION }}-${{ matrix.distro.name }}-${{ matrix.arch.name }} || { echo "Test installation failed"; exit 1; } From e74e88371d3ab40b938798ef282c9db278b9ab19 Mon Sep 17 00:00:00 2001 From: storybehind Date: Fri, 26 Jul 2024 00:01:03 +0530 Subject: [PATCH 090/228] add verbose in scp command --- .github/workflows/distribute-zboxcli.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index 7ac66238..676709fb 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -126,7 +126,7 @@ jobs: - name: Download APT repo run: | mkdir -p ${{ env.REPO_DIR }} - scp -i ~/.ssh/id_rsa -r ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:${{ env.REMOTE_PATH }}/aptrepo/* ${{ env.REPO_DIR }} + scp -v -i ~/.ssh/id_rsa -r ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:${{ env.REMOTE_PATH }}/aptrepo/* ${{ env.REPO_DIR }} - name: Copy debian packages run : | @@ -156,16 +156,16 @@ jobs: - name: Upload APT repo to remote run: | - scp -i ~/.ssh/id_rsa -r ${{ env.REPO_DIR }}/* ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:${{ env.REMOTE_PATH }}/aptrepo/ + scp -v -i ~/.ssh/id_rsa -r ${{ env.REPO_DIR }}/* ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:${{ env.REMOTE_PATH }}/aptrepo/ - name: Upload GPG public key to remote server run: | echo "${{ secrets.GPG_PUBLIC_KEY }}" > zus.asc - scp -i ~/.ssh/id_rsa zus.asc ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:${{ env.REMOTE_PATH }}/zus.asc + scp -v -i ~/.ssh/id_rsa zus.asc ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:${{ env.REMOTE_PATH }}/zus.asc - name: Upload install script to remote server run: | - scp -i ~/.ssh/id_rsa ${{ env.SRC_DIR }}/scripts/debian/install.sh ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:${{ env.REMOTE_PATH }}/deb_install.sh + scp -v -i ~/.ssh/id_rsa ${{ env.SRC_DIR }}/scripts/debian/install.sh ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:${{ env.REMOTE_PATH }}/deb_install.sh From 15add09804eece74a06899e47d963d2dfebbb5a4 Mon Sep 17 00:00:00 2001 From: storybehind Date: Fri, 26 Jul 2024 00:14:56 +0530 Subject: [PATCH 091/228] fix scp directory recursive copy --- .github/workflows/distribute-zboxcli.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index 676709fb..440d8aa0 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -126,7 +126,7 @@ jobs: - name: Download APT repo run: | mkdir -p ${{ env.REPO_DIR }} - scp -v -i ~/.ssh/id_rsa -r ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:${{ env.REMOTE_PATH }}/aptrepo/* ${{ env.REPO_DIR }} + scp -v -i ~/.ssh/id_rsa -r ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:/var/www/html/aptrepo/ ${{ env.REPO_DIR }} - name: Copy debian packages run : | @@ -156,16 +156,16 @@ jobs: - name: Upload APT repo to remote run: | - scp -v -i ~/.ssh/id_rsa -r ${{ env.REPO_DIR }}/* ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:${{ env.REMOTE_PATH }}/aptrepo/ + scp -v -i ~/.ssh/id_rsa -r ${{ env.REPO_DIR }}/ ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:/var/www/html/aptrepo/ - name: Upload GPG public key to remote server run: | echo "${{ secrets.GPG_PUBLIC_KEY }}" > zus.asc - scp -v -i ~/.ssh/id_rsa zus.asc ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:${{ env.REMOTE_PATH }}/zus.asc + scp -v -i ~/.ssh/id_rsa zus.asc ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:/var/www/html/zus.asc - name: Upload install script to remote server run: | - scp -v -i ~/.ssh/id_rsa ${{ env.SRC_DIR }}/scripts/debian/install.sh ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:${{ env.REMOTE_PATH }}/deb_install.sh + scp -v -i ~/.ssh/id_rsa ${{ env.SRC_DIR }}/scripts/debian/install.sh ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:/var/www/html/deb_install.sh From bdf166475235361a3fb1a4f8b9fc8a0c2d1d6c4a Mon Sep 17 00:00:00 2001 From: storybehind Date: Fri, 26 Jul 2024 08:27:35 +0530 Subject: [PATCH 092/228] update workflow --- .github/workflows/distribute-zboxcli.yml | 38 ++++++++++++++++-------- 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index 440d8aa0..10a6e575 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -10,20 +10,16 @@ env: APP_NAME: zbox APP_VERSION: 1.16.0-1 GO_VERSION: 1.21.0 - SRC_DIR: ${{ github.workspace }}/src - OUTPUT_DIR: ${{ github.workspace }}/output - PACKAGE_DIR: ${{ github.workspace }}/package - DEB_DIR: ${{ github.workspace }}/deb - REPO_DIR: ${{ github.workspace }}/aptrepo - DISTRIBUTIONS: focal - ARCHITECTURES: amd64 REMOTE_SERVER: 5.9.151.246 REMOTE_USER: root - REMOTE_PATH: /var/www/html jobs: build: runs-on: [ubuntu-latest] + env: + SRC_DIR: ${{ github.workspace }}/src + OUTPUT_DIR: ${{ github.workspace }}/output + PACKAGE_DIR: ${{ github.workspace }}/package strategy: matrix: distro: @@ -49,7 +45,6 @@ jobs: gnupg \ lsb-release \ dpkg-sig - mkdir -p ${{ env.DEB_DIR }} mkdir -p ${{ env.OUTPUT_DIR }} mkdir -p ${{ env.PACKAGE_DIR }} @@ -107,30 +102,49 @@ jobs: tar czf "${{ env.OUTPUT_DIR }}/data.tar.gz" -C "${{ env.PACKAGE_DIR }}" . echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --batch --yes --passphrase-fd 0 --pinentry-mode loopback --detach-sign --armor -o "${{ env.PACKAGE_DIR }}/DEBIAN/signature.asc" "${{ env.OUTPUT_DIR }}/data.tar.gz" - dpkg-deb -b ${{ env.PACKAGE_DIR }} ${{ env.DEB_DIR }}/${{ env.APP_NAME }}_${{ env.APP_VERSION }}~${{ matrix.distro.name }}_${{ matrix.arch.name }}.deb + dpkg-deb -b ${{ env.PACKAGE_DIR }} ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}_${{ env.APP_VERSION }}~${{ matrix.distro.name }}_${{ matrix.arch.name }}.deb + + - name: Upload .deb file + uses: actions/upload-artifact@v3 + with: + name: ${{ env.APP_NAME }}_${{ env.APP_VERSION }}~${{ matrix.distro.name }}_${{ matrix.arch.name }} + path: ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}_${{ env.APP_VERSION }}~${{ matrix.distro.name }}_${{ matrix.arch.name }}.deb distribute: runs-on: [ubuntu-latest] needs: build - + env: + DISTRIBUTIONS: focal + ARCHITECTURES: amd64 + REPO_DIR: ${{ github.workspace }}/aptrepo + DEB_DIR: ${{ github.workspace }}/deb-files steps: - name: Setup run: | sudo apt-get update sudo apt-get install -y apt-utils dpkg-sig gnupg openssh-client + mkdir -p ~/.ssh echo "${{ secrets.SSH_KEY }}" > ~/.ssh/id_rsa chmod 600 ~/.ssh/id_rsa ssh-keyscan -H ${{ env.REMOTE_SERVER }} >> ~/.ssh/known_hosts + mkdir -p ${{ env.REPO_DIR }} + mkdir -p ${{ env.DEB_DIR }} + - name: Download APT repo run: | - mkdir -p ${{ env.REPO_DIR }} scp -v -i ~/.ssh/id_rsa -r ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:/var/www/html/aptrepo/ ${{ env.REPO_DIR }} + - name: Download all .deb files + uses: actions/download-artifact@v3 + with: + path: ${{ env.DEB_DIR }} + - name: Copy debian packages run : | mkdir -p ${{ env.REPO_DIR }}/pool/main/z/${APP_NAME}/ + ls -la ${{ env.DEB_DIR }} cp ${{ env.DEB_DIR }}/*.deb ${{ env.REPO_DIR }}/pool/main/z/${APP_NAME}/ - name: Update APT repo From 9c84b834785c0f93747139ece05dc45c71771760 Mon Sep 17 00:00:00 2001 From: storybehind Date: Fri, 26 Jul 2024 08:47:36 +0530 Subject: [PATCH 093/228] fix copy debian packages --- .github/workflows/distribute-zboxcli.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index 10a6e575..3575e338 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -144,8 +144,10 @@ jobs: - name: Copy debian packages run : | mkdir -p ${{ env.REPO_DIR }}/pool/main/z/${APP_NAME}/ - ls -la ${{ env.DEB_DIR }} - cp ${{ env.DEB_DIR }}/*.deb ${{ env.REPO_DIR }}/pool/main/z/${APP_NAME}/ + find ${{ env.DEB_DIR }} -name "*.deb" + for deb in $(find ${{ env.DEB_DIR }} -name "*.deb"); do + cp deb ${{ env.REPO_DIR }}/pool/main/z/${APP_NAME}/ + done - name: Update APT repo run: | From bb0a64603280951adf9258540c3e26f4698c5444 Mon Sep 17 00:00:00 2001 From: storybehind Date: Fri, 26 Jul 2024 08:54:34 +0530 Subject: [PATCH 094/228] fix copy debian packages --- .github/workflows/distribute-zboxcli.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index 3575e338..8b325c21 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -146,7 +146,7 @@ jobs: mkdir -p ${{ env.REPO_DIR }}/pool/main/z/${APP_NAME}/ find ${{ env.DEB_DIR }} -name "*.deb" for deb in $(find ${{ env.DEB_DIR }} -name "*.deb"); do - cp deb ${{ env.REPO_DIR }}/pool/main/z/${APP_NAME}/ + cp $deb ${{ env.REPO_DIR }}/pool/main/z/${APP_NAME}/ done - name: Update APT repo From 5556dca48394705d9eda41ace032b4735642b377 Mon Sep 17 00:00:00 2001 From: storybehind Date: Fri, 26 Jul 2024 09:13:00 +0530 Subject: [PATCH 095/228] import GPG_PRIVATE_KEY in distribute job --- .github/workflows/distribute-zboxcli.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index 8b325c21..5891c7c1 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -132,6 +132,8 @@ jobs: mkdir -p ${{ env.REPO_DIR }} mkdir -p ${{ env.DEB_DIR }} + echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --batch --import + - name: Download APT repo run: | scp -v -i ~/.ssh/id_rsa -r ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:/var/www/html/aptrepo/ ${{ env.REPO_DIR }} From 01d28048e4016c02f96e40a72b8db2397d7ecae6 Mon Sep 17 00:00:00 2001 From: storybehind Date: Fri, 26 Jul 2024 12:45:55 +0530 Subject: [PATCH 096/228] fix gpg signing issue --- .github/workflows/distribute-zboxcli.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index 5891c7c1..3b9fa42f 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -116,9 +116,15 @@ jobs: env: DISTRIBUTIONS: focal ARCHITECTURES: amd64 + SRC_DIR: ${{ github.workspace }}/src REPO_DIR: ${{ github.workspace }}/aptrepo DEB_DIR: ${{ github.workspace }}/deb-files steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + path: ${{ env.SRC_DIR }} + - name: Setup run: | sudo apt-get update @@ -132,8 +138,20 @@ jobs: mkdir -p ${{ env.REPO_DIR }} mkdir -p ${{ env.DEB_DIR }} + echo "Configuring GPG for batch mode and loopback pinentry..." + mkdir -p ~/.gnupg + echo "use-agent" >> ~/.gnupg/gpg.conf + echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf + echo "allow-loopback-pinentry" >> ~/.gnupg/gpg-agent.conf + gpg-connect-agent reloadagent /bye + + echo "Importing GPG private key..." echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --batch --import + echo "Trusting the GPG key..." + echo -e "5\ny\n" | gpg --command-fd 0 --batch --yes --pinentry-mode loopback --edit-key ${{ secrets.GPG_KEY_ID }} trust quit + + - name: Download APT repo run: | scp -v -i ~/.ssh/id_rsa -r ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:/var/www/html/aptrepo/ ${{ env.REPO_DIR }} From 82788bf47bab8c3084b9c9e67fceddcc1d5827f8 Mon Sep 17 00:00:00 2001 From: storybehind Date: Fri, 26 Jul 2024 13:23:37 +0530 Subject: [PATCH 097/228] update workflow --- .github/workflows/distribute-zboxcli.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index 3b9fa42f..8ef78f66 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -154,7 +154,7 @@ jobs: - name: Download APT repo run: | - scp -v -i ~/.ssh/id_rsa -r ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:/var/www/html/aptrepo/ ${{ env.REPO_DIR }} + scp -v -i ~/.ssh/id_rsa -r ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:/var/www/html/aptrepo/* ${{ env.REPO_DIR }} - name: Download all .deb files uses: actions/download-artifact@v3 @@ -192,7 +192,7 @@ jobs: - name: Upload APT repo to remote run: | - scp -v -i ~/.ssh/id_rsa -r ${{ env.REPO_DIR }}/ ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:/var/www/html/aptrepo/ + scp -v -i ~/.ssh/id_rsa -r ${{ env.REPO_DIR }}/* ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:/var/www/html/aptrepo/ - name: Upload GPG public key to remote server run: | @@ -208,6 +208,8 @@ jobs: test: runs-on: [ubuntu-latest] needs: distribute + env: + SRC_DIR: ${{ github.workspace }}/src strategy: matrix: distro: @@ -217,13 +219,18 @@ jobs: - name: amd64 platform: linux/amd64 steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + path: ${{ env.SRC_DIR }} + - name: Build Docker image run: | docker buildx create --use docker buildx build \ --platform ${{ matrix.arch.platform }} \ --build-arg BASE_IMAGE=${{ matrix.distro.base_image }} \ - --build-arg LOC="https://packages.zus.network/deb_install.sh" + --build-arg LOC="https://packages.zus.network/deb_install.sh" \ --tag ${{ env.APP_NAME }}-${{ env.APP_VERSION }}-${{ matrix.distro.name }}-${{ matrix.arch.name }} \ -f ${{ env.SRC_DIR }}/scripts/debian/Dockerfile.install_test . From 716c541aae12e5120ff8cbf8b3d78e1a727f12e7 Mon Sep 17 00:00:00 2001 From: storybehind Date: Fri, 26 Jul 2024 13:38:57 +0530 Subject: [PATCH 098/228] update workflow --- .github/workflows/distribute-zboxcli.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index 8ef78f66..0489a635 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -154,7 +154,7 @@ jobs: - name: Download APT repo run: | - scp -v -i ~/.ssh/id_rsa -r ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:/var/www/html/aptrepo/* ${{ env.REPO_DIR }} + scp -v -i ~/.ssh/id_rsa -r ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:/var/www/html/aptrepo/ ${{ github.workspace }} - name: Download all .deb files uses: actions/download-artifact@v3 @@ -192,7 +192,7 @@ jobs: - name: Upload APT repo to remote run: | - scp -v -i ~/.ssh/id_rsa -r ${{ env.REPO_DIR }}/* ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:/var/www/html/aptrepo/ + scp -v -i ~/.ssh/id_rsa -r ${{ github.workspace }}/aptrepo/ ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:/var/www/html/ - name: Upload GPG public key to remote server run: | From 99ee7a89eabd3e3fc47b15b9894323bd670e156c Mon Sep 17 00:00:00 2001 From: storybehind Date: Fri, 26 Jul 2024 14:10:53 +0530 Subject: [PATCH 099/228] fix docker tag and run command --- .github/workflows/distribute-zboxcli.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index 0489a635..82919bc4 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -231,9 +231,9 @@ jobs: --platform ${{ matrix.arch.platform }} \ --build-arg BASE_IMAGE=${{ matrix.distro.base_image }} \ --build-arg LOC="https://packages.zus.network/deb_install.sh" \ - --tag ${{ env.APP_NAME }}-${{ env.APP_VERSION }}-${{ matrix.distro.name }}-${{ matrix.arch.name }} \ + --tag ${{ env.APP_NAME }}:${{ env.APP_VERSION }} \ -f ${{ env.SRC_DIR }}/scripts/debian/Dockerfile.install_test . - name: Test zbox - run: docker run --rm ${{ env.APP_NAME }}-${{ env.APP_VERSION }}-${{ matrix.distro.name }}-${{ matrix.arch.name }} || { echo "Test installation failed"; exit 1; } + run: docker run --platform=${{ matrix.arch.platform }} ${{ env.APP_NAME }}:${{ env.APP_VERSION }} || { echo "Test installation failed"; exit 1; } From e80c4643c4b7a2505362fd03324ff7f6d61b0b13 Mon Sep 17 00:00:00 2001 From: storybehind Date: Fri, 26 Jul 2024 17:09:31 +0530 Subject: [PATCH 100/228] update workflow to load docker image --- .github/workflows/distribute-zboxcli.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index 82919bc4..7fa5e416 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -231,9 +231,13 @@ jobs: --platform ${{ matrix.arch.platform }} \ --build-arg BASE_IMAGE=${{ matrix.distro.base_image }} \ --build-arg LOC="https://packages.zus.network/deb_install.sh" \ - --tag ${{ env.APP_NAME }}:${{ env.APP_VERSION }} \ + --tag ${{ env.APP_NAME }}-${{ env.APP_VERSION }}-${{ matrix.distro.name }}-${{ matrix.arch.name }} \ + --load \ + --output type=docker,dest=${{ github.workspace }}/${{ env.APP_NAME }}-${{ env.APP_VERSION }}-${{ matrix.distro.name }}-${{ matrix.arch.name }}.tar \ -f ${{ env.SRC_DIR }}/scripts/debian/Dockerfile.install_test . - name: Test zbox - run: docker run --platform=${{ matrix.arch.platform }} ${{ env.APP_NAME }}:${{ env.APP_VERSION }} || { echo "Test installation failed"; exit 1; } + run: | + docker load -i ${{ github.workspace }}/${{ env.APP_NAME }}-${{ env.APP_VERSION }}-${{ matrix.distro.name }}-${{ matrix.arch.name }}.tar + docker run --platform=${{ matrix.arch.platform }} --rm ${{ env.APP_NAME }}-${{ env.APP_VERSION }}-${{ matrix.distro.name }}-${{ matrix.arch.name }} || { echo "Test installation failed"; exit 1; } From fd061d99bcaf0b1382765e11c1c452d0b824d3f0 Mon Sep 17 00:00:00 2001 From: storybehind Date: Fri, 26 Jul 2024 18:04:56 +0530 Subject: [PATCH 101/228] use musl-gcc to compile and link statically --- scripts/debian/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/debian/Dockerfile b/scripts/debian/Dockerfile index 170d40c4..c7693269 100644 --- a/scripts/debian/Dockerfile +++ b/scripts/debian/Dockerfile @@ -10,7 +10,7 @@ RUN set -e # Install dependencies RUN echo "Installing dependencies" \ && apt-get update && \ - apt-get install -y wget tar software-properties-common && \ + apt-get install -y wget tar software-properties-common musl-dev musl-tools && \ add-apt-repository ppa:ubuntu-toolchain-r/test && \ apt-get update && \ apt-get install -y gcc-11 g++-11 @@ -42,7 +42,7 @@ COPY . . # Building zboxcli ARG VERSION RUN go env -RUN CGO_ENABLED=1 GOOS=linux GOARCH=${TARGETARCH} go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${VERSION}" -o /zbox . +RUN CC=musl-gcc CGO_ENABLED=1 GOOS=linux GOARCH=${TARGETARCH} go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${VERSION}" -o /zbox . # Stage 2: Create a minimal image with the binary # FROM scratch From c8c2f1bf7d7594926254f911a46f646b7930899b Mon Sep 17 00:00:00 2001 From: storybehind Date: Fri, 26 Jul 2024 18:26:25 +0530 Subject: [PATCH 102/228] use static linking --- scripts/debian/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/debian/Dockerfile b/scripts/debian/Dockerfile index c7693269..aaefac16 100644 --- a/scripts/debian/Dockerfile +++ b/scripts/debian/Dockerfile @@ -42,7 +42,7 @@ COPY . . # Building zboxcli ARG VERSION RUN go env -RUN CC=musl-gcc CGO_ENABLED=1 GOOS=linux GOARCH=${TARGETARCH} go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${VERSION}" -o /zbox . +RUN CC=musl-gcc CGO_ENABLED=1 GOOS=linux GOARCH=${TARGETARCH} go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${VERSION} -extldflags \"-static\"" -o /zbox . # Stage 2: Create a minimal image with the binary # FROM scratch From 6b61ba783da6f46a39272fe709684bc48ae6758e Mon Sep 17 00:00:00 2001 From: storybehind Date: Fri, 26 Jul 2024 19:59:31 +0530 Subject: [PATCH 103/228] install gcc-11 in deb install script --- scripts/debian/Dockerfile | 4 ++-- scripts/debian/install.sh | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/debian/Dockerfile b/scripts/debian/Dockerfile index aaefac16..170d40c4 100644 --- a/scripts/debian/Dockerfile +++ b/scripts/debian/Dockerfile @@ -10,7 +10,7 @@ RUN set -e # Install dependencies RUN echo "Installing dependencies" \ && apt-get update && \ - apt-get install -y wget tar software-properties-common musl-dev musl-tools && \ + apt-get install -y wget tar software-properties-common && \ add-apt-repository ppa:ubuntu-toolchain-r/test && \ apt-get update && \ apt-get install -y gcc-11 g++-11 @@ -42,7 +42,7 @@ COPY . . # Building zboxcli ARG VERSION RUN go env -RUN CC=musl-gcc CGO_ENABLED=1 GOOS=linux GOARCH=${TARGETARCH} go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${VERSION} -extldflags \"-static\"" -o /zbox . +RUN CGO_ENABLED=1 GOOS=linux GOARCH=${TARGETARCH} go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${VERSION}" -o /zbox . # Stage 2: Create a minimal image with the binary # FROM scratch diff --git a/scripts/debian/install.sh b/scripts/debian/install.sh index 9d246d6c..65335b33 100755 --- a/scripts/debian/install.sh +++ b/scripts/debian/install.sh @@ -26,8 +26,9 @@ setup() { assert_consent "Add packages necessary to modify your apt-package sources?" ${global_consent} set -v export DEBIAN_FRONTEND=noninteractive + add-apt-repository ppa:ubuntu-toolchain-r/test apt-get update - apt-get install --assume-yes --no-install-recommends apt-transport-https ca-certificates curl gnupg lsb-release + apt-get install --assume-yes --no-install-recommends apt-transport-https ca-certificates curl gnupg lsb-release gcc-11 g++-11 set +v assert_consent "Add Züs as a trusted package signer?" ${global_consent} From dbf851d0e11686a57561edc6665cbc74662c1c32 Mon Sep 17 00:00:00 2001 From: storybehind Date: Sat, 27 Jul 2024 13:19:00 +0530 Subject: [PATCH 104/228] install gcc-11 in user's env --- scripts/debian/install.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/debian/install.sh b/scripts/debian/install.sh index 65335b33..fb37d1cb 100755 --- a/scripts/debian/install.sh +++ b/scripts/debian/install.sh @@ -26,9 +26,16 @@ setup() { assert_consent "Add packages necessary to modify your apt-package sources?" ${global_consent} set -v export DEBIAN_FRONTEND=noninteractive + apt-get update + apt-get install --assume-yes --no-install-recommends apt-transport-https ca-certificates curl gnupg lsb-release software-properties-common add-apt-repository ppa:ubuntu-toolchain-r/test apt-get update - apt-get install --assume-yes --no-install-recommends apt-transport-https ca-certificates curl gnupg lsb-release gcc-11 g++-11 + apt-get install -y gcc-11 g++-11 + + update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100 + update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 100 + update-alternatives --set gcc /usr/bin/gcc-11 + update-alternatives --set g++ /usr/bin/g++-11 set +v assert_consent "Add Züs as a trusted package signer?" ${global_consent} From 547b54a069188e2a8abe96430a6cffc4c5904f9f Mon Sep 17 00:00:00 2001 From: storybehind Date: Sat, 27 Jul 2024 23:25:51 +0530 Subject: [PATCH 105/228] provide all platforms --- .github/workflows/distribute-zboxcli.yml | 101 ++++++++++++++++++++++- 1 file changed, 98 insertions(+), 3 deletions(-) diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index 7fa5e416..819937f9 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -23,11 +23,60 @@ jobs: strategy: matrix: distro: + - name: artful + base_image: ubuntu:17.10 + - name: bionic + base_image: ubuntu:18.04 + - name: bookworm + base_image: debian:12 + - name: bullseye + base_image: debian:11 + - name: buster + base_image: debian:10 + - name: cosmic + base_image: ubuntu:18.10 + - name: disco + base_image: ubuntu:19.04 + - name: eoan + base_image: ubuntu:19.10 - name: focal base_image: ubuntu:20.04 + - name: groovy + base_image: ubuntu:20.10 + - name: hirsute + base_image: ubuntu:21.04 + - name: impish + base_image: ubuntu:21.10 + - name: jammy + base_image: ubuntu:22.04 + - name: jessie + base_image: debian:8 + - name: noble + base_image: ubuntu:24.04 + - name: stretch + base_image: debian:9 + - name: trusty + base_image: ubuntu:14.04 + - name: wheezy + base_image: debian:7 + - name: xenial + base_image: ubuntu:16.04 arch: - name: amd64 platform: linux/amd64 + goos: amd64 + + - name: arm64 + platform: linux/arm64 + goos: arm64 + + - name: armhf + platform: linux/arm/v7 + goos: arm + + - name: i386 + platform: linux/386 + goos: 386 steps: - name: Checkout code @@ -55,7 +104,7 @@ jobs: --platform ${{ matrix.arch.platform }} \ --build-arg GO_VERSION=${{ env.GO_VERSION }} \ --build-arg BASE_IMAGE=${{ matrix.distro.base_image }} \ - --build-arg TARGETARCH=${{ matrix.arch.name }} \ + --build-arg TARGETARCH=${{ matrix.arch.goos }} \ --build-arg VERSION=${{ env.APP_VERSION }} \ --tag ${{ env.APP_NAME }}-${{ env.APP_VERSION }}-${{ matrix.distro.name }}-${{ matrix.arch.name }} \ --load \ @@ -114,8 +163,8 @@ jobs: runs-on: [ubuntu-latest] needs: build env: - DISTRIBUTIONS: focal - ARCHITECTURES: amd64 + DISTRIBUTIONS: artful bionic bookworm bullseye buster cosmic disco eoan focal groovy hirsute impish jammy jessie noble stretch trusty wheezy xenial + ARCHITECTURES: amd64 arm64 armhf i386 SRC_DIR: ${{ github.workspace }}/src REPO_DIR: ${{ github.workspace }}/aptrepo DEB_DIR: ${{ github.workspace }}/deb-files @@ -213,11 +262,57 @@ jobs: strategy: matrix: distro: + - name: artful + base_image: ubuntu:17.10 + - name: bionic + base_image: ubuntu:18.04 + - name: bookworm + base_image: debian:12 + - name: bullseye + base_image: debian:11 + - name: buster + base_image: debian:10 + - name: cosmic + base_image: ubuntu:18.10 + - name: disco + base_image: ubuntu:19.04 + - name: eoan + base_image: ubuntu:19.10 - name: focal base_image: ubuntu:20.04 + - name: groovy + base_image: ubuntu:20.10 + - name: hirsute + base_image: ubuntu:21.04 + - name: impish + base_image: ubuntu:21.10 + - name: jammy + base_image: ubuntu:22.04 + - name: jessie + base_image: debian:8 + - name: noble + base_image: ubuntu:24.04 + - name: stretch + base_image: debian:9 + - name: trusty + base_image: ubuntu:14.04 + - name: wheezy + base_image: debian:7 + - name: xenial + base_image: ubuntu:16.04 arch: - name: amd64 platform: linux/amd64 + + - name: arm64 + platform: linux/arm64 + + - name: armhf + platform: linux/arm/v7 + + - name: i386 + platform: linux/386 + steps: - name: Checkout code uses: actions/checkout@v2 From 05e0fcdda45d15e2ec25359857a90fbcf661f195 Mon Sep 17 00:00:00 2001 From: storybehind Date: Sat, 27 Jul 2024 23:46:06 +0530 Subject: [PATCH 106/228] remove unsupported platforms --- .github/workflows/distribute-zboxcli.yml | 50 +----------------------- 1 file changed, 1 insertion(+), 49 deletions(-) diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index 819937f9..3aa93c54 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -23,8 +23,6 @@ jobs: strategy: matrix: distro: - - name: artful - base_image: ubuntu:17.10 - name: bionic base_image: ubuntu:18.04 - name: bookworm @@ -33,34 +31,12 @@ jobs: base_image: debian:11 - name: buster base_image: debian:10 - - name: cosmic - base_image: ubuntu:18.10 - - name: disco - base_image: ubuntu:19.04 - - name: eoan - base_image: ubuntu:19.10 - name: focal base_image: ubuntu:20.04 - - name: groovy - base_image: ubuntu:20.10 - - name: hirsute - base_image: ubuntu:21.04 - - name: impish - base_image: ubuntu:21.10 - name: jammy base_image: ubuntu:22.04 - - name: jessie - base_image: debian:8 - name: noble base_image: ubuntu:24.04 - - name: stretch - base_image: debian:9 - - name: trusty - base_image: ubuntu:14.04 - - name: wheezy - base_image: debian:7 - - name: xenial - base_image: ubuntu:16.04 arch: - name: amd64 platform: linux/amd64 @@ -163,7 +139,7 @@ jobs: runs-on: [ubuntu-latest] needs: build env: - DISTRIBUTIONS: artful bionic bookworm bullseye buster cosmic disco eoan focal groovy hirsute impish jammy jessie noble stretch trusty wheezy xenial + DISTRIBUTIONS: bionic bookworm bullseye buster focal jammy noble ARCHITECTURES: amd64 arm64 armhf i386 SRC_DIR: ${{ github.workspace }}/src REPO_DIR: ${{ github.workspace }}/aptrepo @@ -262,8 +238,6 @@ jobs: strategy: matrix: distro: - - name: artful - base_image: ubuntu:17.10 - name: bionic base_image: ubuntu:18.04 - name: bookworm @@ -272,34 +246,12 @@ jobs: base_image: debian:11 - name: buster base_image: debian:10 - - name: cosmic - base_image: ubuntu:18.10 - - name: disco - base_image: ubuntu:19.04 - - name: eoan - base_image: ubuntu:19.10 - name: focal base_image: ubuntu:20.04 - - name: groovy - base_image: ubuntu:20.10 - - name: hirsute - base_image: ubuntu:21.04 - - name: impish - base_image: ubuntu:21.10 - name: jammy base_image: ubuntu:22.04 - - name: jessie - base_image: debian:8 - name: noble base_image: ubuntu:24.04 - - name: stretch - base_image: debian:9 - - name: trusty - base_image: ubuntu:14.04 - - name: wheezy - base_image: debian:7 - - name: xenial - base_image: ubuntu:16.04 arch: - name: amd64 platform: linux/amd64 From a1ffcee07c243456bed80828c077c044dc7e0db4 Mon Sep 17 00:00:00 2001 From: storybehind Date: Sun, 28 Jul 2024 06:32:10 +0530 Subject: [PATCH 107/228] test ubuntu distributions --- .github/workflows/distribute-zboxcli.yml | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index 3aa93c54..826e6b07 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -25,12 +25,6 @@ jobs: distro: - name: bionic base_image: ubuntu:18.04 - - name: bookworm - base_image: debian:12 - - name: bullseye - base_image: debian:11 - - name: buster - base_image: debian:10 - name: focal base_image: ubuntu:20.04 - name: jammy @@ -139,7 +133,7 @@ jobs: runs-on: [ubuntu-latest] needs: build env: - DISTRIBUTIONS: bionic bookworm bullseye buster focal jammy noble + DISTRIBUTIONS: bionic focal jammy noble ARCHITECTURES: amd64 arm64 armhf i386 SRC_DIR: ${{ github.workspace }}/src REPO_DIR: ${{ github.workspace }}/aptrepo @@ -240,12 +234,6 @@ jobs: distro: - name: bionic base_image: ubuntu:18.04 - - name: bookworm - base_image: debian:12 - - name: bullseye - base_image: debian:11 - - name: buster - base_image: debian:10 - name: focal base_image: ubuntu:20.04 - name: jammy From 6daf8fe30705ec7c6b7e4adccd18803cd1a6754e Mon Sep 17 00:00:00 2001 From: storybehind Date: Sun, 28 Jul 2024 07:10:56 +0530 Subject: [PATCH 108/228] fix goarch value --- .github/workflows/distribute-zboxcli.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index 826e6b07..c2f2275f 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -34,19 +34,19 @@ jobs: arch: - name: amd64 platform: linux/amd64 - goos: amd64 + goarch: amd64 - name: arm64 platform: linux/arm64 - goos: arm64 + goarch: arm64 - name: armhf platform: linux/arm/v7 - goos: arm + goarch: arm64 - name: i386 platform: linux/386 - goos: 386 + goarch: 386 steps: - name: Checkout code @@ -74,7 +74,7 @@ jobs: --platform ${{ matrix.arch.platform }} \ --build-arg GO_VERSION=${{ env.GO_VERSION }} \ --build-arg BASE_IMAGE=${{ matrix.distro.base_image }} \ - --build-arg TARGETARCH=${{ matrix.arch.goos }} \ + --build-arg TARGETARCH=${{ matrix.arch.goarch }} \ --build-arg VERSION=${{ env.APP_VERSION }} \ --tag ${{ env.APP_NAME }}-${{ env.APP_VERSION }}-${{ matrix.distro.name }}-${{ matrix.arch.name }} \ --load \ From 13d1a3b64bc2aade73ac11da1029047563dc6a9b Mon Sep 17 00:00:00 2001 From: storybehind Date: Sun, 28 Jul 2024 16:47:29 +0530 Subject: [PATCH 109/228] setup docker qemu --- .github/workflows/distribute-zboxcli.yml | 26 ++++++++++-------------- scripts/debian/Dockerfile | 7 +++---- scripts/debian/Dockerfile.install_test | 5 ++++- 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index c2f2275f..bf7abc5b 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -40,14 +40,6 @@ jobs: platform: linux/arm64 goarch: arm64 - - name: armhf - platform: linux/arm/v7 - goarch: arm64 - - - name: i386 - platform: linux/386 - goarch: 386 - steps: - name: Checkout code uses: actions/checkout@v2 @@ -67,6 +59,11 @@ jobs: mkdir -p ${{ env.OUTPUT_DIR }} mkdir -p ${{ env.PACKAGE_DIR }} + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + with: + platforms: ${{ matrix.arch.platform }} + - name: Build Docker image run: | docker buildx create --use @@ -134,7 +131,7 @@ jobs: needs: build env: DISTRIBUTIONS: bionic focal jammy noble - ARCHITECTURES: amd64 arm64 armhf i386 + ARCHITECTURES: amd64 arm64 SRC_DIR: ${{ github.workspace }}/src REPO_DIR: ${{ github.workspace }}/aptrepo DEB_DIR: ${{ github.workspace }}/deb-files @@ -247,18 +244,17 @@ jobs: - name: arm64 platform: linux/arm64 - - name: armhf - platform: linux/arm/v7 - - - name: i386 - platform: linux/386 - steps: - name: Checkout code uses: actions/checkout@v2 with: path: ${{ env.SRC_DIR }} + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + with: + platforms: ${{ matrix.arch.platform }} + - name: Build Docker image run: | docker buildx create --use diff --git a/scripts/debian/Dockerfile b/scripts/debian/Dockerfile index 170d40c4..462fb17f 100644 --- a/scripts/debian/Dockerfile +++ b/scripts/debian/Dockerfile @@ -10,7 +10,7 @@ RUN set -e # Install dependencies RUN echo "Installing dependencies" \ && apt-get update && \ - apt-get install -y wget tar software-properties-common && \ + apt-get install -y wget tar software-properties-common dpkg && \ add-apt-repository ppa:ubuntu-toolchain-r/test && \ apt-get update && \ apt-get install -y gcc-11 g++-11 @@ -21,6 +21,8 @@ RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100 && \ update-alternatives --set gcc /usr/bin/gcc-11 && \ update-alternatives --set g++ /usr/bin/g++-11 +# print architecture +RUN dpkg --print-architecture # Download and install Go ARG GO_VERSION=1.21.0 @@ -44,6 +46,3 @@ ARG VERSION RUN go env RUN CGO_ENABLED=1 GOOS=linux GOARCH=${TARGETARCH} go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${VERSION}" -o /zbox . -# Stage 2: Create a minimal image with the binary -# FROM scratch -# COPY --from=builder /zbox /zbox diff --git a/scripts/debian/Dockerfile.install_test b/scripts/debian/Dockerfile.install_test index cf96ec0a..e639d7ab 100644 --- a/scripts/debian/Dockerfile.install_test +++ b/scripts/debian/Dockerfile.install_test @@ -5,7 +5,10 @@ ARG BASE_IMAGE FROM --platform=$BUILDPLATFORM ${BASE_IMAGE} # Install necessary packages -RUN apt-get update && apt-get install -y curl +RUN apt-get update && apt-get install -y curl dpkg + +# print architecture +RUN dpkg --print-architecture # Download and install the app ARG LOC=https://packages.zus.network/deb_install.sh From f597f1df8d2dd2fec60959260f08910a6b5cd2b4 Mon Sep 17 00:00:00 2001 From: storybehind Date: Sun, 28 Jul 2024 19:04:07 +0530 Subject: [PATCH 110/228] separate build file for arm64 --- .github/workflows/distribute-zboxcli.yml | 5 +- scripts/Dockerfile.ubuntu_build_arm64 | 47 +++++++++++++++++++ ...ckerfile => Dockerfile.ubuntu_build_amd64} | 5 +- 3 files changed, 50 insertions(+), 7 deletions(-) create mode 100644 scripts/Dockerfile.ubuntu_build_arm64 rename scripts/debian/{Dockerfile => Dockerfile.ubuntu_build_amd64} (84%) diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index bf7abc5b..308840d5 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -34,11 +34,9 @@ jobs: arch: - name: amd64 platform: linux/amd64 - goarch: amd64 - name: arm64 platform: linux/arm64 - goarch: arm64 steps: - name: Checkout code @@ -71,12 +69,11 @@ jobs: --platform ${{ matrix.arch.platform }} \ --build-arg GO_VERSION=${{ env.GO_VERSION }} \ --build-arg BASE_IMAGE=${{ matrix.distro.base_image }} \ - --build-arg TARGETARCH=${{ matrix.arch.goarch }} \ --build-arg VERSION=${{ env.APP_VERSION }} \ --tag ${{ env.APP_NAME }}-${{ env.APP_VERSION }}-${{ matrix.distro.name }}-${{ matrix.arch.name }} \ --load \ --output type=docker,dest=${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}-${{ env.APP_VERSION }}-${{ matrix.distro.name }}-${{ matrix.arch.name }}.tar \ - -f ${{ env.SRC_DIR }}/scripts/debian/Dockerfile ${{ env.SRC_DIR }} + -f ${{ env.SRC_DIR }}/scripts/debian/Dockerfile.ubuntu_build_${matrix.arch.name} ${{ env.SRC_DIR }} - name: Load Docker image run: | diff --git a/scripts/Dockerfile.ubuntu_build_arm64 b/scripts/Dockerfile.ubuntu_build_arm64 new file mode 100644 index 00000000..32864f47 --- /dev/null +++ b/scripts/Dockerfile.ubuntu_build_arm64 @@ -0,0 +1,47 @@ +# syntax=docker/dockerfile:latest + +ARG BASE_IMAGE + +# Stage 1: Build zboxcli on the base image +FROM --platform=$BUILDPLATFORM ${BASE_IMAGE} AS builder + +RUN set -e + +# Install dependencies +RUN echo "Installing dependencies" \ + && apt-get update && \ + apt-get install -y wget tar software-properties-common dpkg && \ + add-apt-repository ppa:ubuntu-toolchain-r/test && \ + apt-get update && \ + apt-get install -y gcc-11 g++-11 gcc-11-aarch64-linux-gnu g++-11-aarch64-linux-gnu + +# Set gcc-11 as default +RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100 && \ + update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 100 && \ + update-alternatives --set gcc /usr/bin/gcc-11 && \ + update-alternatives --set g++ /usr/bin/g++-11 + +# print architecture +RUN dpkg --print-architecture + +# Download and install Go +ARG GO_VERSION=1.21.0 +RUN echo "Downloading and installing Go version ${GO_VERSION} for architecture ${TARGETARCH}" && \ + wget https://go.dev/dl/go${GO_VERSION}.linux-arm64.tar.gz -O /tmp/go.tar.gz && \ + tar -C /usr/local -xzf /tmp/go.tar.gz && \ + ln -s /usr/local/go/bin/go /usr/local/bin/go + +# Set Go environment variables +ENV GOROOT=/usr/local/go +ENV GOPATH=/root/go +ENV PATH=$GOPATH/bin:$GOROOT/bin:$PATH + +# Setting up working directory and copying files +WORKDIR /zboxcli +COPY . . + +# Building zboxcli +ARG VERSION +RUN go env +RUN CC=aarch64-linux-gnu-gcc-11 CXX=aarch64-linux-gnu-g++-11 CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${VERSION}" -o /zbox . + diff --git a/scripts/debian/Dockerfile b/scripts/debian/Dockerfile.ubuntu_build_amd64 similarity index 84% rename from scripts/debian/Dockerfile rename to scripts/debian/Dockerfile.ubuntu_build_amd64 index 462fb17f..b54f430e 100644 --- a/scripts/debian/Dockerfile +++ b/scripts/debian/Dockerfile.ubuntu_build_amd64 @@ -26,9 +26,8 @@ RUN dpkg --print-architecture # Download and install Go ARG GO_VERSION=1.21.0 -ARG TARGETARCH RUN echo "Downloading and installing Go version ${GO_VERSION} for architecture ${TARGETARCH}" && \ - wget https://go.dev/dl/go${GO_VERSION}.linux-${TARGETARCH}.tar.gz -O /tmp/go.tar.gz && \ + wget https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz -O /tmp/go.tar.gz && \ tar -C /usr/local -xzf /tmp/go.tar.gz && \ ln -s /usr/local/go/bin/go /usr/local/bin/go @@ -44,5 +43,5 @@ COPY . . # Building zboxcli ARG VERSION RUN go env -RUN CGO_ENABLED=1 GOOS=linux GOARCH=${TARGETARCH} go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${VERSION}" -o /zbox . +RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${VERSION}" -o /zbox . From 955a1db2c8b43592c1d9b47b06d406524bb44847 Mon Sep 17 00:00:00 2001 From: storybehind Date: Sun, 28 Jul 2024 19:07:09 +0530 Subject: [PATCH 111/228] update workflow --- .github/workflows/distribute-zboxcli.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index 308840d5..416a5137 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -73,7 +73,7 @@ jobs: --tag ${{ env.APP_NAME }}-${{ env.APP_VERSION }}-${{ matrix.distro.name }}-${{ matrix.arch.name }} \ --load \ --output type=docker,dest=${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}-${{ env.APP_VERSION }}-${{ matrix.distro.name }}-${{ matrix.arch.name }}.tar \ - -f ${{ env.SRC_DIR }}/scripts/debian/Dockerfile.ubuntu_build_${matrix.arch.name} ${{ env.SRC_DIR }} + -f ${{ env.SRC_DIR }}/scripts/debian/Dockerfile.ubuntu_build_${{ matrix.arch.name }} ${{ env.SRC_DIR }} - name: Load Docker image run: | From 2aacd6d6323827ef3daaf425cd50f3b0291d63a1 Mon Sep 17 00:00:00 2001 From: storybehind Date: Sun, 28 Jul 2024 19:10:16 +0530 Subject: [PATCH 112/228] move dockerfile --- scripts/{ => debian}/Dockerfile.ubuntu_build_arm64 | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename scripts/{ => debian}/Dockerfile.ubuntu_build_arm64 (100%) diff --git a/scripts/Dockerfile.ubuntu_build_arm64 b/scripts/debian/Dockerfile.ubuntu_build_arm64 similarity index 100% rename from scripts/Dockerfile.ubuntu_build_arm64 rename to scripts/debian/Dockerfile.ubuntu_build_arm64 From fdd46be3b2289a93121d0ebf70284758a37f55e1 Mon Sep 17 00:00:00 2001 From: storybehind Date: Sun, 28 Jul 2024 19:19:38 +0530 Subject: [PATCH 113/228] set compiler for arm64 build --- scripts/debian/Dockerfile.ubuntu_build_amd64 | 2 +- scripts/debian/Dockerfile.ubuntu_build_arm64 | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/debian/Dockerfile.ubuntu_build_amd64 b/scripts/debian/Dockerfile.ubuntu_build_amd64 index b54f430e..d59ae68f 100644 --- a/scripts/debian/Dockerfile.ubuntu_build_amd64 +++ b/scripts/debian/Dockerfile.ubuntu_build_amd64 @@ -43,5 +43,5 @@ COPY . . # Building zboxcli ARG VERSION RUN go env -RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${VERSION}" -o /zbox . +RUN CC=gcc-11 CXX=g++-11 CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${VERSION}" -o /zbox . diff --git a/scripts/debian/Dockerfile.ubuntu_build_arm64 b/scripts/debian/Dockerfile.ubuntu_build_arm64 index 32864f47..206873a6 100644 --- a/scripts/debian/Dockerfile.ubuntu_build_arm64 +++ b/scripts/debian/Dockerfile.ubuntu_build_arm64 @@ -13,7 +13,7 @@ RUN echo "Installing dependencies" \ apt-get install -y wget tar software-properties-common dpkg && \ add-apt-repository ppa:ubuntu-toolchain-r/test && \ apt-get update && \ - apt-get install -y gcc-11 g++-11 gcc-11-aarch64-linux-gnu g++-11-aarch64-linux-gnu + apt-get install -y gcc-11 g++-11 gcc-aarch64-linux-gnu g++-aarch64-linux-gnu # Set gcc-11 as default RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100 && \ @@ -43,5 +43,5 @@ COPY . . # Building zboxcli ARG VERSION RUN go env -RUN CC=aarch64-linux-gnu-gcc-11 CXX=aarch64-linux-gnu-g++-11 CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${VERSION}" -o /zbox . +RUN CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${VERSION}" -o /zbox . From 03b624dc196a211bd38477fe9650544dc1603149 Mon Sep 17 00:00:00 2001 From: Jayash Satolia <73050737+Jayashsatolia403@users.noreply.github.com> Date: Mon, 29 Jul 2024 18:49:25 +0530 Subject: [PATCH 114/228] Fix input --- cmd/newallocation.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/newallocation.go b/cmd/newallocation.go index eeacef67..460fdadd 100755 --- a/cmd/newallocation.go +++ b/cmd/newallocation.go @@ -257,6 +257,7 @@ var newallocationCmd = &cobra.Command{ FileOptionsParams: &fileOptionParams, ThirdPartyExtendable: thirdPartyExtendable, Force: force, + IsEnterprise: isEnterprise, } allocationID, _, _, err = sdk.CreateAllocationWith(options) if err != nil { From 80140b2d5b39fe016c98cd3a77ef1ec73c34dc0d Mon Sep 17 00:00:00 2001 From: storybehind Date: Mon, 29 Jul 2024 19:35:29 +0530 Subject: [PATCH 115/228] fix dockerfile to target platform --- .github/workflows/distribute-zboxcli.yml | 6 +----- scripts/debian/Dockerfile.build | 11 +++++++++++ scripts/debian/Dockerfile.install_test | 2 +- scripts/debian/install.sh | 5 ----- 4 files changed, 13 insertions(+), 11 deletions(-) create mode 100644 scripts/debian/Dockerfile.build diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index 416a5137..5d23ce02 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -64,16 +64,13 @@ jobs: - name: Build Docker image run: | - docker buildx create --use docker buildx build \ --platform ${{ matrix.arch.platform }} \ - --build-arg GO_VERSION=${{ env.GO_VERSION }} \ - --build-arg BASE_IMAGE=${{ matrix.distro.base_image }} \ --build-arg VERSION=${{ env.APP_VERSION }} \ --tag ${{ env.APP_NAME }}-${{ env.APP_VERSION }}-${{ matrix.distro.name }}-${{ matrix.arch.name }} \ --load \ --output type=docker,dest=${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}-${{ env.APP_VERSION }}-${{ matrix.distro.name }}-${{ matrix.arch.name }}.tar \ - -f ${{ env.SRC_DIR }}/scripts/debian/Dockerfile.ubuntu_build_${{ matrix.arch.name }} ${{ env.SRC_DIR }} + -f ${{ env.SRC_DIR }}/scripts/debian/Dockerfile.build ${{ env.SRC_DIR }} - name: Load Docker image run: | @@ -254,7 +251,6 @@ jobs: - name: Build Docker image run: | - docker buildx create --use docker buildx build \ --platform ${{ matrix.arch.platform }} \ --build-arg BASE_IMAGE=${{ matrix.distro.base_image }} \ diff --git a/scripts/debian/Dockerfile.build b/scripts/debian/Dockerfile.build new file mode 100644 index 00000000..aa27eb06 --- /dev/null +++ b/scripts/debian/Dockerfile.build @@ -0,0 +1,11 @@ +FROM --platform=$BUILDPLATFORM golang:1.21-alpine AS build +ARG VERSION +WORKDIR /src +COPY go.mod go.sum . +RUN go mod download +COPY . . +ARG TARGETOS TARGETARCH +RUN CGO_ENABLED=1 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${VERSION}" -o /zbox . + +FROM alpine +COPY --from=build /out/myapp /bin \ No newline at end of file diff --git a/scripts/debian/Dockerfile.install_test b/scripts/debian/Dockerfile.install_test index e639d7ab..cbaa946d 100644 --- a/scripts/debian/Dockerfile.install_test +++ b/scripts/debian/Dockerfile.install_test @@ -2,7 +2,7 @@ ARG BASE_IMAGE -FROM --platform=$BUILDPLATFORM ${BASE_IMAGE} +FROM --platform=$TARGETPLATFORM ${BASE_IMAGE} # Install necessary packages RUN apt-get update && apt-get install -y curl dpkg diff --git a/scripts/debian/install.sh b/scripts/debian/install.sh index fb37d1cb..792a0a85 100755 --- a/scripts/debian/install.sh +++ b/scripts/debian/install.sh @@ -31,11 +31,6 @@ setup() { add-apt-repository ppa:ubuntu-toolchain-r/test apt-get update apt-get install -y gcc-11 g++-11 - - update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100 - update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 100 - update-alternatives --set gcc /usr/bin/gcc-11 - update-alternatives --set g++ /usr/bin/g++-11 set +v assert_consent "Add Züs as a trusted package signer?" ${global_consent} From 125a0e076a9778d8fb0b2a995ae1a0734c43437f Mon Sep 17 00:00:00 2001 From: storybehind Date: Mon, 29 Jul 2024 19:39:35 +0530 Subject: [PATCH 116/228] update workflow --- .github/workflows/distribute-zboxcli.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index 5d23ce02..0455e58c 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -64,6 +64,7 @@ jobs: - name: Build Docker image run: | + docker buildx create --use docker buildx build \ --platform ${{ matrix.arch.platform }} \ --build-arg VERSION=${{ env.APP_VERSION }} \ @@ -251,6 +252,7 @@ jobs: - name: Build Docker image run: | + docker buildx create --use docker buildx build \ --platform ${{ matrix.arch.platform }} \ --build-arg BASE_IMAGE=${{ matrix.distro.base_image }} \ From a11c4f3c63c99c1820148c4f282508f791f52ea4 Mon Sep 17 00:00:00 2001 From: storybehind Date: Mon, 29 Jul 2024 19:53:55 +0530 Subject: [PATCH 117/228] update golang base image --- scripts/debian/Dockerfile.build | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/scripts/debian/Dockerfile.build b/scripts/debian/Dockerfile.build index aa27eb06..5b3ac5ce 100644 --- a/scripts/debian/Dockerfile.build +++ b/scripts/debian/Dockerfile.build @@ -1,4 +1,4 @@ -FROM --platform=$BUILDPLATFORM golang:1.21-alpine AS build +FROM --platform=$BUILDPLATFORM golang:1.21 AS build ARG VERSION WORKDIR /src COPY go.mod go.sum . @@ -6,6 +6,3 @@ RUN go mod download COPY . . ARG TARGETOS TARGETARCH RUN CGO_ENABLED=1 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${VERSION}" -o /zbox . - -FROM alpine -COPY --from=build /out/myapp /bin \ No newline at end of file From b78237f33f13fbf34aad5f3201d7d6d2541ff862 Mon Sep 17 00:00:00 2001 From: storybehind Date: Mon, 29 Jul 2024 20:01:26 +0530 Subject: [PATCH 118/228] fix dockerfile --- scripts/debian/Dockerfile.build | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/debian/Dockerfile.build b/scripts/debian/Dockerfile.build index 5b3ac5ce..ed26e9ac 100644 --- a/scripts/debian/Dockerfile.build +++ b/scripts/debian/Dockerfile.build @@ -1,8 +1,8 @@ -FROM --platform=$BUILDPLATFORM golang:1.21 AS build +FROM --platform=$TARGETPLATFORM golang:1.21 AS build ARG VERSION WORKDIR /src COPY go.mod go.sum . RUN go mod download COPY . . -ARG TARGETOS TARGETARCH -RUN CGO_ENABLED=1 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${VERSION}" -o /zbox . +RUN go env +RUN CGO_ENABLED=1 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${VERSION}" -o /zbox . From 6f14ed53ea81a6e81178434a1d70d25a02610022 Mon Sep 17 00:00:00 2001 From: storybehind Date: Mon, 29 Jul 2024 21:51:11 +0530 Subject: [PATCH 119/228] set gcc-11 as default --- scripts/debian/install.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/debian/install.sh b/scripts/debian/install.sh index 792a0a85..fb37d1cb 100755 --- a/scripts/debian/install.sh +++ b/scripts/debian/install.sh @@ -31,6 +31,11 @@ setup() { add-apt-repository ppa:ubuntu-toolchain-r/test apt-get update apt-get install -y gcc-11 g++-11 + + update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100 + update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 100 + update-alternatives --set gcc /usr/bin/gcc-11 + update-alternatives --set g++ /usr/bin/g++-11 set +v assert_consent "Add Züs as a trusted package signer?" ${global_consent} From f53d2514e2bcb99dd540e80ca20742cf8cf02517 Mon Sep 17 00:00:00 2001 From: storybehind Date: Mon, 29 Jul 2024 22:56:02 +0530 Subject: [PATCH 120/228] try static linking --- scripts/debian/Dockerfile.build | 2 +- scripts/debian/install.sh | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/scripts/debian/Dockerfile.build b/scripts/debian/Dockerfile.build index ed26e9ac..ff24b4c3 100644 --- a/scripts/debian/Dockerfile.build +++ b/scripts/debian/Dockerfile.build @@ -5,4 +5,4 @@ COPY go.mod go.sum . RUN go mod download COPY . . RUN go env -RUN CGO_ENABLED=1 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${VERSION}" -o /zbox . +RUN CGO_ENABLED=1 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${VERSION} -linkmode 'external' -extldflags '-static'" -o /zbox . diff --git a/scripts/debian/install.sh b/scripts/debian/install.sh index fb37d1cb..792a0a85 100755 --- a/scripts/debian/install.sh +++ b/scripts/debian/install.sh @@ -31,11 +31,6 @@ setup() { add-apt-repository ppa:ubuntu-toolchain-r/test apt-get update apt-get install -y gcc-11 g++-11 - - update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100 - update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 100 - update-alternatives --set gcc /usr/bin/gcc-11 - update-alternatives --set g++ /usr/bin/g++-11 set +v assert_consent "Add Züs as a trusted package signer?" ${global_consent} From 867687d502d1b59a263bd0e5806fd6753cd3319d Mon Sep 17 00:00:00 2001 From: storybehind Date: Mon, 29 Jul 2024 23:56:49 +0530 Subject: [PATCH 121/228] refactor --- scripts/debian/Dockerfile.install_test | 2 +- scripts/debian/Dockerfile.ubuntu_build_amd64 | 47 -------------------- scripts/debian/Dockerfile.ubuntu_build_arm64 | 47 -------------------- scripts/debian/install.sh | 35 +-------------- 4 files changed, 3 insertions(+), 128 deletions(-) delete mode 100644 scripts/debian/Dockerfile.ubuntu_build_amd64 delete mode 100644 scripts/debian/Dockerfile.ubuntu_build_arm64 diff --git a/scripts/debian/Dockerfile.install_test b/scripts/debian/Dockerfile.install_test index cbaa946d..fbccb986 100644 --- a/scripts/debian/Dockerfile.install_test +++ b/scripts/debian/Dockerfile.install_test @@ -13,7 +13,7 @@ RUN dpkg --print-architecture # Download and install the app ARG LOC=https://packages.zus.network/deb_install.sh RUN set -e; \ - curl -sL ${LOC} | bash -s -- -y + curl -sL ${LOC} | sudo bash # Check the app version CMD ["zbox", "version"] diff --git a/scripts/debian/Dockerfile.ubuntu_build_amd64 b/scripts/debian/Dockerfile.ubuntu_build_amd64 deleted file mode 100644 index d59ae68f..00000000 --- a/scripts/debian/Dockerfile.ubuntu_build_amd64 +++ /dev/null @@ -1,47 +0,0 @@ -# syntax=docker/dockerfile:latest - -ARG BASE_IMAGE - -# Stage 1: Build zboxcli on the base image -FROM --platform=$BUILDPLATFORM ${BASE_IMAGE} AS builder - -RUN set -e - -# Install dependencies -RUN echo "Installing dependencies" \ - && apt-get update && \ - apt-get install -y wget tar software-properties-common dpkg && \ - add-apt-repository ppa:ubuntu-toolchain-r/test && \ - apt-get update && \ - apt-get install -y gcc-11 g++-11 - -# Set gcc-11 as default -RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100 && \ - update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 100 && \ - update-alternatives --set gcc /usr/bin/gcc-11 && \ - update-alternatives --set g++ /usr/bin/g++-11 - -# print architecture -RUN dpkg --print-architecture - -# Download and install Go -ARG GO_VERSION=1.21.0 -RUN echo "Downloading and installing Go version ${GO_VERSION} for architecture ${TARGETARCH}" && \ - wget https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz -O /tmp/go.tar.gz && \ - tar -C /usr/local -xzf /tmp/go.tar.gz && \ - ln -s /usr/local/go/bin/go /usr/local/bin/go - -# Set Go environment variables -ENV GOROOT=/usr/local/go -ENV GOPATH=/root/go -ENV PATH=$GOPATH/bin:$GOROOT/bin:$PATH - -# Setting up working directory and copying files -WORKDIR /zboxcli -COPY . . - -# Building zboxcli -ARG VERSION -RUN go env -RUN CC=gcc-11 CXX=g++-11 CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${VERSION}" -o /zbox . - diff --git a/scripts/debian/Dockerfile.ubuntu_build_arm64 b/scripts/debian/Dockerfile.ubuntu_build_arm64 deleted file mode 100644 index 206873a6..00000000 --- a/scripts/debian/Dockerfile.ubuntu_build_arm64 +++ /dev/null @@ -1,47 +0,0 @@ -# syntax=docker/dockerfile:latest - -ARG BASE_IMAGE - -# Stage 1: Build zboxcli on the base image -FROM --platform=$BUILDPLATFORM ${BASE_IMAGE} AS builder - -RUN set -e - -# Install dependencies -RUN echo "Installing dependencies" \ - && apt-get update && \ - apt-get install -y wget tar software-properties-common dpkg && \ - add-apt-repository ppa:ubuntu-toolchain-r/test && \ - apt-get update && \ - apt-get install -y gcc-11 g++-11 gcc-aarch64-linux-gnu g++-aarch64-linux-gnu - -# Set gcc-11 as default -RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100 && \ - update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 100 && \ - update-alternatives --set gcc /usr/bin/gcc-11 && \ - update-alternatives --set g++ /usr/bin/g++-11 - -# print architecture -RUN dpkg --print-architecture - -# Download and install Go -ARG GO_VERSION=1.21.0 -RUN echo "Downloading and installing Go version ${GO_VERSION} for architecture ${TARGETARCH}" && \ - wget https://go.dev/dl/go${GO_VERSION}.linux-arm64.tar.gz -O /tmp/go.tar.gz && \ - tar -C /usr/local -xzf /tmp/go.tar.gz && \ - ln -s /usr/local/go/bin/go /usr/local/bin/go - -# Set Go environment variables -ENV GOROOT=/usr/local/go -ENV GOPATH=/root/go -ENV PATH=$GOPATH/bin:$GOROOT/bin:$PATH - -# Setting up working directory and copying files -WORKDIR /zboxcli -COPY . . - -# Building zboxcli -ARG VERSION -RUN go env -RUN CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${VERSION}" -o /zbox . - diff --git a/scripts/debian/install.sh b/scripts/debian/install.sh index 792a0a85..aea16467 100755 --- a/scripts/debian/install.sh +++ b/scripts/debian/install.sh @@ -2,38 +2,14 @@ set -e -if [[ $# -ge 1 && $1 == "-y" ]]; then - global_consent=0 -else - global_consent=1 -fi - -function assert_consent { - if [[ $2 -eq 0 ]]; then - return 0 - fi - - echo -n "$1 [Y/n] " - read consent - if [[ ! "${consent}" == "y" && ! "${consent}" == "Y" && ! "${consent}" == "" ]]; then - echo "'${consent}'" - exit 1 - fi -} - setup() { - assert_consent "Add packages necessary to modify your apt-package sources?" ${global_consent} set -v export DEBIAN_FRONTEND=noninteractive apt-get update apt-get install --assume-yes --no-install-recommends apt-transport-https ca-certificates curl gnupg lsb-release software-properties-common - add-apt-repository ppa:ubuntu-toolchain-r/test - apt-get update - apt-get install -y gcc-11 g++-11 set +v - assert_consent "Add Züs as a trusted package signer?" ${global_consent} set -v mkdir -p /etc/apt/keyrings curl -sLS https://packages.zus.network/zus.asc | @@ -41,13 +17,12 @@ setup() { chmod go+r /etc/apt/keyrings/zus.gpg set +v - assert_consent "Add the zbox Repository to your apt sources?" ${global_consent} set -v # Use env var DIST_CODE for the package dist name if provided if [[ -z $DIST_CODE ]]; then CLI_REPO=$(lsb_release -cs) shopt -s nocasematch - ERROR_MSG="Unable to find a package for your system. Please check if an existing package in https://packages.zus.network/aptrepo/dists/ can be used in your system and install with the dist name: 'curl -sL https://packages.zus.network/aptrepo/ | sudo DIST_CODE= bash'" + ERROR_MSG="Unable to find a package for your system. Please check if an existing package in https://packages.zus.network/aptrepo/dists/ can be used in your system and install with the dist name: 'curl -sL https://packages.zus.network/deb_install.sh | sudo DIST_CODE= bash'" if [[ ! $(curl -sL https://packages.zus.network/aptrepo/dists/) =~ $CLI_REPO ]]; then DIST=$(lsb_release -is) if [[ $DIST =~ "Ubuntu" ]]; then @@ -86,17 +61,11 @@ Signed-by: /etc/apt/keyrings/zus.gpg" | tee /etc/apt/sources.list.d/zbox.sources apt-get update set +v - assert_consent "Install the zbox?" ${global_consent} apt-get install --assume-yes zbox - # Check if config.yaml already exists + # Create or update the config.yaml file CONFIG_DIR="${HOME}/.zcn" CONFIG_PATH="${CONFIG_DIR}/config.yaml" - if [ -f "${CONFIG_PATH}" ]; then - assert_consent "The configuration file ${CONFIG_PATH} already exists. Do you want to update it?" ${global_consent} - fi - - # Create or update the config.yaml file echo "Creating/updating configuration file at ${CONFIG_PATH}..." mkdir -p $CONFIG_DIR touch $CONFIG_PATH From bc9ec933ab45d21caf1e8912d40b9f0b2b3b6ee6 Mon Sep 17 00:00:00 2001 From: storybehind Date: Tue, 30 Jul 2024 00:29:04 +0530 Subject: [PATCH 122/228] remove sudo in dockerfile --- scripts/debian/Dockerfile.install_test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/debian/Dockerfile.install_test b/scripts/debian/Dockerfile.install_test index fbccb986..ef74c1fb 100644 --- a/scripts/debian/Dockerfile.install_test +++ b/scripts/debian/Dockerfile.install_test @@ -13,7 +13,7 @@ RUN dpkg --print-architecture # Download and install the app ARG LOC=https://packages.zus.network/deb_install.sh RUN set -e; \ - curl -sL ${LOC} | sudo bash + curl -sL ${LOC} | bash # Check the app version CMD ["zbox", "version"] From 2f8d0b8c98a5c1d5628f0e4dc64e7b76a8df51a6 Mon Sep 17 00:00:00 2001 From: storybehind Date: Wed, 31 Jul 2024 11:06:21 +0530 Subject: [PATCH 123/228] add debian distro --- .github/workflows/distribute-zboxcli.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index 0455e58c..7cd1e6d5 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -31,6 +31,13 @@ jobs: base_image: ubuntu:22.04 - name: noble base_image: ubuntu:24.04 + - name: bookworm + base_image: debian:12 + - name: bullseye + base_image: debian:11 + - name: buster + base_image: debian:10 + arch: - name: amd64 platform: linux/amd64 @@ -125,7 +132,7 @@ jobs: runs-on: [ubuntu-latest] needs: build env: - DISTRIBUTIONS: bionic focal jammy noble + DISTRIBUTIONS: bionic focal jammy noble bookworm bullseye buster ARCHITECTURES: amd64 arm64 SRC_DIR: ${{ github.workspace }}/src REPO_DIR: ${{ github.workspace }}/aptrepo @@ -232,6 +239,12 @@ jobs: base_image: ubuntu:22.04 - name: noble base_image: ubuntu:24.04 + - name: bookworm + base_image: debian:12 + - name: bullseye + base_image: debian:11 + - name: buster + base_image: debian:10 arch: - name: amd64 platform: linux/amd64 From b0f018925062090127ed73c06bb39eccca99c3ba Mon Sep 17 00:00:00 2001 From: storybehind Date: Wed, 31 Jul 2024 11:27:53 +0530 Subject: [PATCH 124/228] install dependencies in user env --- scripts/debian/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/debian/install.sh b/scripts/debian/install.sh index aea16467..b4098fc5 100755 --- a/scripts/debian/install.sh +++ b/scripts/debian/install.sh @@ -7,7 +7,7 @@ setup() { set -v export DEBIAN_FRONTEND=noninteractive apt-get update - apt-get install --assume-yes --no-install-recommends apt-transport-https ca-certificates curl gnupg lsb-release software-properties-common + apt-get install --assume-yes --no-install-recommends apt-transport-https ca-certificates curl gnupg lsb-release software-properties-common apt-utils zstd dpkg set +v set -v From ed7ed9c32b5d81122362f7baa91f55a2140a1c9a Mon Sep 17 00:00:00 2001 From: storybehind Date: Wed, 31 Jul 2024 14:38:49 +0530 Subject: [PATCH 125/228] try gzip compression --- .github/workflows/distribute-zboxcli.yml | 2 +- scripts/debian/install.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index 7cd1e6d5..e4809746 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -120,7 +120,7 @@ jobs: tar czf "${{ env.OUTPUT_DIR }}/data.tar.gz" -C "${{ env.PACKAGE_DIR }}" . echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --batch --yes --passphrase-fd 0 --pinentry-mode loopback --detach-sign --armor -o "${{ env.PACKAGE_DIR }}/DEBIAN/signature.asc" "${{ env.OUTPUT_DIR }}/data.tar.gz" - dpkg-deb -b ${{ env.PACKAGE_DIR }} ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}_${{ env.APP_VERSION }}~${{ matrix.distro.name }}_${{ matrix.arch.name }}.deb + dpkg-deb -Zgzip -b ${{ env.PACKAGE_DIR }} ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}_${{ env.APP_VERSION }}~${{ matrix.distro.name }}_${{ matrix.arch.name }}.deb - name: Upload .deb file uses: actions/upload-artifact@v3 diff --git a/scripts/debian/install.sh b/scripts/debian/install.sh index b4098fc5..aea16467 100755 --- a/scripts/debian/install.sh +++ b/scripts/debian/install.sh @@ -7,7 +7,7 @@ setup() { set -v export DEBIAN_FRONTEND=noninteractive apt-get update - apt-get install --assume-yes --no-install-recommends apt-transport-https ca-certificates curl gnupg lsb-release software-properties-common apt-utils zstd dpkg + apt-get install --assume-yes --no-install-recommends apt-transport-https ca-certificates curl gnupg lsb-release software-properties-common set +v set -v From e9b746665dbaea9100ab5494451887764baae8a9 Mon Sep 17 00:00:00 2001 From: storybehind Date: Thu, 1 Aug 2024 18:53:12 +0530 Subject: [PATCH 126/228] test windows compilation --- .github/workflows/distribute-zboxcli.yml | 5 +- .github/workflows/release.yml | 71 ++++++++++++++++++++++++ scripts/windows/Dockerfile.build | 30 ++++++++++ 3 files changed, 102 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/release.yml create mode 100644 scripts/windows/Dockerfile.build diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index e4809746..0a2dca64 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -1,10 +1,7 @@ name: Build, Distribute and Test zbox on: - push: - branches: - - main - - packaging + workflow_dispatch: env: APP_NAME: zbox diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..25c83a1d --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,71 @@ +name: Release +on: + push: # remove push once tested + branches: + - packaging + workflow_dispatch: + inputs: + version: + description: 'Version of zboxcli to release' + required: true + default: '1.0.0' + dry_run: + description: 'Run without making changes' + required: false + default: 'false' + +env: + GITHUB_TOKEN: ${{ secrets.GOSDK }} + VERSION: ${{ github.event.inputs.version }} + APP_NAME: zbox + +jobs: + windows: + runs-on: windows-latest + env: + SRC_DIR: ${{ github.workspace }}/src + OUTPUT_DIR: ${{ github.workspace }}/output + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + path: ${{ env.SRC_DIR }} + + - name: Setup + run : | + mkdir -p ${{ env.OUTPUT_DIR }} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Build Docker image + run: | + docker buildx create --use + docker buildx build \ + --build-arg VERSION=${{ env.VERSION }} \ + --tag ${{ env.APP_NAME }}:${{ env.VERSION }} \ + --load \ + --output type=docker,dest=${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}-${{ env.VERSION }}.tar \ + -f ${{ env.SRC_DIR }}/scripts/windows/Dockerfile.build ${{ env.SRC_DIR }} + + - name: Load Docker image + run: | + docker load -i ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}-${{ env.VERSION }}.tar + + - name: Extract binary from container + run: | + CONTAINER_ID=$(docker create ${{ env.APP_NAME }}-${{ env.VERSION }}) + docker cp ${CONTAINER_ID}:c:/src/zbox.exe ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} + docker rm ${CONTAINER_ID} + + - name: Create Zip File + uses: montudor/action-zip@v1 + with: + args: zip -r ${{ env.OUTPUT_DIR }}/zbox-linux-amd64.zip ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} + + - name: Upload Zip + uses: actions/upload-artifact@v3 + with: + name: zbox-windows-amd64 + path: ${{ env.OUTPUT_DIR }}/zbox-linux-amd64.zip + \ No newline at end of file diff --git a/scripts/windows/Dockerfile.build b/scripts/windows/Dockerfile.build new file mode 100644 index 00000000..7c20a119 --- /dev/null +++ b/scripts/windows/Dockerfile.build @@ -0,0 +1,30 @@ +# Use the Windows Server 2022 base image for amd64 +FROM mcr.microsoft.com/windows/servercore:ltsc2022 + +# Set environment variables for Go +ENV GOLANG_VERSION 1.21 +ARG VERSION + +# Install Chocolatey +RUN powershell -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command \ + Set-ExecutionPolicy Bypass -Scope Process -Force; \ + [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; \ + Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) + +# Install Go +RUN choco install golang --version %GOLANG_VERSION% -y && \ + refreshenv + +# Create directories +RUN mkdir c:\\src + +# Copy the source code into the container +COPY . c:\\src + +# Set the working directory +WORKDIR c:\\src + +# Build the application +RUN go env +RUN CGO_ENABLED=1 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${VERSION} -linkmode 'external' -extldflags '-static'" -o zbox.exe . + From 341aa87a5f01911085ba8866163270437af93a6b Mon Sep 17 00:00:00 2001 From: storybehind Date: Thu, 1 Aug 2024 18:58:25 +0530 Subject: [PATCH 127/228] remove setup qemu step on windows-runner --- .github/workflows/release.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 25c83a1d..b49cc2f6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,9 +35,6 @@ jobs: run : | mkdir -p ${{ env.OUTPUT_DIR }} - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - name: Build Docker image run: | docker buildx create --use From a8ae7bdeb3112c42b9363f307d8d415789f6e43c Mon Sep 17 00:00:00 2001 From: storybehind Date: Thu, 1 Aug 2024 19:14:10 +0530 Subject: [PATCH 128/228] update release workflow --- .github/workflows/release.yml | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b49cc2f6..61b69e99 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,21 +16,24 @@ on: env: GITHUB_TOKEN: ${{ secrets.GOSDK }} - VERSION: ${{ github.event.inputs.version }} + VERSION: 1.16.0 APP_NAME: zbox jobs: windows: runs-on: windows-latest env: - SRC_DIR: ${{ github.workspace }}/src - OUTPUT_DIR: ${{ github.workspace }}/output + SRC_DIR: ${{ github.workspace }}\src + OUTPUT_DIR: ${{ github.workspace }}\output steps: - name: Checkout code uses: actions/checkout@v2 with: path: ${{ env.SRC_DIR }} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Setup run : | mkdir -p ${{ env.OUTPUT_DIR }} @@ -42,27 +45,27 @@ jobs: --build-arg VERSION=${{ env.VERSION }} \ --tag ${{ env.APP_NAME }}:${{ env.VERSION }} \ --load \ - --output type=docker,dest=${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}-${{ env.VERSION }}.tar \ - -f ${{ env.SRC_DIR }}/scripts/windows/Dockerfile.build ${{ env.SRC_DIR }} + --output type=docker,dest=${{ env.OUTPUT_DIR }}\${{ env.APP_NAME }}-${{ env.VERSION }}.tar \ + -f ${{ env.SRC_DIR }}\scripts\windows\Dockerfile.build ${{ env.SRC_DIR }} - name: Load Docker image run: | - docker load -i ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}-${{ env.VERSION }}.tar + docker load -i ${{ env.OUTPUT_DIR }}\${{ env.APP_NAME }}-${{ env.VERSION }}.tar - name: Extract binary from container run: | CONTAINER_ID=$(docker create ${{ env.APP_NAME }}-${{ env.VERSION }}) - docker cp ${CONTAINER_ID}:c:/src/zbox.exe ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} + docker cp ${CONTAINER_ID}:c:\src\zbox.exe ${{ env.OUTPUT_DIR }}\${{ env.APP_NAME }} docker rm ${CONTAINER_ID} - name: Create Zip File uses: montudor/action-zip@v1 with: - args: zip -r ${{ env.OUTPUT_DIR }}/zbox-linux-amd64.zip ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} + args: zip -r ${{ env.OUTPUT_DIR }}\zbox-linux-amd64.zip ${{ env.OUTPUT_DIR }}\${{ env.APP_NAME }} - name: Upload Zip uses: actions/upload-artifact@v3 with: name: zbox-windows-amd64 - path: ${{ env.OUTPUT_DIR }}/zbox-linux-amd64.zip + path: ${{ env.OUTPUT_DIR }}\zbox-linux-amd64.zip \ No newline at end of file From ee62d7248cc823dd7248f2f6e2222aeda74d45a5 Mon Sep 17 00:00:00 2001 From: storybehind Date: Thu, 1 Aug 2024 19:27:44 +0530 Subject: [PATCH 129/228] update docker buildx version --- .github/workflows/release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 61b69e99..8dabae39 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,13 +31,13 @@ jobs: with: path: ${{ env.SRC_DIR }} - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - name: Setup run : | mkdir -p ${{ env.OUTPUT_DIR }} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Build Docker image run: | docker buildx create --use From ba3f06576ac0821c2b8a7666d9dadc125e79ff01 Mon Sep 17 00:00:00 2001 From: storybehind Date: Sat, 3 Aug 2024 09:28:34 +0530 Subject: [PATCH 130/228] update release to build on darwin & linux --- .github/workflows/release.yml | 147 +++++++++++++++++++++++++++++----- 1 file changed, 125 insertions(+), 22 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8dabae39..431e2d6c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,15 +16,16 @@ on: env: GITHUB_TOKEN: ${{ secrets.GOSDK }} - VERSION: 1.16.0 + VERSION: 1.16.0 # take as input from workflow APP_NAME: zbox + GO_VERSION: 1.21 jobs: - windows: - runs-on: windows-latest + darwin: + runs-on: ubuntu-latest env: - SRC_DIR: ${{ github.workspace }}\src - OUTPUT_DIR: ${{ github.workspace }}\output + SRC_DIR: ${{ github.workspace }}/src + OUTPUT_DIR: ${{ github.workspace }}/output steps: - name: Checkout code uses: actions/checkout@v2 @@ -34,38 +35,140 @@ jobs: - name: Setup run : | mkdir -p ${{ env.OUTPUT_DIR }} + sudo apt-get update + sudo apt-get install -y clang cmake git patch python libssl-dev lzma-dev libxml2-dev xz-utils bzip2 cpio libbz2-dev zlib1g-dev - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: ${{ env.GO_VERSION }} + + - name: Set up osxcross + run: | + cd ${{ github.workspace }} + git clone https://github.com/tpoechtrager/osxcross.git + cd osxcross/tarballs + wget https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX11.3.sdk.tar.xz + cd .. + export CC=clang + export CXX=clang++ + UNATTENDED=yes OSX_VERSION_MIN=10.11 ./build.sh + + - name: Cross-compile for Darwin/amd64 + env: + OSXCROSS_ROOT: ${{ github.workspace }}/osxcross + PATH: ${{ env.OSXCROSS_ROOT }}/target/bin:${{ env.PATH }} + VERSION: ${{ env.VERSION }} + run: | + cd ${{ env.SRC_DIR }} + echo "Building for Darwin/amd64..." + CGO_ENABLED=1 CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=amd64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${VERSION} -linkmode 'external' -extldflags '-static'" -o ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} . + echo "Build completed." + + - name: Create Zip File for Darwin/amd64 + uses: montudor/action-zip@v1 + with: + args: zip -r ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}-darwin-amd64.zip ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} - - name: Build Docker image + - name: Upload Zip for Darwin/amd64 + uses: actions/upload-artifact@v3 + with: + name: ${{ env.APP_NAME }}-darwin-amd64 + path: ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}-darwin-amd64.zip + + - name: Cross-compile for Darwin/arm64 + env: + OSXCROSS_ROOT: ${{ github.workspace }}/osxcross + PATH: ${{ env.OSXCROSS_ROOT }}/target/bin:${{ env.PATH }} + VERSION: ${{ env.VERSION }} + run: | + cd ${{ env.SRC_DIR }} + echo "Building for Darwin/arm64..." + CGO_ENABLED=1 CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=arm64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${VERSION} -linkmode 'external' -extldflags '-static'" -o ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} . + echo "Build completed." + + - name: Create Zip File for Darwin/arm64 + uses: montudor/action-zip@v1 + with: + args: zip -r ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}-darwin-arm64.zip ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} + + - name: Upload Zip + uses: actions/upload-artifact@v3 + with: + name: ${{ env.APP_NAME }}-darwin-arm64 + path: ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}-darwin-arm64.zip + + linux: + runs-on: ubuntu-latest + env: + SRC_DIR: ${{ github.workspace }}/src + OUTPUT_DIR: ${{ github.workspace }}/output + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + path: ${{ env.SRC_DIR }} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + with: + platforms: linux/amd64,linux/arm64 + + - name: Build Docker image for linux/amd64 run: | docker buildx create --use docker buildx build \ + --platform linux/amd64 \ --build-arg VERSION=${{ env.VERSION }} \ - --tag ${{ env.APP_NAME }}:${{ env.VERSION }} \ + --tag ${{ env.APP_NAME }}-amd64 \ --load \ - --output type=docker,dest=${{ env.OUTPUT_DIR }}\${{ env.APP_NAME }}-${{ env.VERSION }}.tar \ - -f ${{ env.SRC_DIR }}\scripts\windows\Dockerfile.build ${{ env.SRC_DIR }} + --output type=docker,dest=${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}-amd64.tar \ + -f ${{ env.SRC_DIR }}/scripts/debian/Dockerfile.build ${{ env.SRC_DIR }} - - name: Load Docker image + - name: Load image ${{ env.APP_NAME }}-amd64 & Extract binary from container run: | - docker load -i ${{ env.OUTPUT_DIR }}\${{ env.APP_NAME }}-${{ env.VERSION }}.tar + docker load -i ${{ env.APP_NAME }}-amd64.tar + CONTAINER_ID=$(docker create ${{ env.APP_NAME }}-amd64.tar) + docker cp ${CONTAINER_ID}:/${{ env.APP_NAME }} ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} + docker rm ${CONTAINER_ID} + + - name: Create Zip File for linux/amd64 + uses: montudor/action-zip@v1 + with: + args: zip -r ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}-linux-amd64.zip ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} - - name: Extract binary from container + - name: Upload Zip for Darwin/amd64 + uses: actions/upload-artifact@v3 + with: + name: ${{ env.APP_NAME }}-linux-amd64 + path: ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}-linux-amd64.zip + + - name: Build Docker image for linux/arm64 run: | - CONTAINER_ID=$(docker create ${{ env.APP_NAME }}-${{ env.VERSION }}) - docker cp ${CONTAINER_ID}:c:\src\zbox.exe ${{ env.OUTPUT_DIR }}\${{ env.APP_NAME }} + docker buildx create --use + docker buildx build \ + --platform linux/arm64 \ + --build-arg VERSION=${{ env.VERSION }} \ + --tag ${{ env.APP_NAME }}-arm64 \ + --load \ + --output type=docker,dest=${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}-arm64.tar \ + -f ${{ env.SRC_DIR }}/scripts/debian/Dockerfile.build ${{ env.SRC_DIR }} + + - name: Load image ${{ env.APP_NAME }}-arm64 & Extract binary from container + run: | + docker load -i ${{ env.APP_NAME }}-arm64.tar + CONTAINER_ID=$(docker create ${{ env.APP_NAME }}-arm64.tar) + docker cp ${CONTAINER_ID}:/${{ env.APP_NAME }} ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} docker rm ${CONTAINER_ID} - - name: Create Zip File + - name: Create Zip File for linux/arm64 uses: montudor/action-zip@v1 with: - args: zip -r ${{ env.OUTPUT_DIR }}\zbox-linux-amd64.zip ${{ env.OUTPUT_DIR }}\${{ env.APP_NAME }} + args: zip -r ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}-linux-arm64.zip ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} - - name: Upload Zip + - name: Upload Zip for Darwin/arm64 uses: actions/upload-artifact@v3 with: - name: zbox-windows-amd64 - path: ${{ env.OUTPUT_DIR }}\zbox-linux-amd64.zip - \ No newline at end of file + name: ${{ env.APP_NAME }}-linux-arm64 + path: ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}-linux-arm64.zip + \ No newline at end of file From 458465b4e78571db83cd8502af792bbe7747b18a Mon Sep 17 00:00:00 2001 From: storybehind Date: Sat, 3 Aug 2024 09:35:39 +0530 Subject: [PATCH 131/228] fix release workflow --- .github/workflows/release.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 431e2d6c..c5bf779a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -36,7 +36,7 @@ jobs: run : | mkdir -p ${{ env.OUTPUT_DIR }} sudo apt-get update - sudo apt-get install -y clang cmake git patch python libssl-dev lzma-dev libxml2-dev xz-utils bzip2 cpio libbz2-dev zlib1g-dev + sudo apt-get install -y clang cmake git patch python-is-python3 libssl-dev lzma-dev libxml2-dev xz-utils bzip2 cpio libbz2-dev zlib1g-dev - name: Set up Go uses: actions/setup-go@v4 @@ -114,6 +114,10 @@ jobs: with: platforms: linux/amd64,linux/arm64 + - name: Setup + run : | + mkdir -p ${{ env.OUTPUT_DIR }} + - name: Build Docker image for linux/amd64 run: | docker buildx create --use From 5d8d5b6cd250c792e5899b794728efbeb6cf64d9 Mon Sep 17 00:00:00 2001 From: storybehind Date: Sat, 3 Aug 2024 19:52:09 +0530 Subject: [PATCH 132/228] fix release workflow --- .github/workflows/release.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c5bf779a..5b9d116b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -62,7 +62,7 @@ jobs: run: | cd ${{ env.SRC_DIR }} echo "Building for Darwin/amd64..." - CGO_ENABLED=1 CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=amd64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${VERSION} -linkmode 'external' -extldflags '-static'" -o ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} . + GO111MODULE=on CGO_ENABLED=1 CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=amd64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${{ env.VERSION }}" -o ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} . echo "Build completed." - name: Create Zip File for Darwin/amd64 @@ -131,8 +131,8 @@ jobs: - name: Load image ${{ env.APP_NAME }}-amd64 & Extract binary from container run: | - docker load -i ${{ env.APP_NAME }}-amd64.tar - CONTAINER_ID=$(docker create ${{ env.APP_NAME }}-amd64.tar) + docker load -i ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}-amd64.tar + CONTAINER_ID=$(docker create ${{ env.APP_NAME }}-amd64) docker cp ${CONTAINER_ID}:/${{ env.APP_NAME }} ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} docker rm ${CONTAINER_ID} @@ -160,8 +160,8 @@ jobs: - name: Load image ${{ env.APP_NAME }}-arm64 & Extract binary from container run: | - docker load -i ${{ env.APP_NAME }}-arm64.tar - CONTAINER_ID=$(docker create ${{ env.APP_NAME }}-arm64.tar) + docker load -i ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}-arm64.tar + CONTAINER_ID=$(docker create ${{ env.APP_NAME }}-arm64) docker cp ${CONTAINER_ID}:/${{ env.APP_NAME }} ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} docker rm ${CONTAINER_ID} From 241f2bbb164a9a2a4707f1b1dc91edeef067cff2 Mon Sep 17 00:00:00 2001 From: storybehind Date: Sat, 3 Aug 2024 20:34:48 +0530 Subject: [PATCH 133/228] update release workflow --- .github/workflows/release.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5b9d116b..97044e6e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -62,7 +62,9 @@ jobs: run: | cd ${{ env.SRC_DIR }} echo "Building for Darwin/amd64..." - GO111MODULE=on CGO_ENABLED=1 CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=amd64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${{ env.VERSION }}" -o ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} . + export GO111MODULE=on + export CGO_ENABLED=1 + CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=amd64 go build -o ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} ${{ env.SRC_DIR }} echo "Build completed." - name: Create Zip File for Darwin/amd64 @@ -129,11 +131,14 @@ jobs: --output type=docker,dest=${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}-amd64.tar \ -f ${{ env.SRC_DIR }}/scripts/debian/Dockerfile.build ${{ env.SRC_DIR }} - - name: Load image ${{ env.APP_NAME }}-amd64 & Extract binary from container + - name: Load image ${{ env.APP_NAME }}-amd64 run: | docker load -i ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}-amd64.tar + + - name: Extract binary ${{ env.APP_NAME }}-amd64 from container + run: | CONTAINER_ID=$(docker create ${{ env.APP_NAME }}-amd64) - docker cp ${CONTAINER_ID}:/${{ env.APP_NAME }} ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} + docker cp ${CONTAINER_ID}:/zbox ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} docker rm ${CONTAINER_ID} - name: Create Zip File for linux/amd64 From cf84966c229ecd8f1050d2b69dc88dbb0068e37c Mon Sep 17 00:00:00 2001 From: storybehind Date: Sat, 3 Aug 2024 21:08:27 +0530 Subject: [PATCH 134/228] update release workflow --- .github/workflows/release.yml | 52 +++++++++++++++++------------------ 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 97044e6e..21ff1a1a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -57,21 +57,20 @@ jobs: - name: Cross-compile for Darwin/amd64 env: OSXCROSS_ROOT: ${{ github.workspace }}/osxcross - PATH: ${{ env.OSXCROSS_ROOT }}/target/bin:${{ env.PATH }} + PATH: ${{ github.workspace }}/osxcross/target/bin:${{ env.PATH }} VERSION: ${{ env.VERSION }} run: | - cd ${{ env.SRC_DIR }} echo "Building for Darwin/amd64..." export GO111MODULE=on export CGO_ENABLED=1 CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=amd64 go build -o ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} ${{ env.SRC_DIR }} echo "Build completed." - - name: Create Zip File for Darwin/amd64 - uses: montudor/action-zip@v1 - with: - args: zip -r ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}-darwin-amd64.zip ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} - + - name: Create Zip File for linux/amd64 + run: | + cd ${{ env.OUTPUT_DIR }} + zip -qq -r ${{ env.APP_NAME }}-darwin-amd64.zip ${{ env.APP_NAME }} + - name: Upload Zip for Darwin/amd64 uses: actions/upload-artifact@v3 with: @@ -81,19 +80,18 @@ jobs: - name: Cross-compile for Darwin/arm64 env: OSXCROSS_ROOT: ${{ github.workspace }}/osxcross - PATH: ${{ env.OSXCROSS_ROOT }}/target/bin:${{ env.PATH }} + PATH: ${{ github.workspace }}/osxcross/target/bin:${{ env.PATH }} VERSION: ${{ env.VERSION }} run: | - cd ${{ env.SRC_DIR }} echo "Building for Darwin/arm64..." - CGO_ENABLED=1 CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=arm64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${VERSION} -linkmode 'external' -extldflags '-static'" -o ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} . + CGO_ENABLED=1 CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=arm64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${VERSION} -linkmode 'external' -extldflags '-static'" -o ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} ${{ env.SRC_DIR }} echo "Build completed." - - name: Create Zip File for Darwin/arm64 - uses: montudor/action-zip@v1 - with: - args: zip -r ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}-darwin-arm64.zip ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} - + - name: Create Zip File for linux/arm64 + run: | + cd ${{ env.OUTPUT_DIR }} + zip -qq -r ${{ env.APP_NAME }}-darwin-arm64.zip ${{ env.APP_NAME }} + - name: Upload Zip uses: actions/upload-artifact@v3 with: @@ -116,6 +114,9 @@ jobs: with: platforms: linux/amd64,linux/arm64 + - name: Install zip + uses: montudor/action-zip@v1 + - name: Setup run : | mkdir -p ${{ env.OUTPUT_DIR }} @@ -131,20 +132,17 @@ jobs: --output type=docker,dest=${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}-amd64.tar \ -f ${{ env.SRC_DIR }}/scripts/debian/Dockerfile.build ${{ env.SRC_DIR }} - - name: Load image ${{ env.APP_NAME }}-amd64 + - name: Load image ${{ env.APP_NAME }}-amd64 & Extract binary ${{ env.APP_NAME }} from container run: | docker load -i ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}-amd64.tar - - - name: Extract binary ${{ env.APP_NAME }}-amd64 from container - run: | CONTAINER_ID=$(docker create ${{ env.APP_NAME }}-amd64) docker cp ${CONTAINER_ID}:/zbox ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} docker rm ${CONTAINER_ID} - name: Create Zip File for linux/amd64 - uses: montudor/action-zip@v1 - with: - args: zip -r ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}-linux-amd64.zip ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} + run: | + cd ${{ env.OUTPUT_DIR }} + zip -qq -r ${{ env.APP_NAME }}-linux-amd64.zip ${{ env.APP_NAME }} - name: Upload Zip for Darwin/amd64 uses: actions/upload-artifact@v3 @@ -167,14 +165,14 @@ jobs: run: | docker load -i ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}-arm64.tar CONTAINER_ID=$(docker create ${{ env.APP_NAME }}-arm64) - docker cp ${CONTAINER_ID}:/${{ env.APP_NAME }} ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} + docker cp ${CONTAINER_ID}:/zbox ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} docker rm ${CONTAINER_ID} - name: Create Zip File for linux/arm64 - uses: montudor/action-zip@v1 - with: - args: zip -r ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}-linux-arm64.zip ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} - + run: | + cd ${{ env.OUTPUT_DIR }} + zip -qq -r ${{ env.APP_NAME }}-linux-arm64.zip ${{ env.APP_NAME }} + - name: Upload Zip for Darwin/arm64 uses: actions/upload-artifact@v3 with: From 86eae3fa7cb47241e964f819a3a035af028a2448 Mon Sep 17 00:00:00 2001 From: storybehind Date: Sat, 3 Aug 2024 21:24:19 +0530 Subject: [PATCH 135/228] update release workflow --- .github/workflows/release.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 21ff1a1a..f9cc9498 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -60,10 +60,11 @@ jobs: PATH: ${{ github.workspace }}/osxcross/target/bin:${{ env.PATH }} VERSION: ${{ env.VERSION }} run: | - echo "Building for Darwin/amd64..." + cd ${{ env.SRC_DIR }} export GO111MODULE=on export CGO_ENABLED=1 - CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=amd64 go build -o ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} ${{ env.SRC_DIR }} + echo "Building for Darwin/amd64..." + CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=amd64 go build -o ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} . echo "Build completed." - name: Create Zip File for linux/amd64 @@ -83,8 +84,11 @@ jobs: PATH: ${{ github.workspace }}/osxcross/target/bin:${{ env.PATH }} VERSION: ${{ env.VERSION }} run: | + cd ${{ env.SRC_DIR }} + export GO111MODULE=on + export CGO_ENABLED=1 echo "Building for Darwin/arm64..." - CGO_ENABLED=1 CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=arm64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${VERSION} -linkmode 'external' -extldflags '-static'" -o ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} ${{ env.SRC_DIR }} + CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=arm64 go build -o ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} . echo "Build completed." - name: Create Zip File for linux/arm64 From f921090607728ed3525da27a540b4e5116a2bcb8 Mon Sep 17 00:00:00 2001 From: storybehind Date: Sat, 3 Aug 2024 22:13:07 +0530 Subject: [PATCH 136/228] update release workflow --- .github/workflows/release.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f9cc9498..0398dc98 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -55,12 +55,10 @@ jobs: UNATTENDED=yes OSX_VERSION_MIN=10.11 ./build.sh - name: Cross-compile for Darwin/amd64 - env: - OSXCROSS_ROOT: ${{ github.workspace }}/osxcross - PATH: ${{ github.workspace }}/osxcross/target/bin:${{ env.PATH }} - VERSION: ${{ env.VERSION }} run: | cd ${{ env.SRC_DIR }} + export OSXCROSS_ROOT=${{ github.workspace }}/osxcross + export PATH=$OSXCROSS_ROOT/target/bin:$PATH export GO111MODULE=on export CGO_ENABLED=1 echo "Building for Darwin/amd64..." @@ -79,12 +77,10 @@ jobs: path: ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}-darwin-amd64.zip - name: Cross-compile for Darwin/arm64 - env: - OSXCROSS_ROOT: ${{ github.workspace }}/osxcross - PATH: ${{ github.workspace }}/osxcross/target/bin:${{ env.PATH }} - VERSION: ${{ env.VERSION }} run: | cd ${{ env.SRC_DIR }} + export OSXCROSS_ROOT=${{ github.workspace }}/osxcross + export PATH=$OSXCROSS_ROOT/target/bin:$PATH export GO111MODULE=on export CGO_ENABLED=1 echo "Building for Darwin/arm64..." From 55ccd2a5b5cd98a1cf8d8e97abd2f6d33f9728a3 Mon Sep 17 00:00:00 2001 From: storybehind Date: Sat, 3 Aug 2024 22:35:33 +0530 Subject: [PATCH 137/228] update release workflow --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0398dc98..01715adf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -48,7 +48,7 @@ jobs: cd ${{ github.workspace }} git clone https://github.com/tpoechtrager/osxcross.git cd osxcross/tarballs - wget https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX11.3.sdk.tar.xz + wget https://github.com/phracker/MacOSX-SDKs/releases/download/10.13/MacOSX10.13.sdk.tar.xz cd .. export CC=clang export CXX=clang++ From 06b687f4ea24083d15f0e4cd060939274514170b Mon Sep 17 00:00:00 2001 From: devyetii Date: Sat, 3 Aug 2024 19:36:30 +0200 Subject: [PATCH 138/228] fix block worker --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0e76cd90..9164dd23 100644 --- a/README.md +++ b/README.md @@ -98,7 +98,7 @@ The following script sets `https://demo.zus.network` as your network. ```sh cat > ~/.zcn/config.yaml << EOF -block_worker: https://demo.zus.network/dns +block_worker: https://mainnet.zus.network/dns signature_scheme: bls0chain min_submit: 50 # in percentage min_confirmation: 50 # in percentage From 8db86538e174e720142adb04c18b375663a370d3 Mon Sep 17 00:00:00 2001 From: storybehind Date: Sun, 4 Aug 2024 08:07:02 +0530 Subject: [PATCH 139/228] include -lstdc++ --- .github/workflows/release.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 01715adf..061d7fcd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -48,8 +48,11 @@ jobs: cd ${{ github.workspace }} git clone https://github.com/tpoechtrager/osxcross.git cd osxcross/tarballs - wget https://github.com/phracker/MacOSX-SDKs/releases/download/10.13/MacOSX10.13.sdk.tar.xz + wget https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX11.3.sdk.tar.xz + wget https://github.com/llvm/llvm-project/releases/download/llvmorg-11.1.0/libcxx-11.1.0.src.tar.xz + tar -xf libcxx-11.1.0.src.tar.xz -C ${{ github.workspace }}/osxcross/target/ cd .. + ./tools/gen_sdk_package.sh --darwin-version=11.3 export CC=clang export CXX=clang++ UNATTENDED=yes OSX_VERSION_MIN=10.11 ./build.sh @@ -59,6 +62,9 @@ jobs: cd ${{ env.SRC_DIR }} export OSXCROSS_ROOT=${{ github.workspace }}/osxcross export PATH=$OSXCROSS_ROOT/target/bin:$PATH + export SDKROOT=$OSXCROSS_ROOT/target/SDK/MacOSX11.3.sdk + export CFLAGS="-isysroot $SDKROOT" + export CXXFLAGS="-isysroot $SDKROOT -stdlib=libc++" export GO111MODULE=on export CGO_ENABLED=1 echo "Building for Darwin/amd64..." From b615431ec8620c7e2d2a0b3e4ec127d895354703 Mon Sep 17 00:00:00 2001 From: storybehind Date: Sun, 4 Aug 2024 08:38:35 +0530 Subject: [PATCH 140/228] install libc++ --- .github/workflows/release.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 061d7fcd..f1d1b701 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -36,7 +36,7 @@ jobs: run : | mkdir -p ${{ env.OUTPUT_DIR }} sudo apt-get update - sudo apt-get install -y clang cmake git patch python-is-python3 libssl-dev lzma-dev libxml2-dev xz-utils bzip2 cpio libbz2-dev zlib1g-dev + sudo apt-get install -y clang cmake git patch python-is-python3 libssl-dev lzma-dev libxml2-dev xz-utils bzip2 cpio libbz2-dev zlib1g-dev libc++-dev libc++abi-dev - name: Set up Go uses: actions/setup-go@v4 @@ -49,14 +49,11 @@ jobs: git clone https://github.com/tpoechtrager/osxcross.git cd osxcross/tarballs wget https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX11.3.sdk.tar.xz - wget https://github.com/llvm/llvm-project/releases/download/llvmorg-11.1.0/libcxx-11.1.0.src.tar.xz - tar -xf libcxx-11.1.0.src.tar.xz -C ${{ github.workspace }}/osxcross/target/ cd .. - ./tools/gen_sdk_package.sh --darwin-version=11.3 export CC=clang export CXX=clang++ UNATTENDED=yes OSX_VERSION_MIN=10.11 ./build.sh - + - name: Cross-compile for Darwin/amd64 run: | cd ${{ env.SRC_DIR }} From 638050e8e1a6ac1eb1bf44e6d5e1fcdd7a5c45d8 Mon Sep 17 00:00:00 2001 From: storybehind Date: Sun, 4 Aug 2024 10:54:30 +0530 Subject: [PATCH 141/228] update release workflow --- .github/workflows/release.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f1d1b701..fa14c0fc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -60,12 +60,13 @@ jobs: export OSXCROSS_ROOT=${{ github.workspace }}/osxcross export PATH=$OSXCROSS_ROOT/target/bin:$PATH export SDKROOT=$OSXCROSS_ROOT/target/SDK/MacOSX11.3.sdk - export CFLAGS="-isysroot $SDKROOT" + export CFLAGS="-isysroot $SDKROOT -stdlib=libc++" export CXXFLAGS="-isysroot $SDKROOT -stdlib=libc++" + export LDFLAGS="-isysroot $SDKROOT -stdlib=libc++" export GO111MODULE=on export CGO_ENABLED=1 echo "Building for Darwin/amd64..." - CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=amd64 go build -o ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} . + CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=amd64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${{env.VERSION }} -linkmode 'external' -extldflags '-static -stdlib=libc++'" -o ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} . echo "Build completed." - name: Create Zip File for linux/amd64 From ee025518183a4ef06e53ceeb67751e3459f2431e Mon Sep 17 00:00:00 2001 From: storybehind Date: Sun, 4 Aug 2024 11:41:24 +0530 Subject: [PATCH 142/228] update release workflow --- .github/workflows/release.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fa14c0fc..1b2d3256 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -36,7 +36,7 @@ jobs: run : | mkdir -p ${{ env.OUTPUT_DIR }} sudo apt-get update - sudo apt-get install -y clang cmake git patch python-is-python3 libssl-dev lzma-dev libxml2-dev xz-utils bzip2 cpio libbz2-dev zlib1g-dev libc++-dev libc++abi-dev + sudo apt-get install -y clang cmake git patch python-is-python3 libssl-dev lzma-dev libxml2-dev xz-utils bzip2 cpio libbz2-dev zlib1g-dev libc++-dev libc++abi-dev build-essential - name: Set up Go uses: actions/setup-go@v4 @@ -66,10 +66,10 @@ jobs: export GO111MODULE=on export CGO_ENABLED=1 echo "Building for Darwin/amd64..." - CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=amd64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${{env.VERSION }} -linkmode 'external' -extldflags '-static -stdlib=libc++'" -o ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} . + CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=amd64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${{env.VERSION }}" -o ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} . echo "Build completed." - - name: Create Zip File for linux/amd64 + - name: Create Zip File for Darwin/amd64 run: | cd ${{ env.OUTPUT_DIR }} zip -qq -r ${{ env.APP_NAME }}-darwin-amd64.zip ${{ env.APP_NAME }} @@ -88,15 +88,15 @@ jobs: export GO111MODULE=on export CGO_ENABLED=1 echo "Building for Darwin/arm64..." - CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=arm64 go build -o ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} . + CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=arm64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${{env.VERSION }}" -o ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} . echo "Build completed." - - name: Create Zip File for linux/arm64 + - name: Create Zip File for Darwin/arm64 run: | cd ${{ env.OUTPUT_DIR }} zip -qq -r ${{ env.APP_NAME }}-darwin-arm64.zip ${{ env.APP_NAME }} - - name: Upload Zip + - name: Upload Zip for Darwin/arm64 uses: actions/upload-artifact@v3 with: name: ${{ env.APP_NAME }}-darwin-arm64 From 7110311871d7b3bcd87a041d9de9782e867bcc0d Mon Sep 17 00:00:00 2001 From: storybehind Date: Sun, 4 Aug 2024 14:54:53 +0530 Subject: [PATCH 143/228] update release workflow --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1b2d3256..e56bf01b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -66,7 +66,7 @@ jobs: export GO111MODULE=on export CGO_ENABLED=1 echo "Building for Darwin/amd64..." - CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=amd64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${{env.VERSION }}" -o ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} . + CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=amd64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${{env.VERSION }} -extldflags '-stdlib=libc++'" -o ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} . echo "Build completed." - name: Create Zip File for Darwin/amd64 @@ -88,7 +88,7 @@ jobs: export GO111MODULE=on export CGO_ENABLED=1 echo "Building for Darwin/arm64..." - CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=arm64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${{env.VERSION }}" -o ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} . + CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=arm64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${{env.VERSION }} -extldflags '-stdlib=libc++'" -o ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} . echo "Build completed." - name: Create Zip File for Darwin/arm64 From 709110231b7a6ce288ed462f490e0bb12f418434 Mon Sep 17 00:00:00 2001 From: storybehind Date: Sun, 4 Aug 2024 18:17:48 +0530 Subject: [PATCH 144/228] update release workflow --- .github/workflows/release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e56bf01b..d3ae0ddc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -36,7 +36,7 @@ jobs: run : | mkdir -p ${{ env.OUTPUT_DIR }} sudo apt-get update - sudo apt-get install -y clang cmake git patch python-is-python3 libssl-dev lzma-dev libxml2-dev xz-utils bzip2 cpio libbz2-dev zlib1g-dev libc++-dev libc++abi-dev build-essential + sudo apt-get install -y clang cmake git patch python-is-python3 libssl-dev lzma-dev libxml2-dev xz-utils bzip2 cpio libbz2-dev zlib1g-dev libc++-dev libc++abi-dev build-essential libstdc++-7-dev - name: Set up Go uses: actions/setup-go@v4 @@ -66,6 +66,7 @@ jobs: export GO111MODULE=on export CGO_ENABLED=1 echo "Building for Darwin/amd64..." + find /usr -name "libstdc++*" CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=amd64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${{env.VERSION }} -extldflags '-stdlib=libc++'" -o ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} . echo "Build completed." From 1562ecc4e80b9f148f3eb2a45c6345fe50cc8a54 Mon Sep 17 00:00:00 2001 From: storybehind Date: Sun, 4 Aug 2024 19:24:13 +0530 Subject: [PATCH 145/228] update release workflow --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d3ae0ddc..e4746507 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -36,7 +36,7 @@ jobs: run : | mkdir -p ${{ env.OUTPUT_DIR }} sudo apt-get update - sudo apt-get install -y clang cmake git patch python-is-python3 libssl-dev lzma-dev libxml2-dev xz-utils bzip2 cpio libbz2-dev zlib1g-dev libc++-dev libc++abi-dev build-essential libstdc++-7-dev + sudo apt-get install -y clang cmake git patch python-is-python3 libssl-dev lzma-dev libxml2-dev xz-utils bzip2 cpio libbz2-dev zlib1g-dev libc++-dev libc++abi-dev gcc g++ build-essential libstdc++-12-dev - name: Set up Go uses: actions/setup-go@v4 From ca5f3ef8c7fe7728090b85c9f0a719bca625c4ec Mon Sep 17 00:00:00 2001 From: storybehind Date: Sun, 4 Aug 2024 20:19:56 +0530 Subject: [PATCH 146/228] update release workflow --- .github/workflows/release.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e4746507..b139d53e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -36,7 +36,7 @@ jobs: run : | mkdir -p ${{ env.OUTPUT_DIR }} sudo apt-get update - sudo apt-get install -y clang cmake git patch python-is-python3 libssl-dev lzma-dev libxml2-dev xz-utils bzip2 cpio libbz2-dev zlib1g-dev libc++-dev libc++abi-dev gcc g++ build-essential libstdc++-12-dev + sudo apt-get install -y clang cmake git patch python-is-python3 libssl-dev lzma-dev libxml2-dev xz-utils bzip2 cpio libbz2-dev zlib1g-dev - name: Set up Go uses: actions/setup-go@v4 @@ -52,22 +52,22 @@ jobs: cd .. export CC=clang export CXX=clang++ - UNATTENDED=yes OSX_VERSION_MIN=10.11 ./build.sh + UNATTENDED=yes OSX_VERSION_MIN=10.10 ./build.sh - name: Cross-compile for Darwin/amd64 run: | cd ${{ env.SRC_DIR }} export OSXCROSS_ROOT=${{ github.workspace }}/osxcross export PATH=$OSXCROSS_ROOT/target/bin:$PATH - export SDKROOT=$OSXCROSS_ROOT/target/SDK/MacOSX11.3.sdk - export CFLAGS="-isysroot $SDKROOT -stdlib=libc++" - export CXXFLAGS="-isysroot $SDKROOT -stdlib=libc++" - export LDFLAGS="-isysroot $SDKROOT -stdlib=libc++" export GO111MODULE=on export CGO_ENABLED=1 + + find /usr -name "libstdc++*" # debug + o64-clang -v + o64-clang++ -v + echo "Building for Darwin/amd64..." - find /usr -name "libstdc++*" - CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=amd64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${{env.VERSION }} -extldflags '-stdlib=libc++'" -o ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} . + CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=amd64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${{env.VERSION }}" -o ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} . echo "Build completed." - name: Create Zip File for Darwin/amd64 @@ -89,7 +89,7 @@ jobs: export GO111MODULE=on export CGO_ENABLED=1 echo "Building for Darwin/arm64..." - CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=arm64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${{env.VERSION }} -extldflags '-stdlib=libc++'" -o ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} . + CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=arm64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${{env.VERSION }}" -o ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} . echo "Build completed." - name: Create Zip File for Darwin/arm64 From 3ff3f1e6fd27803c0c6eb6db72dc857ea06f6ace Mon Sep 17 00:00:00 2001 From: storybehind Date: Mon, 5 Aug 2024 15:00:19 +0530 Subject: [PATCH 147/228] remove darwin job & fix distribute zbox workflow --- .github/workflows/distribute-zboxcli.yml | 32 +++++---- .github/workflows/release.yml | 92 +----------------------- scripts/debian/Dockerfile.install_test | 2 +- scripts/debian/install.sh | 10 +-- 4 files changed, 29 insertions(+), 107 deletions(-) diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index 0a2dca64..ea6da58e 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -1,11 +1,19 @@ name: Build, Distribute and Test zbox on: + push: # REMOVE: push once tested + branches: + - packaging workflow_dispatch: + inputs: + version: + description: 'Version of zbox to release' + required: true + default: 'v1.0.0' env: APP_NAME: zbox - APP_VERSION: 1.16.0-1 + APP_VERSION: v1.16.0 # REMOVE: take as input from workflow GO_VERSION: 1.21.0 REMOTE_SERVER: 5.9.151.246 REMOTE_USER: root @@ -132,7 +140,7 @@ jobs: DISTRIBUTIONS: bionic focal jammy noble bookworm bullseye buster ARCHITECTURES: amd64 arm64 SRC_DIR: ${{ github.workspace }}/src - REPO_DIR: ${{ github.workspace }}/aptrepo + REPO_DIR: ${{ github.workspace }}/zbox DEB_DIR: ${{ github.workspace }}/deb-files steps: - name: Checkout code @@ -169,7 +177,7 @@ jobs: - name: Download APT repo run: | - scp -v -i ~/.ssh/id_rsa -r ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:/var/www/html/aptrepo/ ${{ github.workspace }} + scp -v -i ~/.ssh/id_rsa -r ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:/var/www/html/aptrepo/zbox/ ${{ github.workspace }} - name: Download all .deb files uses: actions/download-artifact@v3 @@ -188,18 +196,18 @@ jobs: run: | cd ${{ env.REPO_DIR }} for dist in ${{ env.DISTRIBUTIONS }}; do - for arch in ${{ env.ARCHITECTURES }}; do - mkdir -p dists/${dist}/main/binary-${arch} - apt-ftparchive packages pool/main > dists/${dist}/main/binary-${arch}/Packages - done - apt-ftparchive release -o APT::FTPArchive::Release::Origin="${{ env.APP_NAME }}" \ + apt-ftparchive -o APT::FTPArchive::Release::Origin="${{ env.APP_NAME }}" \ -o APT::FTPArchive::Release::Label="${{ env.APP_NAME }}" \ -o APT::FTPArchive::Release::Suite="${dist}" \ -o APT::FTPArchive::Release::Codename="${dist}" \ -o APT::FTPArchive::Release::Version="${{ env.APP_VERSION }}" \ -o APT::FTPArchive::Release::Architectures="${{ env.ARCHITECTURES }}" \ -o APT::FTPArchive::Release::Components="main" \ - dists/${dist} > dists/${dist}/Release + -o Tree::dists/${dist}::Sections="main" \ + -o Tree::dists/${dist}::Architectures="${{ env.ARCHITECTURES }}" \ + -o Dir::ArchiveDir="${{ env.REPO_DIR }}" \ + packages pool/main override-file \ + release dists/${dist} echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --default-key ${{ secrets.GPG_KEY_ID }} --batch --yes --passphrase-fd 0 -abs -o dists/${dist}/Release.gpg dists/${dist}/Release echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --default-key ${{ secrets.GPG_KEY_ID }} --batch --yes --passphrase-fd 0 --clearsign -o dists/${dist}/InRelease dists/${dist}/Release @@ -207,7 +215,7 @@ jobs: - name: Upload APT repo to remote run: | - scp -v -i ~/.ssh/id_rsa -r ${{ github.workspace }}/aptrepo/ ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:/var/www/html/ + scp -v -i ~/.ssh/id_rsa -r ${{ github.workspace }}/zbox/ ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:/var/www/html/aptrepo/ - name: Upload GPG public key to remote server run: | @@ -216,7 +224,7 @@ jobs: - name: Upload install script to remote server run: | - scp -v -i ~/.ssh/id_rsa ${{ env.SRC_DIR }}/scripts/debian/install.sh ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:/var/www/html/deb_install.sh + scp -v -i ~/.ssh/id_rsa ${{ env.SRC_DIR }}/scripts/debian/install.sh ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:/var/www/html/aptrepo/zbox_deb_install.sh @@ -266,7 +274,7 @@ jobs: docker buildx build \ --platform ${{ matrix.arch.platform }} \ --build-arg BASE_IMAGE=${{ matrix.distro.base_image }} \ - --build-arg LOC="https://packages.zus.network/deb_install.sh" \ + --build-arg LOC="https://packages.zus.network/aptrepo/zbox_deb_install.sh" \ --tag ${{ env.APP_NAME }}-${{ env.APP_VERSION }}-${{ matrix.distro.name }}-${{ matrix.arch.name }} \ --load \ --output type=docker,dest=${{ github.workspace }}/${{ env.APP_NAME }}-${{ env.APP_VERSION }}-${{ matrix.distro.name }}-${{ matrix.arch.name }}.tar \ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b139d53e..dcaf7dd7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,103 +6,17 @@ on: workflow_dispatch: inputs: version: - description: 'Version of zboxcli to release' + description: 'Version of zbox to release' required: true - default: '1.0.0' - dry_run: - description: 'Run without making changes' - required: false - default: 'false' + default: 'v1.0.0' env: GITHUB_TOKEN: ${{ secrets.GOSDK }} - VERSION: 1.16.0 # take as input from workflow + VERSION: v1.16.0 # take as input from workflow APP_NAME: zbox GO_VERSION: 1.21 jobs: - darwin: - runs-on: ubuntu-latest - env: - SRC_DIR: ${{ github.workspace }}/src - OUTPUT_DIR: ${{ github.workspace }}/output - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - path: ${{ env.SRC_DIR }} - - - name: Setup - run : | - mkdir -p ${{ env.OUTPUT_DIR }} - sudo apt-get update - sudo apt-get install -y clang cmake git patch python-is-python3 libssl-dev lzma-dev libxml2-dev xz-utils bzip2 cpio libbz2-dev zlib1g-dev - - - name: Set up Go - uses: actions/setup-go@v4 - with: - go-version: ${{ env.GO_VERSION }} - - - name: Set up osxcross - run: | - cd ${{ github.workspace }} - git clone https://github.com/tpoechtrager/osxcross.git - cd osxcross/tarballs - wget https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX11.3.sdk.tar.xz - cd .. - export CC=clang - export CXX=clang++ - UNATTENDED=yes OSX_VERSION_MIN=10.10 ./build.sh - - - name: Cross-compile for Darwin/amd64 - run: | - cd ${{ env.SRC_DIR }} - export OSXCROSS_ROOT=${{ github.workspace }}/osxcross - export PATH=$OSXCROSS_ROOT/target/bin:$PATH - export GO111MODULE=on - export CGO_ENABLED=1 - - find /usr -name "libstdc++*" # debug - o64-clang -v - o64-clang++ -v - - echo "Building for Darwin/amd64..." - CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=amd64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${{env.VERSION }}" -o ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} . - echo "Build completed." - - - name: Create Zip File for Darwin/amd64 - run: | - cd ${{ env.OUTPUT_DIR }} - zip -qq -r ${{ env.APP_NAME }}-darwin-amd64.zip ${{ env.APP_NAME }} - - - name: Upload Zip for Darwin/amd64 - uses: actions/upload-artifact@v3 - with: - name: ${{ env.APP_NAME }}-darwin-amd64 - path: ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}-darwin-amd64.zip - - - name: Cross-compile for Darwin/arm64 - run: | - cd ${{ env.SRC_DIR }} - export OSXCROSS_ROOT=${{ github.workspace }}/osxcross - export PATH=$OSXCROSS_ROOT/target/bin:$PATH - export GO111MODULE=on - export CGO_ENABLED=1 - echo "Building for Darwin/arm64..." - CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=arm64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${{env.VERSION }}" -o ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }} . - echo "Build completed." - - - name: Create Zip File for Darwin/arm64 - run: | - cd ${{ env.OUTPUT_DIR }} - zip -qq -r ${{ env.APP_NAME }}-darwin-arm64.zip ${{ env.APP_NAME }} - - - name: Upload Zip for Darwin/arm64 - uses: actions/upload-artifact@v3 - with: - name: ${{ env.APP_NAME }}-darwin-arm64 - path: ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}-darwin-arm64.zip - linux: runs-on: ubuntu-latest env: diff --git a/scripts/debian/Dockerfile.install_test b/scripts/debian/Dockerfile.install_test index ef74c1fb..160bdc10 100644 --- a/scripts/debian/Dockerfile.install_test +++ b/scripts/debian/Dockerfile.install_test @@ -11,7 +11,7 @@ RUN apt-get update && apt-get install -y curl dpkg RUN dpkg --print-architecture # Download and install the app -ARG LOC=https://packages.zus.network/deb_install.sh +ARG LOC=https://packages.zus.network/aptrepo/zbox_deb_install.sh RUN set -e; \ curl -sL ${LOC} | bash diff --git a/scripts/debian/install.sh b/scripts/debian/install.sh index aea16467..c9321e9c 100755 --- a/scripts/debian/install.sh +++ b/scripts/debian/install.sh @@ -22,8 +22,8 @@ setup() { if [[ -z $DIST_CODE ]]; then CLI_REPO=$(lsb_release -cs) shopt -s nocasematch - ERROR_MSG="Unable to find a package for your system. Please check if an existing package in https://packages.zus.network/aptrepo/dists/ can be used in your system and install with the dist name: 'curl -sL https://packages.zus.network/deb_install.sh | sudo DIST_CODE= bash'" - if [[ ! $(curl -sL https://packages.zus.network/aptrepo/dists/) =~ $CLI_REPO ]]; then + ERROR_MSG="Unable to find a package for your system. Please check if an existing package in https://packages.zus.network/aptrepo/zbox/dists/ can be used in your system and install with the dist name: 'curl -sL https://packages.zus.network/aptrepo/zbox_deb_install.sh | sudo DIST_CODE= bash'" + if [[ ! $(curl -sL https://packages.zus.network/aptrepo/zbox/dists/) =~ $CLI_REPO ]]; then DIST=$(lsb_release -is) if [[ $DIST =~ "Ubuntu" ]]; then CLI_REPO="jammy" @@ -42,8 +42,8 @@ setup() { fi else CLI_REPO=$DIST_CODE - if [[ ! $(curl -sL https://packages.zus.network/aptrepo/dists/) =~ $CLI_REPO ]]; then - echo "Unable to find an zbox-cli package with DIST_CODE=$CLI_REPO in https://packages.zus.network/aptrepo/dists/" + if [[ ! $(curl -sL https://packages.zus.network/aptrepo/zbox/dists/) =~ $CLI_REPO ]]; then + echo "Unable to find an zbox package with DIST_CODE=$CLI_REPO in https://packages.zus.network/aptrepo/zbox/dists/" exit 1 fi fi @@ -53,7 +53,7 @@ setup() { fi echo "Types: deb -URIs: https://packages.zus.network/aptrepo/ +URIs: https://packages.zus.network/aptrepo/zbox/ Suites: ${CLI_REPO} Components: main Architectures: $(dpkg --print-architecture) From 3d45dd347c02f3dcd927307ba9ceca6d01c5b486 Mon Sep 17 00:00:00 2001 From: storybehind Date: Mon, 5 Aug 2024 15:06:35 +0530 Subject: [PATCH 148/228] fix version & remove windows docker build --- .github/workflows/distribute-zboxcli.yml | 4 ++-- .github/workflows/release.yml | 4 ++-- scripts/windows/Dockerfile.build | 30 ------------------------ 3 files changed, 4 insertions(+), 34 deletions(-) delete mode 100644 scripts/windows/Dockerfile.build diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index ea6da58e..c8772a58 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -9,11 +9,11 @@ on: version: description: 'Version of zbox to release' required: true - default: 'v1.0.0' + default: '1.0.0' env: APP_NAME: zbox - APP_VERSION: v1.16.0 # REMOVE: take as input from workflow + APP_VERSION: 1.16.0 # REMOVE: take as input from workflow GO_VERSION: 1.21.0 REMOTE_SERVER: 5.9.151.246 REMOTE_USER: root diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dcaf7dd7..660c065c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,11 +8,11 @@ on: version: description: 'Version of zbox to release' required: true - default: 'v1.0.0' + default: '1.0.0' env: GITHUB_TOKEN: ${{ secrets.GOSDK }} - VERSION: v1.16.0 # take as input from workflow + VERSION: 1.16.0 # take as input from workflow APP_NAME: zbox GO_VERSION: 1.21 diff --git a/scripts/windows/Dockerfile.build b/scripts/windows/Dockerfile.build deleted file mode 100644 index 7c20a119..00000000 --- a/scripts/windows/Dockerfile.build +++ /dev/null @@ -1,30 +0,0 @@ -# Use the Windows Server 2022 base image for amd64 -FROM mcr.microsoft.com/windows/servercore:ltsc2022 - -# Set environment variables for Go -ENV GOLANG_VERSION 1.21 -ARG VERSION - -# Install Chocolatey -RUN powershell -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command \ - Set-ExecutionPolicy Bypass -Scope Process -Force; \ - [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; \ - Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) - -# Install Go -RUN choco install golang --version %GOLANG_VERSION% -y && \ - refreshenv - -# Create directories -RUN mkdir c:\\src - -# Copy the source code into the container -COPY . c:\\src - -# Set the working directory -WORKDIR c:\\src - -# Build the application -RUN go env -RUN CGO_ENABLED=1 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${VERSION} -linkmode 'external' -extldflags '-static'" -o zbox.exe . - From bfe197db9b70c65235e1845d95cbb82327c18c0a Mon Sep 17 00:00:00 2001 From: storybehind Date: Tue, 6 Aug 2024 12:59:46 +0530 Subject: [PATCH 149/228] fix update repo commands --- .github/workflows/distribute-zboxcli.yml | 33 ++++++++++++++---------- .github/workflows/release.yml | 4 +-- scripts/debian/install.sh | 2 +- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index c8772a58..4ef01ae6 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -186,28 +186,35 @@ jobs: - name: Copy debian packages run : | - mkdir -p ${{ env.REPO_DIR }}/pool/main/z/${APP_NAME}/ + mkdir -p ${{ env.REPO_DIR }}/pool/main/z/${{ env.APP_NAME }}/ find ${{ env.DEB_DIR }} -name "*.deb" for deb in $(find ${{ env.DEB_DIR }} -name "*.deb"); do - cp $deb ${{ env.REPO_DIR }}/pool/main/z/${APP_NAME}/ + cp $deb ${{ env.REPO_DIR }}/pool/main/z/${{ env.APP_NAME }}/ done - name: Update APT repo run: | cd ${{ env.REPO_DIR }} for dist in ${{ env.DISTRIBUTIONS }}; do + mkdir -p dists/${dist} + for arch in ${{ env.ARCHITECTURES }}; do + mkdir -p dists/${dist}/main/binary-${arch} + find "${{ env.REPO_DIR }}/pool/main/z/${{ env.APP_NAME }}" -type f -name "${{ env.APP_NAME }}_*~${dist}_${arch}.deb" | \ + xargs -I {} apt-ftparchive -o Tree::dists/${dist}::Sections="main" \ + -o Tree::dists/${dist}::Architectures="${arch}" \ + -o Dir::ArchiveDir="${{ env.REPO_DIR }}" \ + packages {} > dists/${dist}/main/binary-${arch}/Packages + done + apt-ftparchive -o APT::FTPArchive::Release::Origin="${{ env.APP_NAME }}" \ - -o APT::FTPArchive::Release::Label="${{ env.APP_NAME }}" \ - -o APT::FTPArchive::Release::Suite="${dist}" \ - -o APT::FTPArchive::Release::Codename="${dist}" \ - -o APT::FTPArchive::Release::Version="${{ env.APP_VERSION }}" \ - -o APT::FTPArchive::Release::Architectures="${{ env.ARCHITECTURES }}" \ - -o APT::FTPArchive::Release::Components="main" \ - -o Tree::dists/${dist}::Sections="main" \ - -o Tree::dists/${dist}::Architectures="${{ env.ARCHITECTURES }}" \ - -o Dir::ArchiveDir="${{ env.REPO_DIR }}" \ - packages pool/main override-file \ - release dists/${dist} + -o APT::FTPArchive::Release::Label="${{ env.APP_NAME }}" \ + -o APT::FTPArchive::Release::Suite="${dist}" \ + -o APT::FTPArchive::Release::Codename="${dist}" \ + -o APT::FTPArchive::Release::Version="${{ env.APP_VERSION }}" \ + -o APT::FTPArchive::Release::Architectures="${{ env.ARCHITECTURES }}" \ + -o APT::FTPArchive::Release::Components="main" \ + -o Dir::ArchiveDir="${{ env.REPO_DIR }}" \ + release dists/${dist} > dists/${dist}/Release echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --default-key ${{ secrets.GPG_KEY_ID }} --batch --yes --passphrase-fd 0 -abs -o dists/${dist}/Release.gpg dists/${dist}/Release echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --default-key ${{ secrets.GPG_KEY_ID }} --batch --yes --passphrase-fd 0 --clearsign -o dists/${dist}/InRelease dists/${dist}/Release diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 660c065c..3e10f01f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,6 +1,6 @@ name: Release on: - push: # remove push once tested + push: # REMOVE: push once tested branches: - packaging workflow_dispatch: @@ -12,7 +12,7 @@ on: env: GITHUB_TOKEN: ${{ secrets.GOSDK }} - VERSION: 1.16.0 # take as input from workflow + VERSION: 1.16.0 # REMOVE: take as input from workflow APP_NAME: zbox GO_VERSION: 1.21 diff --git a/scripts/debian/install.sh b/scripts/debian/install.sh index c9321e9c..0c6d4680 100755 --- a/scripts/debian/install.sh +++ b/scripts/debian/install.sh @@ -71,7 +71,7 @@ Signed-by: /etc/apt/keyrings/zus.gpg" | tee /etc/apt/sources.list.d/zbox.sources touch $CONFIG_PATH cat < ${CONFIG_PATH} --- -block_worker: https://dev.zus.network +block_worker: https://dev.zus.network # UPDATE: mainnet url signature_scheme: bls0chain min_submit: 50 min_confirmation: 50 From caca55a013e66f62912b20fda8c694a0ac3721ee Mon Sep 17 00:00:00 2001 From: storybehind Date: Tue, 6 Aug 2024 13:18:55 +0530 Subject: [PATCH 150/228] fix update repo commands --- .github/workflows/distribute-zboxcli.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index 4ef01ae6..7aacb52c 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -106,7 +106,6 @@ jobs: Package: ${{ env.APP_NAME }} Version: ${{ env.APP_VERSION }} Architecture: ${{ matrix.arch.name }} - Maintainer: none Description: zbox is a command line interface (CLI) tool to understand the capabilities of Züs dStorage and prototype your app EOT @@ -199,7 +198,7 @@ jobs: mkdir -p dists/${dist} for arch in ${{ env.ARCHITECTURES }}; do mkdir -p dists/${dist}/main/binary-${arch} - find "${{ env.REPO_DIR }}/pool/main/z/${{ env.APP_NAME }}" -type f -name "${{ env.APP_NAME }}_*~${dist}_${arch}.deb" | \ + find "pool/main/z/${{ env.APP_NAME }}" -type f -name "${{ env.APP_NAME }}_*~${dist}_${arch}.deb" | \ xargs -I {} apt-ftparchive -o Tree::dists/${dist}::Sections="main" \ -o Tree::dists/${dist}::Architectures="${arch}" \ -o Dir::ArchiveDir="${{ env.REPO_DIR }}" \ From d3f463d4b892ff2cd8b986c7432c192f6e35b0ee Mon Sep 17 00:00:00 2001 From: storybehind Date: Tue, 6 Aug 2024 14:24:57 +0530 Subject: [PATCH 151/228] update config & workflow dispatch --- .github/workflows/distribute-zboxcli.yml | 5 +---- .github/workflows/release.yml | 5 +---- scripts/debian/install.sh | 2 +- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index 7aacb52c..ed603a48 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -1,9 +1,6 @@ name: Build, Distribute and Test zbox on: - push: # REMOVE: push once tested - branches: - - packaging workflow_dispatch: inputs: version: @@ -13,7 +10,7 @@ on: env: APP_NAME: zbox - APP_VERSION: 1.16.0 # REMOVE: take as input from workflow + APP_VERSION: ${{ github.event.inputs.version }} GO_VERSION: 1.21.0 REMOTE_SERVER: 5.9.151.246 REMOTE_USER: root diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3e10f01f..c381dfc4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,8 +1,5 @@ name: Release on: - push: # REMOVE: push once tested - branches: - - packaging workflow_dispatch: inputs: version: @@ -12,7 +9,7 @@ on: env: GITHUB_TOKEN: ${{ secrets.GOSDK }} - VERSION: 1.16.0 # REMOVE: take as input from workflow + VERSION: ${{ github.event.inputs.version }} APP_NAME: zbox GO_VERSION: 1.21 diff --git a/scripts/debian/install.sh b/scripts/debian/install.sh index 0c6d4680..9e93c9da 100755 --- a/scripts/debian/install.sh +++ b/scripts/debian/install.sh @@ -71,7 +71,7 @@ Signed-by: /etc/apt/keyrings/zus.gpg" | tee /etc/apt/sources.list.d/zbox.sources touch $CONFIG_PATH cat < ${CONFIG_PATH} --- -block_worker: https://dev.zus.network # UPDATE: mainnet url +block_worker: https://mainnet.zus.network/dns signature_scheme: bls0chain min_submit: 50 min_confirmation: 50 From 1f7d240044cf27672ed5a6793548f4d9f2a4412c Mon Sep 17 00:00:00 2001 From: storybehind Date: Tue, 6 Aug 2024 14:55:10 +0530 Subject: [PATCH 152/228] create release & upload artifacts --- .github/workflows/release.yml | 40 ++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c381dfc4..faee0a6b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,6 +6,14 @@ on: description: 'Version of zbox to release' required: true default: '1.0.0' + tag: + description: 'Tag of zbox to release' + required: true + default: 'v1.0.0' + draft: + description: 'Create release as draft' + required: false + default: 'true' env: GITHUB_TOKEN: ${{ secrets.GOSDK }} @@ -94,4 +102,34 @@ jobs: with: name: ${{ env.APP_NAME }}-linux-arm64 path: ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}-linux-arm64.zip - \ No newline at end of file + + - name: Create GitHub Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.event.inputs.tag }} + release_name: ${{ github.event.inputs.tag }} + draft: ${{ github.event.inputs.draft }} + prerelease: false + + - name: Upload Release Asset for Linux/amd64 + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}-linux-amd64.zip + asset_name: ${{ env.APP_NAME }}-linux-amd64.zip + asset_content_type: application/zip + + - name: Upload Release Asset for Linux/arm64 + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}-linux-arm64.zip + asset_name: ${{ env.APP_NAME }}-linux-arm64.zip + asset_content_type: application/zip \ No newline at end of file From 1b21090f1c1419282592151546fbe5548f2adff5 Mon Sep 17 00:00:00 2001 From: storybehind Date: Sat, 10 Aug 2024 10:01:33 +0530 Subject: [PATCH 153/228] initial commit --- scripts/darwin/Dockerfile.build | 13 +++++++++++ scripts/darwin/build.sh | 29 +++++++++++++++++++++++++ scripts/darwin/build2.sh | 38 +++++++++++++++++++++++++++++++++ 3 files changed, 80 insertions(+) create mode 100755 scripts/darwin/Dockerfile.build create mode 100755 scripts/darwin/build.sh create mode 100755 scripts/darwin/build2.sh diff --git a/scripts/darwin/Dockerfile.build b/scripts/darwin/Dockerfile.build new file mode 100755 index 00000000..353874a3 --- /dev/null +++ b/scripts/darwin/Dockerfile.build @@ -0,0 +1,13 @@ +# syntax=docker/dockerfile:latest + +FROM ubuntu:latest + +# setup osxcross +RUN apt-get update && apt-get install -y clang cmake git patch python-is-python3 libssl-dev lzma-dev libxml2-dev xz-utils bzip2 cpio libbz2-dev zlib1g-dev +RUN git clone https://github.com/tpoechtrager/osxcross.git +WORKDIR /osxcross/tarballs +RUN wget https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX11.3.sdk.tar.xz +WORKDIR /osxcross +ENV CC=clang +ENV CXX=clang++ +RUN UNATTENDED=yes OSX_VERSION_MIN=12.0 ./build.sh diff --git a/scripts/darwin/build.sh b/scripts/darwin/build.sh new file mode 100755 index 00000000..88a4c378 --- /dev/null +++ b/scripts/darwin/build.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +set -e + +# apt-get install -y clang cmake git patch python-is-python3 libssl-dev lzma-dev libxml2-dev xz-utils bzip2 cpio libbz2-dev zlib1g-dev libc++-dev libc++abi-dev build-essential +# dpkg -L libc++-dev +# dpkg -L libc++abi-dev + +export OSXCROSS_ROOT=$HOME/osxcross +export PATH=$OSXCROSS_ROOT/target/bin:$PATH +export SDKROOT=$OSXCROSS_ROOT/target/SDK/MacOSX11.3.sdk +# export CFLAGS="-isysroot $SDKROOT -stdlib=libc++" +# export CXXFLAGS="-isysroot $SDKROOT -stdlib=libc++" +# export LDFLAGS="-isysroot $SDKROOT -stdlib=libc++" +# Set up Go environment +export GO111MODULE=on +export CGO_ENABLED=1 + +VERSION=1.16.0 + +# Cross-compile for Darwin/amd64 +echo "Building for Darwin/amd64..." +CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=amd64 ~/sdk/go1.21.8/bin/go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${VERSION}" -o zboxcli-darwin-amd64 . + +# Cross-compile for Darwin/arm64 +echo "Building for Darwin/arm64..." +CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=arm64 ~/sdk/go1.21.8/bin/go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${VERSION}" -o zboxcli-darwin-arm64 . + +echo "Build completed." diff --git a/scripts/darwin/build2.sh b/scripts/darwin/build2.sh new file mode 100755 index 00000000..808f0885 --- /dev/null +++ b/scripts/darwin/build2.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +set -e + +SRC_DIR=$PWD +HOME_DIR=$HOME + +echo "PWD=$SRC_DIR , HOME=$HOME_DIR" + +# sudo apt-get update +sudo apt-get install -y clang cmake git patch python libssl-dev lzma-dev libxml2-dev xz-utils bzip2 cpio libbz2-dev zlib1g-dev + +cd $HOME_DIR +rm -rf $HOME_DIR/osxcross +git clone https://github.com/tpoechtrager/osxcross.git +cd osxcross/tarballs +wget https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX11.3.sdk.tar.xz +cd .. +export CC=clang +export CXX=clang++ +UNATTENDED=yes ./build.sh + +export OSXCROSS_ROOT=$PWD +export PATH=$OSXCROSS_ROOT/target/bin:$PATH +export GO111MODULE=on +export CGO_ENABLED=1 + +# Cross-compile for Darwin/amd64 +echo "Building for Darwin/amd64..." +CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=amd64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${VERSION} -linkmode 'external' -extldflags '-static'" -o zboxcli-darwin-amd64 . + +# Cross-compile for Darwin/arm64 +echo "Building for Darwin/arm64..." +CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=arm64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${VERSION} -linkmode 'external' -extldflags '-static'" -o zboxcli-darwin-arm64 . + +echo "Build completed." + +echo "osxcross setup success!" \ No newline at end of file From d5db9455a29a8d8ad8ac83954049d691bad3eec3 Mon Sep 17 00:00:00 2001 From: storybehind Date: Sat, 10 Aug 2024 10:08:46 +0530 Subject: [PATCH 154/228] fix update aptrepo step --- .github/workflows/distribute-zboxcli.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli.yml index ed603a48..b930bdf5 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli.yml @@ -185,13 +185,14 @@ jobs: mkdir -p ${{ env.REPO_DIR }}/pool/main/z/${{ env.APP_NAME }}/ find ${{ env.DEB_DIR }} -name "*.deb" for deb in $(find ${{ env.DEB_DIR }} -name "*.deb"); do - cp $deb ${{ env.REPO_DIR }}/pool/main/z/${{ env.APP_NAME }}/ + cp -u $deb ${{ env.REPO_DIR }}/pool/main/z/${{ env.APP_NAME }}/ done - name: Update APT repo run: | cd ${{ env.REPO_DIR }} for dist in ${{ env.DISTRIBUTIONS }}; do + rm -rf dists/${dist} mkdir -p dists/${dist} for arch in ${{ env.ARCHITECTURES }}; do mkdir -p dists/${dist}/main/binary-${arch} @@ -199,7 +200,7 @@ jobs: xargs -I {} apt-ftparchive -o Tree::dists/${dist}::Sections="main" \ -o Tree::dists/${dist}::Architectures="${arch}" \ -o Dir::ArchiveDir="${{ env.REPO_DIR }}" \ - packages {} > dists/${dist}/main/binary-${arch}/Packages + packages {} >> dists/${dist}/main/binary-${arch}/Packages done apt-ftparchive -o APT::FTPArchive::Release::Origin="${{ env.APP_NAME }}" \ From aab3abe872852ea2e3936f8e526143f68801160d Mon Sep 17 00:00:00 2001 From: dabasov Date: Sat, 10 Aug 2024 21:42:09 +0300 Subject: [PATCH 155/228] updated gosdk --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 536876ae..02b6f2bc 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.16.0 + github.com/0chain/gosdk v1.17.0-RC1 github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 diff --git a/go.sum b/go.sum index 6c3b152e..63f848dc 100644 --- a/go.sum +++ b/go.sum @@ -40,8 +40,8 @@ github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565 h1:z+DtCR8mBsjPnEs github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565/go.mod h1:UyDC8Qyl5z9lGkCnf9RHJPMektnFX8XtCJZHXCCVj8E= 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.16.0 h1:3CKuU9i9d+X2/htJOIyxNwviKG5H/lp+q8ogzCgnoQI= -github.com/0chain/gosdk v1.16.0/go.mod h1:y7Ucdmv40VltqulZnncMNjNQ4piX5Dta5ujNmPmXnxg= +github.com/0chain/gosdk v1.17.0-RC1 h1:D3OwgmfkqW/2FR+JtjmDx+KhlCINXL5/ZWNMbbPh4lc= +github.com/0chain/gosdk v1.17.0-RC1/go.mod h1:y7Ucdmv40VltqulZnncMNjNQ4piX5Dta5ujNmPmXnxg= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= From fdb4da0cd872fec1a2873dfd973e207aa3cdc0af Mon Sep 17 00:00:00 2001 From: Jayash Satolia <73050737+Jayashsatolia403@users.noreply.github.com> Date: Sun, 11 Aug 2024 00:13:02 +0530 Subject: [PATCH 156/228] Update gosdk --- go.mod | 2 +- go.sum | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 4b23f528..02b6f2bc 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.16.3-0.20240723235848-5a022363a8b1 + github.com/0chain/gosdk v1.17.0-RC1 github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 diff --git a/go.sum b/go.sum index 9f30f2c9..63f848dc 100644 --- a/go.sum +++ b/go.sum @@ -40,10 +40,8 @@ github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565 h1:z+DtCR8mBsjPnEs github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565/go.mod h1:UyDC8Qyl5z9lGkCnf9RHJPMektnFX8XtCJZHXCCVj8E= 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.16.0 h1:3CKuU9i9d+X2/htJOIyxNwviKG5H/lp+q8ogzCgnoQI= -github.com/0chain/gosdk v1.16.0/go.mod h1:y7Ucdmv40VltqulZnncMNjNQ4piX5Dta5ujNmPmXnxg= -github.com/0chain/gosdk v1.16.3-0.20240723235848-5a022363a8b1 h1:ZQr+brw+pG9nM5rLk006cS1fSSrzwhv6HLe0BLeIxwI= -github.com/0chain/gosdk v1.16.3-0.20240723235848-5a022363a8b1/go.mod h1:y7Ucdmv40VltqulZnncMNjNQ4piX5Dta5ujNmPmXnxg= +github.com/0chain/gosdk v1.17.0-RC1 h1:D3OwgmfkqW/2FR+JtjmDx+KhlCINXL5/ZWNMbbPh4lc= +github.com/0chain/gosdk v1.17.0-RC1/go.mod h1:y7Ucdmv40VltqulZnncMNjNQ4piX5Dta5ujNmPmXnxg= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= From 42b1c7c7a5876da6903b4f94f62944103a1fe44c Mon Sep 17 00:00:00 2001 From: Arun Ramanathan Date: Sat, 17 Aug 2024 12:47:14 +0530 Subject: [PATCH 157/228] release and dockerfile --- .github/workflows/release.yml | 118 ++++++++++++++++++++++++++++---- scripts/darwin/Dockerfile.build | 28 +++++++- 2 files changed, 131 insertions(+), 15 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index faee0a6b..b33f1347 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,8 +22,25 @@ env: GO_VERSION: 1.21 jobs: + create_release: + runs-on: ubuntu-latest + outputs: + release_id: ${{ steps.create_release.outputs.id }} + steps: + - name: Create GitHub Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.event.inputs.tag }} + release_name: ${{ github.event.inputs.tag }} + draft: ${{ github.event.inputs.draft }} + prerelease: false + linux: runs-on: ubuntu-latest + needs: create_release env: SRC_DIR: ${{ github.workspace }}/src OUTPUT_DIR: ${{ github.workspace }}/output @@ -102,24 +119,13 @@ jobs: with: name: ${{ env.APP_NAME }}-linux-arm64 path: ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}-linux-arm64.zip - - - name: Create GitHub Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.event.inputs.tag }} - release_name: ${{ github.event.inputs.tag }} - draft: ${{ github.event.inputs.draft }} - prerelease: false - name: Upload Release Asset for Linux/amd64 uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - upload_url: ${{ steps.create_release.outputs.upload_url }} + upload_url: ${{ needs.create_release.outputs.release_id }} asset_path: ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}-linux-amd64.zip asset_name: ${{ env.APP_NAME }}-linux-amd64.zip asset_content_type: application/zip @@ -129,7 +135,93 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - upload_url: ${{ steps.create_release.outputs.upload_url }} + upload_url: ${{ needs.create_release.outputs.release_id }} asset_path: ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}-linux-arm64.zip asset_name: ${{ env.APP_NAME }}-linux-arm64.zip + asset_content_type: application/zip + + darwin: + runs-on: ubuntu-latest + needs: create_release + env: + SRC_DIR: ${{ github.workspace }}/src + OUTPUT_DIR: ${{ github.workspace }}/output + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + path: ${{ env.SRC_DIR }} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + with: + platforms: linux/amd64,linux/arm64 + + - name: Install zip + uses: montudor/action-zip@v1 + + - name: Setup + run : | + mkdir -p ${{ env.OUTPUT_DIR }}/amd64 + mkdir -p ${{ env.OUTPUT_DIR }}/arm64 + + - name: Build Docker image + run: | + docker buildx create --use + docker buildx build \ + --platform linux/amd64 \ + --build-arg VERSION=${{ env.VERSION }} \ + --tag ${{ env.APP_NAME }} \ + --load \ + --output type=docker,dest=${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}.tar \ + -f ${{ env.SRC_DIR }}/scripts/darwin/Dockerfile.build ${{ env.SRC_DIR }} + + - name: Load image & Extract binary from container + run: | + docker load -i ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}.tar + CONTAINER_ID=$(docker create ${{ env.APP_NAME }}) + docker cp ${CONTAINER_ID}:/go/bin/zboxcli-darwin-amd64 ${{ env.OUTPUT_DIR }}/amd64/${{ env.APP_NAME }} + docker cp ${CONTAINER_ID}:/go/bin/zboxcli-darwin-arm64 ${{ env.OUTPUT_DIR }}/arm64/${{ env.APP_NAME }} + docker rm ${CONTAINER_ID} + + - name: Create Zip File for darwin/amd64 + run: | + cd ${{ env.OUTPUT_DIR }}/amd64 + zip -qq -r ${{ env.APP_NAME }}-darwin-amd64.zip ${{ env.APP_NAME }} + + - name: Upload Zip for Darwin/amd64 + uses: actions/upload-artifact@v3 + with: + name: ${{ env.APP_NAME }}-darwin-amd64 + path: ${{ env.OUTPUT_DIR }}/amd64/${{ env.APP_NAME }}-darwin-amd64.zip + + - name: Create Zip File for darwin/arm64 + run: | + cd ${{ env.OUTPUT_DIR }}/arm64 + zip -qq -r ${{ env.APP_NAME }}-darwin-arm64.zip ${{ env.APP_NAME }} + + - name: Upload Zip for Darwin/arm64 + uses: actions/upload-artifact@v3 + with: + name: ${{ env.APP_NAME }}-darwin-arm64 + path: ${{ env.OUTPUT_DIR }}/arm64/${{ env.APP_NAME }}-darwin-arm64.zip + + - name: Upload Release Asset for Linux/amd64 + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.create_release.outputs.release_id }} + asset_path: ${{ env.OUTPUT_DIR }}/amd64/${{ env.APP_NAME }}-darwin-amd64.zip + asset_name: ${{ env.APP_NAME }}-darwin-amd64.zip + asset_content_type: application/zip + + - name: Upload Release Asset for Linux/arm64 + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.create_release.outputs.release_id }} + asset_path: ${{ env.OUTPUT_DIR }}/arm64/${{ env.APP_NAME }}-darwin-arm64.zip + asset_name: ${{ env.APP_NAME }}-darwin-arm64.zip asset_content_type: application/zip \ No newline at end of file diff --git a/scripts/darwin/Dockerfile.build b/scripts/darwin/Dockerfile.build index 353874a3..642e592e 100755 --- a/scripts/darwin/Dockerfile.build +++ b/scripts/darwin/Dockerfile.build @@ -3,11 +3,35 @@ FROM ubuntu:latest # setup osxcross -RUN apt-get update && apt-get install -y clang cmake git patch python-is-python3 libssl-dev lzma-dev libxml2-dev xz-utils bzip2 cpio libbz2-dev zlib1g-dev +RUN apt-get update && apt-get install -y clang cmake git patch python-is-python3 libssl-dev lzma-dev libxml2-dev xz-utils bzip2 cpio libbz2-dev zlib1g-dev wget libc6-dev RUN git clone https://github.com/tpoechtrager/osxcross.git WORKDIR /osxcross/tarballs RUN wget https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX11.3.sdk.tar.xz WORKDIR /osxcross ENV CC=clang ENV CXX=clang++ -RUN UNATTENDED=yes OSX_VERSION_MIN=12.0 ./build.sh +RUN UNATTENDED=yes OSX_VERSION_MIN=11.3 ./build.sh + +ENV OSXCROSS_ROOT=/osxcross +ENV PATH=$OSXCROSS_ROOT/target/bin:$PATH +ENV GO111MODULE=on +ENV CGO_ENABLED=1 + +ARG VERSION + +# setup Go +ENV GOLANG_VERSION=1.21.12 +ENV GOLANG_DOWNLOAD_URL=https://golang.org/dl/go${GOLANG_VERSION}.linux-amd64.tar.gz +RUN wget -q ${GOLANG_DOWNLOAD_URL} -O golang.tar.gz \ + && tar -C /usr/local -xzf golang.tar.gz \ + && rm golang.tar.gz +ENV GOPATH=/go +ENV PATH=$GOPATH/bin:/usr/local/go/bin:$PATH +# Verify Go installation +RUN go version + +RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" +WORKDIR $GOPATH/src +COPY . . +RUN CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=amd64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${VERSION}" -o $GOPATH/bin/zboxcli-darwin-amd64 . +RUN CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=arm64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${VERSION}" -o $GOPATH/bin/zboxcli-darwin-arm64 . From 4c1c33f8560e412f457cb689db821cf2c39e29f0 Mon Sep 17 00:00:00 2001 From: Arun Ramanathan Date: Sat, 17 Aug 2024 14:50:43 +0530 Subject: [PATCH 158/228] fix upload-asset step --- .github/workflows/release.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b33f1347..b9160472 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,6 +26,7 @@ jobs: runs-on: ubuntu-latest outputs: release_id: ${{ steps.create_release.outputs.id }} + upload_url: ${{ steps.create_release.outputs.upload_url }} steps: - name: Create GitHub Release id: create_release @@ -125,7 +126,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - upload_url: ${{ needs.create_release.outputs.release_id }} + upload_url: ${{ needs.create_release.outputs.upload_url }} asset_path: ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}-linux-amd64.zip asset_name: ${{ env.APP_NAME }}-linux-amd64.zip asset_content_type: application/zip @@ -135,7 +136,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - upload_url: ${{ needs.create_release.outputs.release_id }} + upload_url: ${{ needs.create_release.outputs.upload_url }} asset_path: ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}-linux-arm64.zip asset_name: ${{ env.APP_NAME }}-linux-arm64.zip asset_content_type: application/zip @@ -211,7 +212,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - upload_url: ${{ needs.create_release.outputs.release_id }} + upload_url: ${{ needs.create_release.outputs.upload_url }} asset_path: ${{ env.OUTPUT_DIR }}/amd64/${{ env.APP_NAME }}-darwin-amd64.zip asset_name: ${{ env.APP_NAME }}-darwin-amd64.zip asset_content_type: application/zip @@ -221,7 +222,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - upload_url: ${{ needs.create_release.outputs.release_id }} + upload_url: ${{ needs.create_release.outputs.upload_url }} asset_path: ${{ env.OUTPUT_DIR }}/arm64/${{ env.APP_NAME }}-darwin-arm64.zip asset_name: ${{ env.APP_NAME }}-darwin-arm64.zip asset_content_type: application/zip \ No newline at end of file From 0ad9b62bf919c6fbf398e2610ade0659ff94241d Mon Sep 17 00:00:00 2001 From: dabasov Date: Sat, 17 Aug 2024 22:53:21 +0300 Subject: [PATCH 159/228] updated gosdk --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 536876ae..f93fd279 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.16.0 + github.com/0chain/gosdk v1.16.5 github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 diff --git a/go.sum b/go.sum index 6c3b152e..bf875ea3 100644 --- a/go.sum +++ b/go.sum @@ -40,8 +40,8 @@ github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565 h1:z+DtCR8mBsjPnEs github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565/go.mod h1:UyDC8Qyl5z9lGkCnf9RHJPMektnFX8XtCJZHXCCVj8E= 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.16.0 h1:3CKuU9i9d+X2/htJOIyxNwviKG5H/lp+q8ogzCgnoQI= -github.com/0chain/gosdk v1.16.0/go.mod h1:y7Ucdmv40VltqulZnncMNjNQ4piX5Dta5ujNmPmXnxg= +github.com/0chain/gosdk v1.16.5 h1:EGtndZLj5+m8OAIzfAfjqu4llEolWuxgKQxXS0tfe7Q= +github.com/0chain/gosdk v1.16.5/go.mod h1:y7Ucdmv40VltqulZnncMNjNQ4piX5Dta5ujNmPmXnxg= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= From 0a71b0d1cd2eb2b8e96ecc82950de64cb610af51 Mon Sep 17 00:00:00 2001 From: Arun Ramanathan Date: Sun, 18 Aug 2024 12:24:29 +0530 Subject: [PATCH 160/228] add config file in zip --- .github/workflows/release.yml | 17 ++++++++++++----- network/config.yaml | 2 +- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b9160472..1d83e01d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,6 +14,10 @@ on: description: 'Create release as draft' required: false default: 'true' + prerelease: + description: 'Create release as prerelease' + required: false + default: 'false' env: GITHUB_TOKEN: ${{ secrets.GOSDK }} @@ -37,7 +41,7 @@ jobs: tag_name: ${{ github.event.inputs.tag }} release_name: ${{ github.event.inputs.tag }} draft: ${{ github.event.inputs.draft }} - prerelease: false + prerelease: ${{ github.event.inputs.prerelease }} linux: runs-on: ubuntu-latest @@ -62,6 +66,7 @@ jobs: - name: Setup run : | mkdir -p ${{ env.OUTPUT_DIR }} + cp ${{ env.SRC_DIR }}/network/config.yaml ${{ env.OUTPUT_DIR }} - name: Build Docker image for linux/amd64 run: | @@ -84,7 +89,7 @@ jobs: - name: Create Zip File for linux/amd64 run: | cd ${{ env.OUTPUT_DIR }} - zip -qq -r ${{ env.APP_NAME }}-linux-amd64.zip ${{ env.APP_NAME }} + zip -qq -r ${{ env.APP_NAME }}-linux-amd64.zip ${{ env.APP_NAME }} config.yaml - name: Upload Zip for Darwin/amd64 uses: actions/upload-artifact@v3 @@ -113,7 +118,7 @@ jobs: - name: Create Zip File for linux/arm64 run: | cd ${{ env.OUTPUT_DIR }} - zip -qq -r ${{ env.APP_NAME }}-linux-arm64.zip ${{ env.APP_NAME }} + zip -qq -r ${{ env.APP_NAME }}-linux-arm64.zip ${{ env.APP_NAME }} config.yaml - name: Upload Zip for Darwin/arm64 uses: actions/upload-artifact@v3 @@ -165,6 +170,8 @@ jobs: run : | mkdir -p ${{ env.OUTPUT_DIR }}/amd64 mkdir -p ${{ env.OUTPUT_DIR }}/arm64 + cp ${{ env.SRC_DIR }}/network/config.yaml ${{ env.OUTPUT_DIR }}/amd64/ + cp ${{ env.SRC_DIR }}/network/config.yaml ${{ env.OUTPUT_DIR }}/arm64/ - name: Build Docker image run: | @@ -188,7 +195,7 @@ jobs: - name: Create Zip File for darwin/amd64 run: | cd ${{ env.OUTPUT_DIR }}/amd64 - zip -qq -r ${{ env.APP_NAME }}-darwin-amd64.zip ${{ env.APP_NAME }} + zip -qq -r ${{ env.APP_NAME }}-darwin-amd64.zip ${{ env.APP_NAME }} config.yaml - name: Upload Zip for Darwin/amd64 uses: actions/upload-artifact@v3 @@ -199,7 +206,7 @@ jobs: - name: Create Zip File for darwin/arm64 run: | cd ${{ env.OUTPUT_DIR }}/arm64 - zip -qq -r ${{ env.APP_NAME }}-darwin-arm64.zip ${{ env.APP_NAME }} + zip -qq -r ${{ env.APP_NAME }}-darwin-arm64.zip ${{ env.APP_NAME }} config.yaml - name: Upload Zip for Darwin/arm64 uses: actions/upload-artifact@v3 diff --git a/network/config.yaml b/network/config.yaml index f62f229d..e491dcd1 100644 --- a/network/config.yaml +++ b/network/config.yaml @@ -1,5 +1,5 @@ --- -block_worker: https://demo.zus.network/dns +block_worker: https://mainnet.zus.network/dns signature_scheme: bls0chain min_submit: 50 min_confirmation: 50 From 5c4c4efc57ab3ad4bb46d3a5ba16ad712bb2c6c8 Mon Sep 17 00:00:00 2001 From: Arun Ramanathan Date: Tue, 20 Aug 2024 21:49:41 +0530 Subject: [PATCH 161/228] provide default config --- .github/workflows/release.yml | 6 +++--- {network => cmd}/config.yaml | 0 cmd/root.go | 21 ++++++++++++++++++- go.mod | 2 +- scripts/darwin/build.sh | 29 -------------------------- scripts/darwin/build2.sh | 38 ----------------------------------- 6 files changed, 24 insertions(+), 72 deletions(-) rename {network => cmd}/config.yaml (100%) delete mode 100755 scripts/darwin/build.sh delete mode 100755 scripts/darwin/build2.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1d83e01d..62547adf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -66,7 +66,7 @@ jobs: - name: Setup run : | mkdir -p ${{ env.OUTPUT_DIR }} - cp ${{ env.SRC_DIR }}/network/config.yaml ${{ env.OUTPUT_DIR }} + cp ${{ env.SRC_DIR }}/cmd/config.yaml ${{ env.OUTPUT_DIR }} - name: Build Docker image for linux/amd64 run: | @@ -170,8 +170,8 @@ jobs: run : | mkdir -p ${{ env.OUTPUT_DIR }}/amd64 mkdir -p ${{ env.OUTPUT_DIR }}/arm64 - cp ${{ env.SRC_DIR }}/network/config.yaml ${{ env.OUTPUT_DIR }}/amd64/ - cp ${{ env.SRC_DIR }}/network/config.yaml ${{ env.OUTPUT_DIR }}/arm64/ + cp ${{ env.SRC_DIR }}/cmd/config.yaml ${{ env.OUTPUT_DIR }}/amd64/ + cp ${{ env.SRC_DIR }}/cmd/config.yaml ${{ env.OUTPUT_DIR }}/arm64/ - name: Build Docker image run: | diff --git a/network/config.yaml b/cmd/config.yaml similarity index 100% rename from network/config.yaml rename to cmd/config.yaml diff --git a/cmd/root.go b/cmd/root.go index d45b2636..85998a12 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -1,16 +1,19 @@ package cmd import ( + _ "embed" "encoding/json" "fmt" "io/ioutil" "os" "path/filepath" + "strings" "github.com/0chain/gosdk/core/conf" "github.com/0chain/gosdk/core/logger" "github.com/spf13/cobra" + "github.com/spf13/viper" "github.com/0chain/gosdk/zboxcore/blockchain" "github.com/0chain/zboxcli/util" @@ -34,6 +37,9 @@ var allocUnderRepair bool var walletJSON string +//go:embed config.yaml +var configStr string + var rootCmd = &cobra.Command{ Use: "zbox", Short: "zbox is a decentralized storage application written on the 0Chain platform", @@ -77,7 +83,20 @@ func initConfig() { cfg, err := conf.LoadConfigFile(filepath.Join(configDir, cfgFile)) if err != nil { fmt.Println("Can't read config:", err) - os.Exit(1) + fmt.Println("WARNING: using default config...") + fmt.Printf("config: %v", configStr) + v := viper.New() + v.SetConfigType("yaml") + err := v.ReadConfig(strings.NewReader(configStr)) + if err != nil { + fmt.Println("error reading default config:", err) + os.Exit(1) + } + cfg, err = conf.LoadConfig(v) + if err != nil { + fmt.Println("error loading default config:", err) + os.Exit(1) + } } if networkFile == "" { diff --git a/go.mod b/go.mod index 536876ae..393af58c 100644 --- a/go.mod +++ b/go.mod @@ -9,6 +9,7 @@ require ( github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 github.com/spf13/pflag v1.0.5 + github.com/spf13/viper v1.15.0 gopkg.in/cheggaaa/pb.v1 v1.0.28 ) @@ -57,7 +58,6 @@ require ( github.com/spf13/afero v1.9.3 // indirect github.com/spf13/cast v1.5.0 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect - github.com/spf13/viper v1.15.0 // indirect github.com/subosito/gotenv v1.4.2 // indirect github.com/tinylib/msgp v1.1.6 // indirect github.com/tklauser/go-sysconf v0.3.11 // indirect diff --git a/scripts/darwin/build.sh b/scripts/darwin/build.sh deleted file mode 100755 index 88a4c378..00000000 --- a/scripts/darwin/build.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -set -e - -# apt-get install -y clang cmake git patch python-is-python3 libssl-dev lzma-dev libxml2-dev xz-utils bzip2 cpio libbz2-dev zlib1g-dev libc++-dev libc++abi-dev build-essential -# dpkg -L libc++-dev -# dpkg -L libc++abi-dev - -export OSXCROSS_ROOT=$HOME/osxcross -export PATH=$OSXCROSS_ROOT/target/bin:$PATH -export SDKROOT=$OSXCROSS_ROOT/target/SDK/MacOSX11.3.sdk -# export CFLAGS="-isysroot $SDKROOT -stdlib=libc++" -# export CXXFLAGS="-isysroot $SDKROOT -stdlib=libc++" -# export LDFLAGS="-isysroot $SDKROOT -stdlib=libc++" -# Set up Go environment -export GO111MODULE=on -export CGO_ENABLED=1 - -VERSION=1.16.0 - -# Cross-compile for Darwin/amd64 -echo "Building for Darwin/amd64..." -CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=amd64 ~/sdk/go1.21.8/bin/go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${VERSION}" -o zboxcli-darwin-amd64 . - -# Cross-compile for Darwin/arm64 -echo "Building for Darwin/arm64..." -CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=arm64 ~/sdk/go1.21.8/bin/go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${VERSION}" -o zboxcli-darwin-arm64 . - -echo "Build completed." diff --git a/scripts/darwin/build2.sh b/scripts/darwin/build2.sh deleted file mode 100755 index 808f0885..00000000 --- a/scripts/darwin/build2.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -set -e - -SRC_DIR=$PWD -HOME_DIR=$HOME - -echo "PWD=$SRC_DIR , HOME=$HOME_DIR" - -# sudo apt-get update -sudo apt-get install -y clang cmake git patch python libssl-dev lzma-dev libxml2-dev xz-utils bzip2 cpio libbz2-dev zlib1g-dev - -cd $HOME_DIR -rm -rf $HOME_DIR/osxcross -git clone https://github.com/tpoechtrager/osxcross.git -cd osxcross/tarballs -wget https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX11.3.sdk.tar.xz -cd .. -export CC=clang -export CXX=clang++ -UNATTENDED=yes ./build.sh - -export OSXCROSS_ROOT=$PWD -export PATH=$OSXCROSS_ROOT/target/bin:$PATH -export GO111MODULE=on -export CGO_ENABLED=1 - -# Cross-compile for Darwin/amd64 -echo "Building for Darwin/amd64..." -CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=amd64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${VERSION} -linkmode 'external' -extldflags '-static'" -o zboxcli-darwin-amd64 . - -# Cross-compile for Darwin/arm64 -echo "Building for Darwin/arm64..." -CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=arm64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${VERSION} -linkmode 'external' -extldflags '-static'" -o zboxcli-darwin-arm64 . - -echo "Build completed." - -echo "osxcross setup success!" \ No newline at end of file From 817b7145a18b7a83f2d87d6018df78980d4c35d4 Mon Sep 17 00:00:00 2001 From: Arun Ramanathan Date: Tue, 20 Aug 2024 21:54:52 +0530 Subject: [PATCH 162/228] fix version str --- scripts/darwin/Dockerfile.build | 4 ++-- scripts/debian/Dockerfile.build | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/darwin/Dockerfile.build b/scripts/darwin/Dockerfile.build index 642e592e..620d768e 100755 --- a/scripts/darwin/Dockerfile.build +++ b/scripts/darwin/Dockerfile.build @@ -33,5 +33,5 @@ RUN go version RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" WORKDIR $GOPATH/src COPY . . -RUN CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=amd64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${VERSION}" -o $GOPATH/bin/zboxcli-darwin-amd64 . -RUN CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=arm64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${VERSION}" -o $GOPATH/bin/zboxcli-darwin-arm64 . +RUN CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=amd64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=v${VERSION}" -o $GOPATH/bin/zboxcli-darwin-amd64 . +RUN CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=arm64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=v${VERSION}" -o $GOPATH/bin/zboxcli-darwin-arm64 . diff --git a/scripts/debian/Dockerfile.build b/scripts/debian/Dockerfile.build index ff24b4c3..55951ffd 100644 --- a/scripts/debian/Dockerfile.build +++ b/scripts/debian/Dockerfile.build @@ -5,4 +5,4 @@ COPY go.mod go.sum . RUN go mod download COPY . . RUN go env -RUN CGO_ENABLED=1 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=${VERSION} -linkmode 'external' -extldflags '-static'" -o /zbox . +RUN CGO_ENABLED=1 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=v${VERSION} -linkmode 'external' -extldflags '-static'" -o /zbox . From 3580449d2e284b14a5987abffee9ff5bf42dec90 Mon Sep 17 00:00:00 2001 From: Arun Ramanathan Date: Fri, 23 Aug 2024 14:22:55 +0530 Subject: [PATCH 163/228] alternate darwin build --- .github/workflows/release.yml | 135 +++++++++++++++++++++++++++------- 1 file changed, 107 insertions(+), 28 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 62547adf..3ef429b6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -145,9 +145,9 @@ jobs: asset_path: ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}-linux-arm64.zip asset_name: ${{ env.APP_NAME }}-linux-arm64.zip asset_content_type: application/zip - - darwin: - runs-on: ubuntu-latest + + darwin: + runs-on: macos-latest needs: create_release env: SRC_DIR: ${{ github.workspace }}/src @@ -157,40 +157,31 @@ jobs: uses: actions/checkout@v2 with: path: ${{ env.SRC_DIR }} - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - with: - platforms: linux/amd64,linux/arm64 - + - name: Install zip uses: montudor/action-zip@v1 + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.21' + - name: Setup run : | mkdir -p ${{ env.OUTPUT_DIR }}/amd64 mkdir -p ${{ env.OUTPUT_DIR }}/arm64 cp ${{ env.SRC_DIR }}/cmd/config.yaml ${{ env.OUTPUT_DIR }}/amd64/ cp ${{ env.SRC_DIR }}/cmd/config.yaml ${{ env.OUTPUT_DIR }}/arm64/ - - - name: Build Docker image + + - name: Build ${{ env.APP_NAME }} for amd64 run: | - docker buildx create --use - docker buildx build \ - --platform linux/amd64 \ - --build-arg VERSION=${{ env.VERSION }} \ - --tag ${{ env.APP_NAME }} \ - --load \ - --output type=docker,dest=${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}.tar \ - -f ${{ env.SRC_DIR }}/scripts/darwin/Dockerfile.build ${{ env.SRC_DIR }} + cd ${{ env.SRC_DIR }} + CGO_CFLAGS="-mmacosx-version-min=12.0" CGO_LDFLAGS="-mmacosx-version-min=12.0" GOOS=darwin GOARCH=amd64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=v${{ env.VERSION }}" -o ${{ env.OUTPUT_DIR }}/amd64/${{ env.APP_NAME }} . - - name: Load image & Extract binary from container + - name: Build ${{ env.APP_NAME }} for arm64 run: | - docker load -i ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}.tar - CONTAINER_ID=$(docker create ${{ env.APP_NAME }}) - docker cp ${CONTAINER_ID}:/go/bin/zboxcli-darwin-amd64 ${{ env.OUTPUT_DIR }}/amd64/${{ env.APP_NAME }} - docker cp ${CONTAINER_ID}:/go/bin/zboxcli-darwin-arm64 ${{ env.OUTPUT_DIR }}/arm64/${{ env.APP_NAME }} - docker rm ${CONTAINER_ID} + cd ${{ env.SRC_DIR }} + CGO_CFLAGS="-mmacosx-version-min=12.0" CGO_LDFLAGS="-mmacosx-version-min=12.0" GOOS=darwin GOARCH=arm64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=v${{ env.VERSION }}" -o ${{ env.OUTPUT_DIR }}/arm64/${{ env.APP_NAME }} . - name: Create Zip File for darwin/amd64 run: | @@ -214,7 +205,7 @@ jobs: name: ${{ env.APP_NAME }}-darwin-arm64 path: ${{ env.OUTPUT_DIR }}/arm64/${{ env.APP_NAME }}-darwin-arm64.zip - - name: Upload Release Asset for Linux/amd64 + - name: Upload Release Asset for Darwin/amd64 uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -224,7 +215,7 @@ jobs: asset_name: ${{ env.APP_NAME }}-darwin-amd64.zip asset_content_type: application/zip - - name: Upload Release Asset for Linux/arm64 + - name: Upload Release Asset for Darwin/arm64 uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -232,4 +223,92 @@ jobs: upload_url: ${{ needs.create_release.outputs.upload_url }} asset_path: ${{ env.OUTPUT_DIR }}/arm64/${{ env.APP_NAME }}-darwin-arm64.zip asset_name: ${{ env.APP_NAME }}-darwin-arm64.zip - asset_content_type: application/zip \ No newline at end of file + asset_content_type: application/zip + + # darwin: + # runs-on: ubuntu-latest + # needs: create_release + # env: + # SRC_DIR: ${{ github.workspace }}/src + # OUTPUT_DIR: ${{ github.workspace }}/output + # steps: + # - name: Checkout code + # uses: actions/checkout@v2 + # with: + # path: ${{ env.SRC_DIR }} + + # - name: Set up QEMU + # uses: docker/setup-qemu-action@v3 + # with: + # platforms: linux/amd64,linux/arm64 + + # - name: Install zip + # uses: montudor/action-zip@v1 + + # - name: Setup + # run : | + # mkdir -p ${{ env.OUTPUT_DIR }}/amd64 + # mkdir -p ${{ env.OUTPUT_DIR }}/arm64 + # cp ${{ env.SRC_DIR }}/cmd/config.yaml ${{ env.OUTPUT_DIR }}/amd64/ + # cp ${{ env.SRC_DIR }}/cmd/config.yaml ${{ env.OUTPUT_DIR }}/arm64/ + + # - name: Build Docker image + # run: | + # docker buildx create --use + # docker buildx build \ + # --platform linux/amd64 \ + # --build-arg VERSION=${{ env.VERSION }} \ + # --tag ${{ env.APP_NAME }} \ + # --load \ + # --output type=docker,dest=${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}.tar \ + # -f ${{ env.SRC_DIR }}/scripts/darwin/Dockerfile.build ${{ env.SRC_DIR }} + + # - name: Load image & Extract binary from container + # run: | + # docker load -i ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}.tar + # CONTAINER_ID=$(docker create ${{ env.APP_NAME }}) + # docker cp ${CONTAINER_ID}:/go/bin/zboxcli-darwin-amd64 ${{ env.OUTPUT_DIR }}/amd64/${{ env.APP_NAME }} + # docker cp ${CONTAINER_ID}:/go/bin/zboxcli-darwin-arm64 ${{ env.OUTPUT_DIR }}/arm64/${{ env.APP_NAME }} + # docker rm ${CONTAINER_ID} + + # - name: Create Zip File for darwin/amd64 + # run: | + # cd ${{ env.OUTPUT_DIR }}/amd64 + # zip -qq -r ${{ env.APP_NAME }}-darwin-amd64.zip ${{ env.APP_NAME }} config.yaml + + # - name: Upload Zip for Darwin/amd64 + # uses: actions/upload-artifact@v3 + # with: + # name: ${{ env.APP_NAME }}-darwin-amd64 + # path: ${{ env.OUTPUT_DIR }}/amd64/${{ env.APP_NAME }}-darwin-amd64.zip + + # - name: Create Zip File for darwin/arm64 + # run: | + # cd ${{ env.OUTPUT_DIR }}/arm64 + # zip -qq -r ${{ env.APP_NAME }}-darwin-arm64.zip ${{ env.APP_NAME }} config.yaml + + # - name: Upload Zip for Darwin/arm64 + # uses: actions/upload-artifact@v3 + # with: + # name: ${{ env.APP_NAME }}-darwin-arm64 + # path: ${{ env.OUTPUT_DIR }}/arm64/${{ env.APP_NAME }}-darwin-arm64.zip + + # - name: Upload Release Asset for Linux/amd64 + # uses: actions/upload-release-asset@v1 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # upload_url: ${{ needs.create_release.outputs.upload_url }} + # asset_path: ${{ env.OUTPUT_DIR }}/amd64/${{ env.APP_NAME }}-darwin-amd64.zip + # asset_name: ${{ env.APP_NAME }}-darwin-amd64.zip + # asset_content_type: application/zip + + # - name: Upload Release Asset for Linux/arm64 + # uses: actions/upload-release-asset@v1 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # upload_url: ${{ needs.create_release.outputs.upload_url }} + # asset_path: ${{ env.OUTPUT_DIR }}/arm64/${{ env.APP_NAME }}-darwin-arm64.zip + # asset_name: ${{ env.APP_NAME }}-darwin-arm64.zip + # asset_content_type: application/zip \ No newline at end of file From 7bf630a7ef5f7809ee9c6b24c6aca036fe75f35d Mon Sep 17 00:00:00 2001 From: Arun Ramanathan Date: Fri, 23 Aug 2024 14:28:58 +0530 Subject: [PATCH 164/228] fix darwin release workflow --- .github/workflows/release.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3ef429b6..7cd7e86d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -157,9 +157,6 @@ jobs: uses: actions/checkout@v2 with: path: ${{ env.SRC_DIR }} - - - name: Install zip - uses: montudor/action-zip@v1 - name: Set up Go uses: actions/setup-go@v4 From 97695db79c87778d287382263e616078ff137d5f Mon Sep 17 00:00:00 2001 From: Arun Ramanathan Date: Fri, 23 Aug 2024 14:41:36 +0530 Subject: [PATCH 165/228] try arm64 --- .github/workflows/release.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7cd7e86d..a7f4b968 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -170,15 +170,15 @@ jobs: cp ${{ env.SRC_DIR }}/cmd/config.yaml ${{ env.OUTPUT_DIR }}/amd64/ cp ${{ env.SRC_DIR }}/cmd/config.yaml ${{ env.OUTPUT_DIR }}/arm64/ - - name: Build ${{ env.APP_NAME }} for amd64 - run: | - cd ${{ env.SRC_DIR }} - CGO_CFLAGS="-mmacosx-version-min=12.0" CGO_LDFLAGS="-mmacosx-version-min=12.0" GOOS=darwin GOARCH=amd64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=v${{ env.VERSION }}" -o ${{ env.OUTPUT_DIR }}/amd64/${{ env.APP_NAME }} . - - name: Build ${{ env.APP_NAME }} for arm64 run: | cd ${{ env.SRC_DIR }} CGO_CFLAGS="-mmacosx-version-min=12.0" CGO_LDFLAGS="-mmacosx-version-min=12.0" GOOS=darwin GOARCH=arm64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=v${{ env.VERSION }}" -o ${{ env.OUTPUT_DIR }}/arm64/${{ env.APP_NAME }} . + + - name: Build ${{ env.APP_NAME }} for amd64 + run: | + cd ${{ env.SRC_DIR }} + CGO_CFLAGS="-mmacosx-version-min=12.0" CGO_LDFLAGS="-mmacosx-version-min=12.0" GOOS=darwin GOARCH=amd64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=v${{ env.VERSION }}" -o ${{ env.OUTPUT_DIR }}/amd64/${{ env.APP_NAME }} . - name: Create Zip File for darwin/amd64 run: | From 57dcb12bb7a33b6bfa698eb2c1c3ccb7a105f329 Mon Sep 17 00:00:00 2001 From: Jayash Satolia Date: Sun, 25 Aug 2024 00:25:07 +0530 Subject: [PATCH 166/228] Fix --- cmd/root.go | 29 +++-------------------------- cmd/walletinfo.go | 10 +++++----- go.mod | 10 +++++----- go.sum | 24 ++++++++++++------------ 4 files changed, 25 insertions(+), 48 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index d45b2636..cb4f2b82 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -1,6 +1,7 @@ package cmd import ( + "context" "encoding/json" "fmt" "io/ioutil" @@ -12,7 +13,7 @@ import ( "github.com/spf13/cobra" - "github.com/0chain/gosdk/zboxcore/blockchain" + "github.com/0chain/gosdk/core/client" "github.com/0chain/zboxcli/util" "github.com/0chain/gosdk/core/zcncrypto" @@ -83,7 +84,6 @@ func initConfig() { if networkFile == "" { networkFile = "network.yaml" } - network, _ := conf.LoadNetworkFile(filepath.Join(configDir, networkFile)) // syncing loggers logger.SyncLoggers([]*logger.Logger{zcncore.GetLogger(), sdk.GetLogger()}) @@ -91,21 +91,8 @@ func initConfig() { // set the log file zcncore.SetLogFile("cmdlog.log", !bSilent) sdk.SetLogFile("cmdlog.log", !bSilent) - sdk.SetMinSubmit(cfg.MinSubmit) - - if network.IsValid() { - zcncore.SetNetwork(network.Miners, network.Sharders) - conf.InitChainNetwork(&conf.Network{ - Miners: network.Miners, - Sharders: network.Sharders, - }) - } - err = zcncore.InitZCNSDK(cfg.BlockWorker, cfg.SignatureScheme, - zcncore.WithChainID(cfg.ChainID), - zcncore.WithMinSubmit(cfg.MinSubmit), - zcncore.WithMinConfirmation(cfg.MinConfirmation), - zcncore.WithConfirmationChainLength(cfg.ConfirmationChainLength)) + err = client.Init(context.Background(), cfg) if err != nil { fmt.Println("Error initializing core SDK.", err) os.Exit(1) @@ -192,15 +179,5 @@ func initConfig() { os.Exit(1) } - // additional settings depending network latency - blockchain.SetMaxTxnQuery(cfg.MaxTxnQuery) - blockchain.SetQuerySleepTime(cfg.QuerySleepTime) - - conf.InitClientConfig(&cfg) - - if network.IsValid() { - sdk.SetNetwork(network.Miners, network.Sharders) - } - sdk.SetNumBlockDownloads(10) } diff --git a/cmd/walletinfo.go b/cmd/walletinfo.go index 36c54ca7..f7d44bcf 100644 --- a/cmd/walletinfo.go +++ b/cmd/walletinfo.go @@ -4,8 +4,8 @@ import ( "fmt" "os" + "github.com/0chain/gosdk/core/client" "github.com/0chain/gosdk/core/encryption" - "github.com/0chain/gosdk/zboxcore/client" "github.com/0chain/gosdk/zcncore" "github.com/0chain/zboxcli/util" @@ -48,11 +48,11 @@ var walletinfoCmd = &cobra.Command{ fmt.Println("Error getting the public key for encryption. ", err.Error()) return } - data[0] = []string{client.GetClientPublicKey(), client.GetClientID(), encPubKey} + data[0] = []string{client.PublicKey(), client.ClientID(), encPubKey} if doJSON { j := make(map[string]string) - j["client_public_key"] = client.GetClientPublicKey() - j["client_id"] = client.GetClientID() + j["client_public_key"] = client.PublicKey() + j["client_id"] = client.ClientID() j["encryption_public_key"] = encPubKey util.PrintJSON(j) return @@ -70,7 +70,7 @@ var signCmd = &cobra.Command{ Run: func(cmd *cobra.Command, args []string) { data, _ := cmd.Flags().GetString("data") if data == "" { - data = client.GetClientID() + data = client.ClientID() } else { data = encryption.Hash(data) } diff --git a/go.mod b/go.mod index 02b6f2bc..fc438071 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.17.0-RC1 + github.com/0chain/gosdk v1.17.0-RC4.0.20240824180725-75009fe9b380 github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 @@ -71,10 +71,10 @@ require ( go.uber.org/atomic v1.10.0 // indirect go.uber.org/multierr v1.9.0 // indirect go.uber.org/zap v1.24.0 // indirect - golang.org/x/crypto v0.17.0 // indirect - golang.org/x/sync v0.5.0 // indirect - golang.org/x/sys v0.15.0 // indirect - golang.org/x/text v0.14.0 // indirect + golang.org/x/crypto v0.26.0 // indirect + golang.org/x/sync v0.8.0 // indirect + golang.org/x/sys v0.23.0 // indirect + golang.org/x/text v0.17.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect diff --git a/go.sum b/go.sum index 63f848dc..49868967 100644 --- a/go.sum +++ b/go.sum @@ -40,8 +40,8 @@ github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565 h1:z+DtCR8mBsjPnEs github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565/go.mod h1:UyDC8Qyl5z9lGkCnf9RHJPMektnFX8XtCJZHXCCVj8E= 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.17.0-RC1 h1:D3OwgmfkqW/2FR+JtjmDx+KhlCINXL5/ZWNMbbPh4lc= -github.com/0chain/gosdk v1.17.0-RC1/go.mod h1:y7Ucdmv40VltqulZnncMNjNQ4piX5Dta5ujNmPmXnxg= +github.com/0chain/gosdk v1.17.0-RC4.0.20240824180725-75009fe9b380 h1:LiGPV/fYaFxv9pdlJtjVhCwKqapj2v1pAqH92meSyWA= +github.com/0chain/gosdk v1.17.0-RC4.0.20240824180725-75009fe9b380/go.mod h1:/PXIXnUGWUXqtl9vP3qHfvD+OD7f7TqS9GsWW7YjVGg= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= @@ -174,8 +174,8 @@ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= @@ -415,8 +415,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= -golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw= +golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -504,8 +504,8 @@ golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= -golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= +golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190124100055-b90733256f2e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -551,8 +551,8 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= +golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -560,8 +560,8 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3 golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= +golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= From 5916ff836dce4f2a1eb21cd6588fb0cf745a09b8 Mon Sep 17 00:00:00 2001 From: Jayash Satolia Date: Sun, 25 Aug 2024 00:52:02 +0530 Subject: [PATCH 167/228] Repo snapshots --- .github/workflows/system_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/system_tests.yml b/.github/workflows/system_tests.yml index da5f2094..232a38c3 100644 --- a/.github/workflows/system_tests.yml +++ b/.github/workflows/system_tests.yml @@ -28,7 +28,7 @@ jobs: uses: 0chain/actions/.github/workflows/manual_system_tests.yml@master with: zbox_cli_branch: ${{ github.ref_name }} - repo_snapshots_branch: ${{ github.event.inputs.repo_snapshots_branch }} + repo_snapshots_branch: fix/refactor-zboxcore test_file_filter: ${{ github.event.inputs.test_file_filter }} skip_tests: ${{ github.event.inputs.skip_tests }} run_smoke_tests: ${{ github.event.inputs.run_smoke_tests }} From 68e0de9c22f097cb527a7ba1cadac6ddbb9a2aab Mon Sep 17 00:00:00 2001 From: Arun Ramanathan Date: Sun, 25 Aug 2024 19:20:46 +0530 Subject: [PATCH 168/228] fix amd64 build --- .github/workflows/release.yml | 4 ++-- scripts/darwin/Dockerfile.build | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a7f4b968..90c35b8b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -173,12 +173,12 @@ jobs: - name: Build ${{ env.APP_NAME }} for arm64 run: | cd ${{ env.SRC_DIR }} - CGO_CFLAGS="-mmacosx-version-min=12.0" CGO_LDFLAGS="-mmacosx-version-min=12.0" GOOS=darwin GOARCH=arm64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=v${{ env.VERSION }}" -o ${{ env.OUTPUT_DIR }}/arm64/${{ env.APP_NAME }} . + CGO_ENABLED=1 CGO_CFLAGS="-mmacosx-version-min=12.0" CGO_LDFLAGS="-mmacosx-version-min=12.0" GOOS=darwin GOARCH=arm64 SDKROOT=$(xcrun --sdk macosx --show-sdk-path) go build -x -v -tags bn256 -ldflags "-X main.VersionStr=v${{ env.VERSION }}" -o ${{ env.OUTPUT_DIR }}/arm64/${{ env.APP_NAME }} . - name: Build ${{ env.APP_NAME }} for amd64 run: | cd ${{ env.SRC_DIR }} - CGO_CFLAGS="-mmacosx-version-min=12.0" CGO_LDFLAGS="-mmacosx-version-min=12.0" GOOS=darwin GOARCH=amd64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=v${{ env.VERSION }}" -o ${{ env.OUTPUT_DIR }}/amd64/${{ env.APP_NAME }} . + CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 SDKROOT=$(xcrun --sdk macosx --show-sdk-path) go build -x -v -tags bn256 -ldflags "-X main.VersionStr=v${{ env.VERSION }}" -o ${{ env.OUTPUT_DIR }}/amd64/${{ env.APP_NAME }} . - name: Create Zip File for darwin/amd64 run: | diff --git a/scripts/darwin/Dockerfile.build b/scripts/darwin/Dockerfile.build index 620d768e..f725b84b 100755 --- a/scripts/darwin/Dockerfile.build +++ b/scripts/darwin/Dockerfile.build @@ -21,7 +21,7 @@ ARG VERSION # setup Go ENV GOLANG_VERSION=1.21.12 -ENV GOLANG_DOWNLOAD_URL=https://golang.org/dl/go${GOLANG_VERSION}.linux-amd64.tar.gz +ENV GOLANG_DOWNLOAD_URL=https://golang.org/dl/go${GOLANG_VERSION}.linux-arm64.tar.gz RUN wget -q ${GOLANG_DOWNLOAD_URL} -O golang.tar.gz \ && tar -C /usr/local -xzf golang.tar.gz \ && rm golang.tar.gz From 40e7a1d9ca3954589ed34b94444462ed09b759ad Mon Sep 17 00:00:00 2001 From: Arun Ramanathan Date: Sun, 25 Aug 2024 20:28:04 +0530 Subject: [PATCH 169/228] refactor --- .github/workflows/release.yml | 88 --------------------------------- scripts/darwin/Dockerfile.build | 37 -------------- 2 files changed, 125 deletions(-) delete mode 100755 scripts/darwin/Dockerfile.build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 90c35b8b..f2f184e6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -221,91 +221,3 @@ jobs: asset_path: ${{ env.OUTPUT_DIR }}/arm64/${{ env.APP_NAME }}-darwin-arm64.zip asset_name: ${{ env.APP_NAME }}-darwin-arm64.zip asset_content_type: application/zip - - # darwin: - # runs-on: ubuntu-latest - # needs: create_release - # env: - # SRC_DIR: ${{ github.workspace }}/src - # OUTPUT_DIR: ${{ github.workspace }}/output - # steps: - # - name: Checkout code - # uses: actions/checkout@v2 - # with: - # path: ${{ env.SRC_DIR }} - - # - name: Set up QEMU - # uses: docker/setup-qemu-action@v3 - # with: - # platforms: linux/amd64,linux/arm64 - - # - name: Install zip - # uses: montudor/action-zip@v1 - - # - name: Setup - # run : | - # mkdir -p ${{ env.OUTPUT_DIR }}/amd64 - # mkdir -p ${{ env.OUTPUT_DIR }}/arm64 - # cp ${{ env.SRC_DIR }}/cmd/config.yaml ${{ env.OUTPUT_DIR }}/amd64/ - # cp ${{ env.SRC_DIR }}/cmd/config.yaml ${{ env.OUTPUT_DIR }}/arm64/ - - # - name: Build Docker image - # run: | - # docker buildx create --use - # docker buildx build \ - # --platform linux/amd64 \ - # --build-arg VERSION=${{ env.VERSION }} \ - # --tag ${{ env.APP_NAME }} \ - # --load \ - # --output type=docker,dest=${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}.tar \ - # -f ${{ env.SRC_DIR }}/scripts/darwin/Dockerfile.build ${{ env.SRC_DIR }} - - # - name: Load image & Extract binary from container - # run: | - # docker load -i ${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}.tar - # CONTAINER_ID=$(docker create ${{ env.APP_NAME }}) - # docker cp ${CONTAINER_ID}:/go/bin/zboxcli-darwin-amd64 ${{ env.OUTPUT_DIR }}/amd64/${{ env.APP_NAME }} - # docker cp ${CONTAINER_ID}:/go/bin/zboxcli-darwin-arm64 ${{ env.OUTPUT_DIR }}/arm64/${{ env.APP_NAME }} - # docker rm ${CONTAINER_ID} - - # - name: Create Zip File for darwin/amd64 - # run: | - # cd ${{ env.OUTPUT_DIR }}/amd64 - # zip -qq -r ${{ env.APP_NAME }}-darwin-amd64.zip ${{ env.APP_NAME }} config.yaml - - # - name: Upload Zip for Darwin/amd64 - # uses: actions/upload-artifact@v3 - # with: - # name: ${{ env.APP_NAME }}-darwin-amd64 - # path: ${{ env.OUTPUT_DIR }}/amd64/${{ env.APP_NAME }}-darwin-amd64.zip - - # - name: Create Zip File for darwin/arm64 - # run: | - # cd ${{ env.OUTPUT_DIR }}/arm64 - # zip -qq -r ${{ env.APP_NAME }}-darwin-arm64.zip ${{ env.APP_NAME }} config.yaml - - # - name: Upload Zip for Darwin/arm64 - # uses: actions/upload-artifact@v3 - # with: - # name: ${{ env.APP_NAME }}-darwin-arm64 - # path: ${{ env.OUTPUT_DIR }}/arm64/${{ env.APP_NAME }}-darwin-arm64.zip - - # - name: Upload Release Asset for Linux/amd64 - # uses: actions/upload-release-asset@v1 - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # with: - # upload_url: ${{ needs.create_release.outputs.upload_url }} - # asset_path: ${{ env.OUTPUT_DIR }}/amd64/${{ env.APP_NAME }}-darwin-amd64.zip - # asset_name: ${{ env.APP_NAME }}-darwin-amd64.zip - # asset_content_type: application/zip - - # - name: Upload Release Asset for Linux/arm64 - # uses: actions/upload-release-asset@v1 - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # with: - # upload_url: ${{ needs.create_release.outputs.upload_url }} - # asset_path: ${{ env.OUTPUT_DIR }}/arm64/${{ env.APP_NAME }}-darwin-arm64.zip - # asset_name: ${{ env.APP_NAME }}-darwin-arm64.zip - # asset_content_type: application/zip \ No newline at end of file diff --git a/scripts/darwin/Dockerfile.build b/scripts/darwin/Dockerfile.build deleted file mode 100755 index f725b84b..00000000 --- a/scripts/darwin/Dockerfile.build +++ /dev/null @@ -1,37 +0,0 @@ -# syntax=docker/dockerfile:latest - -FROM ubuntu:latest - -# setup osxcross -RUN apt-get update && apt-get install -y clang cmake git patch python-is-python3 libssl-dev lzma-dev libxml2-dev xz-utils bzip2 cpio libbz2-dev zlib1g-dev wget libc6-dev -RUN git clone https://github.com/tpoechtrager/osxcross.git -WORKDIR /osxcross/tarballs -RUN wget https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX11.3.sdk.tar.xz -WORKDIR /osxcross -ENV CC=clang -ENV CXX=clang++ -RUN UNATTENDED=yes OSX_VERSION_MIN=11.3 ./build.sh - -ENV OSXCROSS_ROOT=/osxcross -ENV PATH=$OSXCROSS_ROOT/target/bin:$PATH -ENV GO111MODULE=on -ENV CGO_ENABLED=1 - -ARG VERSION - -# setup Go -ENV GOLANG_VERSION=1.21.12 -ENV GOLANG_DOWNLOAD_URL=https://golang.org/dl/go${GOLANG_VERSION}.linux-arm64.tar.gz -RUN wget -q ${GOLANG_DOWNLOAD_URL} -O golang.tar.gz \ - && tar -C /usr/local -xzf golang.tar.gz \ - && rm golang.tar.gz -ENV GOPATH=/go -ENV PATH=$GOPATH/bin:/usr/local/go/bin:$PATH -# Verify Go installation -RUN go version - -RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" -WORKDIR $GOPATH/src -COPY . . -RUN CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=amd64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=v${VERSION}" -o $GOPATH/bin/zboxcli-darwin-amd64 . -RUN CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=arm64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=v${VERSION}" -o $GOPATH/bin/zboxcli-darwin-arm64 . From 58ac8fdb4dae62ea0f72c724f42bc59998738b0d Mon Sep 17 00:00:00 2001 From: Arun Ramanathan Date: Sun, 25 Aug 2024 23:38:08 +0530 Subject: [PATCH 170/228] provide macosx-version-min --- .github/workflows/release.yml | 2 +- cmd/root.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f2f184e6..55dc2906 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -178,7 +178,7 @@ jobs: - name: Build ${{ env.APP_NAME }} for amd64 run: | cd ${{ env.SRC_DIR }} - CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 SDKROOT=$(xcrun --sdk macosx --show-sdk-path) go build -x -v -tags bn256 -ldflags "-X main.VersionStr=v${{ env.VERSION }}" -o ${{ env.OUTPUT_DIR }}/amd64/${{ env.APP_NAME }} . + CGO_ENABLED=1 CGO_CFLAGS="-mmacosx-version-min=12.0" CGO_LDFLAGS="-mmacosx-version-min=12.0" GOOS=darwin GOARCH=amd64 SDKROOT=$(xcrun --sdk macosx --show-sdk-path) go build -x -v -tags bn256 -ldflags "-X main.VersionStr=v${{ env.VERSION }}" -o ${{ env.OUTPUT_DIR }}/amd64/${{ env.APP_NAME }} . - name: Create Zip File for darwin/amd64 run: | diff --git a/cmd/root.go b/cmd/root.go index 85998a12..e646ad2a 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -83,7 +83,7 @@ func initConfig() { cfg, err := conf.LoadConfigFile(filepath.Join(configDir, cfgFile)) if err != nil { fmt.Println("Can't read config:", err) - fmt.Println("WARNING: using default config...") + fmt.Println("using default config") fmt.Printf("config: %v", configStr) v := viper.New() v.SetConfigType("yaml") From c1e9227d0bbc3ff0b83b4ba65d8dfab1da05cac1 Mon Sep 17 00:00:00 2001 From: Arun Ramanathan Date: Fri, 30 Aug 2024 17:13:03 +0530 Subject: [PATCH 171/228] initial release workflow for windows --- .github/workflows/release.yml | 85 ++++++++++++++++++++++++++++++++++- 1 file changed, 83 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 55dc2906..b7b8edb0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -91,7 +91,7 @@ jobs: cd ${{ env.OUTPUT_DIR }} zip -qq -r ${{ env.APP_NAME }}-linux-amd64.zip ${{ env.APP_NAME }} config.yaml - - name: Upload Zip for Darwin/amd64 + - name: Upload Zip for linux/amd64 uses: actions/upload-artifact@v3 with: name: ${{ env.APP_NAME }}-linux-amd64 @@ -120,7 +120,7 @@ jobs: cd ${{ env.OUTPUT_DIR }} zip -qq -r ${{ env.APP_NAME }}-linux-arm64.zip ${{ env.APP_NAME }} config.yaml - - name: Upload Zip for Darwin/arm64 + - name: Upload Zip for linux/arm64 uses: actions/upload-artifact@v3 with: name: ${{ env.APP_NAME }}-linux-arm64 @@ -221,3 +221,84 @@ jobs: asset_path: ${{ env.OUTPUT_DIR }}/arm64/${{ env.APP_NAME }}-darwin-arm64.zip asset_name: ${{ env.APP_NAME }}-darwin-arm64.zip asset_content_type: application/zip + + windows: + runs-on: windows-latest + needs: create_release + env: + SRC_DIR: ${{ github.workspace }}\src + OUTPUT_DIR: ${{ github.workspace }}\output + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + path: ${{ env.SRC_DIR }} + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.21' + + - name: Install MinGW for CGo + run: | + choco install mingw + + - name: Setup + run : | + New-Item -ItemType Directory -Force -Path "${{ env.OUTPUT_DIR }}\amd64" + New-Item -ItemType Directory -Force -Path "${{ env.OUTPUT_DIR }}\arm64" + Copy-Item -Force -Path "${{ env.SRC_DIR }}\cmd\config.yaml" -Destination "${{ env.OUTPUT_DIR }}\amd64\" + Copy-Item -Force -Path "${{ env.SRC_DIR }}\cmd\config.yaml" -Destination "${{ env.OUTPUT_DIR }}\arm64\" + + - name: Build ${{ env.APP_NAME }} for amd64 + run: | + Set-Location -Path "${{ env.SRC_DIR }}" + CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ GOOS=windows GOARCH=amd64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=v${{ env.VERSION }}" -o ${{ env.OUTPUT_DIR }}\amd64\${{ env.APP_NAME }}.exe . + + - name: Build ${{ env.APP_NAME }} for arm64 + run: | + Set-Location -Path "${{ env.SRC_DIR }}" + CGO_ENABLED=1 CC=aarch64-w64-mingw32-gcc CXX=aarch64-w64-mingw32-g++ GOOS=windows GOARCH=arm64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=v${{ env.VERSION }}" -o ${{ env.OUTPUT_DIR }}\arm64\${{ env.APP_NAME }}.exe . + + - name: Create Zip File for windows/amd64 + run: | + Set-Location -Path "${{ env.OUTPUT_DIR }}\amd64" + Compress-Archive -Path ${{ env.APP_NAME }}.exe config.yaml -DestinationPath ${{ env.APP_NAME }}-windows-amd64.zip + + - name: Upload Zip for windows/amd64 + uses: actions/upload-artifact@v3 + with: + name: ${{ env.APP_NAME }}-windows-amd64 + path: ${{ env.OUTPUT_DIR }}\amd64\${{ env.APP_NAME }}-windows-amd64.zip + + - name: Create Zip File for windows/arm64 + run: | + Set-Location -Path "${{ env.OUTPUT_DIR }}\arm64" + Compress-Archive -Path ${{ env.APP_NAME }}.exe config.yaml -DestinationPath ${{ env.APP_NAME }}-windows-arm64.zip + + - name: Upload Zip for windows/arm64 + uses: actions/upload-artifact@v3 + with: + name: ${{ env.APP_NAME }}-windows-arm64 + path: ${{ env.OUTPUT_DIR }}\arm64\${{ env.APP_NAME }}-windows-arm64.zip + + - name: Upload Release Asset for windows/amd64 + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.create_release.outputs.upload_url }} + asset_path: ${{ env.OUTPUT_DIR }}\amd64\${{ env.APP_NAME }}-windows-amd64.zip + asset_name: ${{ env.APP_NAME }}-windows-amd64.zip + asset_content_type: application/zip + + - name: Upload Release Asset for windows/arm64 + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.create_release.outputs.upload_url }} + asset_path: ${{ env.OUTPUT_DIR }}\arm64\${{ env.APP_NAME }}-windows-arm64.zip + asset_name: ${{ env.APP_NAME }}-windows-arm64.zip + asset_content_type: application/zip + \ No newline at end of file From 7fbdd174c87f7b9da4bbc3ca535044f897d392e9 Mon Sep 17 00:00:00 2001 From: Arun Ramanathan Date: Fri, 30 Aug 2024 17:27:08 +0530 Subject: [PATCH 172/228] fix release workflow --- .github/workflows/release.yml | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b7b8edb0..40ab7284 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -253,13 +253,29 @@ jobs: - name: Build ${{ env.APP_NAME }} for amd64 run: | Set-Location -Path "${{ env.SRC_DIR }}" - CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ GOOS=windows GOARCH=amd64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=v${{ env.VERSION }}" -o ${{ env.OUTPUT_DIR }}\amd64\${{ env.APP_NAME }}.exe . + $env:CGO_ENABLED="1" + $env:CC="x86_64-w64-mingw32-gcc" + $env:CXX="x86_64-w64-mingw32-g++" + $env:GOOS="windows" + $env:GOARCH="amd64" + where x86_64-w64-mingw32-gcc + where x86_64-w64-mingw32-g++ + go build -x -v -tags bn256 -ldflags "-X main.VersionStr=v${{ env.VERSION }}" -o ${{ env.OUTPUT_DIR }}\amd64\${{ env.APP_NAME }}.exe . + shell: pwsh - name: Build ${{ env.APP_NAME }} for arm64 run: | Set-Location -Path "${{ env.SRC_DIR }}" - CGO_ENABLED=1 CC=aarch64-w64-mingw32-gcc CXX=aarch64-w64-mingw32-g++ GOOS=windows GOARCH=arm64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=v${{ env.VERSION }}" -o ${{ env.OUTPUT_DIR }}\arm64\${{ env.APP_NAME }}.exe . - + $env:CGO_ENABLED="1" + $env:CC="aarch64-w64-mingw32-gcc" + $env:CXX="aarch64-w64-mingw32-g++" + $env:GOOS="windows" + $env:GOARCH="arm64" + where aarch64-w64-mingw32-gcc + where aarch64-w64-mingw32-g++ + go build -x -v -tags bn256 -ldflags "-X main.VersionStr=v${{ env.VERSION }}" -o ${{ env.OUTPUT_DIR }}\arm64\${{ env.APP_NAME }}.exe . + shell: pwsh + - name: Create Zip File for windows/amd64 run: | Set-Location -Path "${{ env.OUTPUT_DIR }}\amd64" From 87758d3f433371f6524141eea0bc6f6fe41a3c57 Mon Sep 17 00:00:00 2001 From: Arun Ramanathan Date: Fri, 30 Aug 2024 17:54:07 +0530 Subject: [PATCH 173/228] remove arm64 build --- .github/workflows/release.yml | 39 ++--------------------------------- 1 file changed, 2 insertions(+), 37 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 40ab7284..06dd4b77 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -246,10 +246,8 @@ jobs: - name: Setup run : | New-Item -ItemType Directory -Force -Path "${{ env.OUTPUT_DIR }}\amd64" - New-Item -ItemType Directory -Force -Path "${{ env.OUTPUT_DIR }}\arm64" Copy-Item -Force -Path "${{ env.SRC_DIR }}\cmd\config.yaml" -Destination "${{ env.OUTPUT_DIR }}\amd64\" - Copy-Item -Force -Path "${{ env.SRC_DIR }}\cmd\config.yaml" -Destination "${{ env.OUTPUT_DIR }}\arm64\" - + - name: Build ${{ env.APP_NAME }} for amd64 run: | Set-Location -Path "${{ env.SRC_DIR }}" @@ -263,19 +261,6 @@ jobs: go build -x -v -tags bn256 -ldflags "-X main.VersionStr=v${{ env.VERSION }}" -o ${{ env.OUTPUT_DIR }}\amd64\${{ env.APP_NAME }}.exe . shell: pwsh - - name: Build ${{ env.APP_NAME }} for arm64 - run: | - Set-Location -Path "${{ env.SRC_DIR }}" - $env:CGO_ENABLED="1" - $env:CC="aarch64-w64-mingw32-gcc" - $env:CXX="aarch64-w64-mingw32-g++" - $env:GOOS="windows" - $env:GOARCH="arm64" - where aarch64-w64-mingw32-gcc - where aarch64-w64-mingw32-g++ - go build -x -v -tags bn256 -ldflags "-X main.VersionStr=v${{ env.VERSION }}" -o ${{ env.OUTPUT_DIR }}\arm64\${{ env.APP_NAME }}.exe . - shell: pwsh - - name: Create Zip File for windows/amd64 run: | Set-Location -Path "${{ env.OUTPUT_DIR }}\amd64" @@ -285,18 +270,7 @@ jobs: uses: actions/upload-artifact@v3 with: name: ${{ env.APP_NAME }}-windows-amd64 - path: ${{ env.OUTPUT_DIR }}\amd64\${{ env.APP_NAME }}-windows-amd64.zip - - - name: Create Zip File for windows/arm64 - run: | - Set-Location -Path "${{ env.OUTPUT_DIR }}\arm64" - Compress-Archive -Path ${{ env.APP_NAME }}.exe config.yaml -DestinationPath ${{ env.APP_NAME }}-windows-arm64.zip - - - name: Upload Zip for windows/arm64 - uses: actions/upload-artifact@v3 - with: - name: ${{ env.APP_NAME }}-windows-arm64 - path: ${{ env.OUTPUT_DIR }}\arm64\${{ env.APP_NAME }}-windows-arm64.zip + path: ${{ env.OUTPUT_DIR }}\amd64\${{ env.APP_NAME }}-windows-amd64.zip - name: Upload Release Asset for windows/amd64 uses: actions/upload-release-asset@v1 @@ -308,13 +282,4 @@ jobs: asset_name: ${{ env.APP_NAME }}-windows-amd64.zip asset_content_type: application/zip - - name: Upload Release Asset for windows/arm64 - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ needs.create_release.outputs.upload_url }} - asset_path: ${{ env.OUTPUT_DIR }}\arm64\${{ env.APP_NAME }}-windows-arm64.zip - asset_name: ${{ env.APP_NAME }}-windows-arm64.zip - asset_content_type: application/zip \ No newline at end of file From 7c4cd0f5c2287a2a0967162ae0902e8da034a22f Mon Sep 17 00:00:00 2001 From: Arun Ramanathan Date: Fri, 30 Aug 2024 18:03:01 +0530 Subject: [PATCH 174/228] fix release workflow --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 06dd4b77..ccf16cf4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -264,7 +264,7 @@ jobs: - name: Create Zip File for windows/amd64 run: | Set-Location -Path "${{ env.OUTPUT_DIR }}\amd64" - Compress-Archive -Path ${{ env.APP_NAME }}.exe config.yaml -DestinationPath ${{ env.APP_NAME }}-windows-amd64.zip + Compress-Archive -Path @("${{ env.APP_NAME }}.exe", "config.yaml") -DestinationPath ${{ env.APP_NAME }}-windows-amd64.zip - name: Upload Zip for windows/amd64 uses: actions/upload-artifact@v3 From f7a10e7b47e64d990d58eb5e0bbf4cccf36ec90e Mon Sep 17 00:00:00 2001 From: Arun Ramanathan Date: Sun, 1 Sep 2024 18:11:55 +0530 Subject: [PATCH 175/228] initial distribute workflow through choco --- ...zboxcli.yml => distribute-zboxcli-apt.yml} | 2 +- .../workflows/distribute-zboxcli-choco.yml | 90 +++++++++++++++++++ .github/workflows/release.yml | 4 +- 3 files changed, 93 insertions(+), 3 deletions(-) rename .github/workflows/{distribute-zboxcli.yml => distribute-zboxcli-apt.yml} (99%) create mode 100644 .github/workflows/distribute-zboxcli-choco.yml diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli-apt.yml similarity index 99% rename from .github/workflows/distribute-zboxcli.yml rename to .github/workflows/distribute-zboxcli-apt.yml index b930bdf5..eb5a170b 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli-apt.yml @@ -1,4 +1,4 @@ -name: Build, Distribute and Test zbox +name: Distribute zbox using apt on: workflow_dispatch: diff --git a/.github/workflows/distribute-zboxcli-choco.yml b/.github/workflows/distribute-zboxcli-choco.yml new file mode 100644 index 00000000..0a748ef1 --- /dev/null +++ b/.github/workflows/distribute-zboxcli-choco.yml @@ -0,0 +1,90 @@ +name: Distribute zbox using choco + +on: + # Remove push trigger once tested + push: + branches: + - windows-build + + workflow_dispatch: + inputs: + version: + description: 'Version of zbox to release' + required: true + default: '1.0.0' + +env: + APP_NAME: zbox + PACKAGE_ID: zbox + APP_VERSION: '1.17.0' # Update to ${{ github.event.inputs.version }} once tested + GO_VERSION: '1.21' + +jobs: + build: + runs-on: windows-latest + env: + SRC_DIR: ${{ github.workspace }}\src + OUTPUT_DIR: ${{ github.workspace }}\output + PACKAGE_DIR: ${{ github.workspace }}\package + + steps: + - name: Checkout Code + uses: actions/checkout@v3 + with: + path: ${{ env.SRC_DIR }} + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: ${{ env.GO_VERSION }} + + - name: Install MinGW for CGo + run: | + choco install mingw + + - name: Setup + run : | + New-Item -ItemType Directory -Force -Path "${{ env.OUTPUT_DIR }}\amd64" + New-Item -ItemType Directory -Force -Path "${{ env.PACKAGE_DIR }}" + Copy-Item -Force -Path "${{ env.SRC_DIR }}\cmd\config.yaml" -Destination "${{ env.OUTPUT_DIR }}\amd64\" + + - name: Build ${{ env.APP_NAME }} for amd64 + run: | + Set-Location -Path "${{ env.SRC_DIR }}" + $env:CGO_ENABLED="1" + $env:CC="x86_64-w64-mingw32-gcc" + $env:CXX="x86_64-w64-mingw32-g++" + $env:GOOS="windows" + $env:GOARCH="amd64" + where x86_64-w64-mingw32-gcc + where x86_64-w64-mingw32-g++ + go build -x -v -tags bn256 -ldflags "-X main.VersionStr=v${{ env.APP_VERSION }}" -o ${{ env.OUTPUT_DIR }}\amd64\${{ env.APP_NAME }}.exe . + shell: pwsh + + - name: Create .nuspec file + run: | + Set-Location "${{ env.PACKAGE_DIR }}" + $content = @" + + + + ${{ env.PACKAGE_ID }} + ${{ env.APP_VERSION }} + https://github.com/0chain/zboxcli/blob/staging/LICENSE + https://github.com/0chain/zboxcli + zbox is a command line interface (CLI) tool to understand the capabilities of Züs dStorage and prototype your app. + + + + + + "@ + Set-Content -Path "${{ env.PACKAGE_ID }}.nuspec" -Value $content + + - name: Pack Chocolatey Package + run: | + choco pack ${{ env.PACKAGE_ID }}.nuspec + + - name: Push Chocolatey Package + run: | + choco push ${{ env.PACKAGE_ID }}.${{ env.APP_VERSION }}.nupkg --source https://push.chocolatey.org/ -k ${{ secrets.CHOCOLATEY_API_KEY }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ccf16cf4..2a3a3c37 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -161,7 +161,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: '1.21' + go-version: ${{ env.GO_VERSION }} - name: Setup run : | @@ -237,7 +237,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: '1.21' + go-version: ${{ env.GO_VERSION }} - name: Install MinGW for CGo run: | From 0bb45f6e538ac2cc6e1fea3803aa1dbfa9dc18c4 Mon Sep 17 00:00:00 2001 From: Arun Ramanathan Date: Sun, 1 Sep 2024 18:25:42 +0530 Subject: [PATCH 176/228] fix distribute workflow --- .github/workflows/distribute-zboxcli-choco.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/distribute-zboxcli-choco.yml b/.github/workflows/distribute-zboxcli-choco.yml index 0a748ef1..c98ad06e 100644 --- a/.github/workflows/distribute-zboxcli-choco.yml +++ b/.github/workflows/distribute-zboxcli-choco.yml @@ -63,7 +63,7 @@ jobs: - name: Create .nuspec file run: | - Set-Location "${{ env.PACKAGE_DIR }}" + Set-Location -Path "${{ env.PACKAGE_DIR }}" $content = @" @@ -79,10 +79,14 @@ jobs: "@ + + New-Item -Path "${{ env.PACKAGE_ID }}.nuspec" -ItemType File -Force Set-Content -Path "${{ env.PACKAGE_ID }}.nuspec" -Value $content - name: Pack Chocolatey Package run: | + Get-Location + Get-ChildItem "${{ env.PACKAGE_DIR }}" choco pack ${{ env.PACKAGE_ID }}.nuspec - name: Push Chocolatey Package From b669b279cddfc6eaa7d1127c802b5d6e6853f778 Mon Sep 17 00:00:00 2001 From: Yaroslav Svitlytskyi Date: Sun, 1 Sep 2024 21:08:17 +0200 Subject: [PATCH 177/228] fix: added wallet information initialization --- cmd/root.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmd/root.go b/cmd/root.go index e646ad2a..08b3c33f 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -211,6 +211,13 @@ func initConfig() { os.Exit(1) } + // set wallet info along whether split key is used + err = zcncore.SetWalletInfo(walletJSON, false) + if err != nil { + fmt.Println("Error in wallet info initialization", err) + os.Exit(1) + } + // additional settings depending network latency blockchain.SetMaxTxnQuery(cfg.MaxTxnQuery) blockchain.SetQuerySleepTime(cfg.QuerySleepTime) From a3417dd97a9fc1144071bfacd4b6d87f01b0160e Mon Sep 17 00:00:00 2001 From: dabasov Date: Sun, 1 Sep 2024 23:28:08 +0300 Subject: [PATCH 178/228] updated gosdk --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 32c52f4e..0f4801a3 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.17.0-RC1 + github.com/0chain/gosdk v1.17.0 github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 diff --git a/go.sum b/go.sum index 63f848dc..6c034b26 100644 --- a/go.sum +++ b/go.sum @@ -40,8 +40,8 @@ github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565 h1:z+DtCR8mBsjPnEs github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565/go.mod h1:UyDC8Qyl5z9lGkCnf9RHJPMektnFX8XtCJZHXCCVj8E= 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.17.0-RC1 h1:D3OwgmfkqW/2FR+JtjmDx+KhlCINXL5/ZWNMbbPh4lc= -github.com/0chain/gosdk v1.17.0-RC1/go.mod h1:y7Ucdmv40VltqulZnncMNjNQ4piX5Dta5ujNmPmXnxg= +github.com/0chain/gosdk v1.17.0 h1:W/PWNCYv6BamFtMBokgylbGD/sc/P6C5uicrNVY1aYI= +github.com/0chain/gosdk v1.17.0/go.mod h1:y7Ucdmv40VltqulZnncMNjNQ4piX5Dta5ujNmPmXnxg= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= From ae8b2f8cc121183d2099fa27b7a662666eea8b0a Mon Sep 17 00:00:00 2001 From: dabasov Date: Sun, 1 Sep 2024 23:38:32 +0300 Subject: [PATCH 179/228] updated gosdk --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 0f4801a3..eaf29b2e 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.17.0 + github.com/0chain/gosdk v1.17.1 github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 diff --git a/go.sum b/go.sum index 6c034b26..4b257843 100644 --- a/go.sum +++ b/go.sum @@ -40,8 +40,8 @@ github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565 h1:z+DtCR8mBsjPnEs github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565/go.mod h1:UyDC8Qyl5z9lGkCnf9RHJPMektnFX8XtCJZHXCCVj8E= 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.17.0 h1:W/PWNCYv6BamFtMBokgylbGD/sc/P6C5uicrNVY1aYI= -github.com/0chain/gosdk v1.17.0/go.mod h1:y7Ucdmv40VltqulZnncMNjNQ4piX5Dta5ujNmPmXnxg= +github.com/0chain/gosdk v1.17.1 h1:nyUN2BY/Hcd31ljwK3ITCogjBeEVov/3YTEkDcENecM= +github.com/0chain/gosdk v1.17.1/go.mod h1:y7Ucdmv40VltqulZnncMNjNQ4piX5Dta5ujNmPmXnxg= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= From 0ca5200082937c2363550b96976f6322e270e76c Mon Sep 17 00:00:00 2001 From: Arun Ramanathan Date: Mon, 2 Sep 2024 18:00:39 +0530 Subject: [PATCH 180/228] fix distribute wokflow --- .github/workflows/distribute-zboxcli-choco.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/distribute-zboxcli-choco.yml b/.github/workflows/distribute-zboxcli-choco.yml index c98ad06e..79a5b683 100644 --- a/.github/workflows/distribute-zboxcli-choco.yml +++ b/.github/workflows/distribute-zboxcli-choco.yml @@ -64,6 +64,9 @@ jobs: - name: Create .nuspec file run: | Set-Location -Path "${{ env.PACKAGE_DIR }}" + Write-Host "Current Directory After Set-Location:" + Get-Location + Write-Host "Creating .nuspec file..." $content = @" @@ -86,7 +89,9 @@ jobs: - name: Pack Chocolatey Package run: | Get-Location - Get-ChildItem "${{ env.PACKAGE_DIR }}" + Get-ChildItem "${{ env.PACKAGE_DIR }}" + Move-Item -Path "${{ env.PACKAGE_ID }}.nuspec" -Destination "${{ env.PACKAGE_DIR }}" + Set-Location -Path "${{ env.PACKAGE_DIR }}" choco pack ${{ env.PACKAGE_ID }}.nuspec - name: Push Chocolatey Package From de9c4351a09e7b1e4ce7d6f292fc215abfe09aa6 Mon Sep 17 00:00:00 2001 From: Arun Ramanathan Date: Mon, 2 Sep 2024 18:22:49 +0530 Subject: [PATCH 181/228] fix distribute release workflow --- .../workflows/distribute-zboxcli-choco.yml | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/.github/workflows/distribute-zboxcli-choco.yml b/.github/workflows/distribute-zboxcli-choco.yml index 79a5b683..d1de1ff4 100644 --- a/.github/workflows/distribute-zboxcli-choco.yml +++ b/.github/workflows/distribute-zboxcli-choco.yml @@ -64,9 +64,10 @@ jobs: - name: Create .nuspec file run: | Set-Location -Path "${{ env.PACKAGE_DIR }}" - Write-Host "Current Directory After Set-Location:" - Get-Location - Write-Host "Creating .nuspec file..." + $location = Get-Location + Write-Host "Current Directory: $location" + $files = Get-ChildItem "${{ env.PACKAGE_DIR }}" + Write-Host "Files in Directory: $files" $content = @" @@ -82,17 +83,22 @@ jobs: "@ + + $content | Out-File -FilePath "zbox.nuspec" -Encoding utf8 + Write-Host "Created .nuspec file:" + Get-ChildItem "${{ env.PACKAGE_DIR }}" - New-Item -Path "${{ env.PACKAGE_ID }}.nuspec" -ItemType File -Force - Set-Content -Path "${{ env.PACKAGE_ID }}.nuspec" -Value $content + $fileContent = Get-Content -Path "zbox.nuspec" + Write-Host "File Content: $fileContent" - name: Pack Chocolatey Package run: | - Get-Location - Get-ChildItem "${{ env.PACKAGE_DIR }}" - Move-Item -Path "${{ env.PACKAGE_ID }}.nuspec" -Destination "${{ env.PACKAGE_DIR }}" - Set-Location -Path "${{ env.PACKAGE_DIR }}" - choco pack ${{ env.PACKAGE_ID }}.nuspec + Set-Location -Path "${{ env.PACKAGE_DIR }}" + $location = Get-Location + Write-Host "Current Directory: $location" + $files = Get-ChildItem "${{ env.PACKAGE_DIR }}" + Write-Host "Files in Directory: $files" + choco pack ${{ env.PACKAGE_ID }}.nuspec - name: Push Chocolatey Package run: | From e7c9e9427cfabfb05f9e12072cd68d10ab2a8fa7 Mon Sep 17 00:00:00 2001 From: Arun Ramanathan Date: Tue, 3 Sep 2024 09:54:34 +0530 Subject: [PATCH 182/228] fix distribute workflow --- .github/workflows/distribute-zboxcli-choco.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/distribute-zboxcli-choco.yml b/.github/workflows/distribute-zboxcli-choco.yml index d1de1ff4..bcbd82c6 100644 --- a/.github/workflows/distribute-zboxcli-choco.yml +++ b/.github/workflows/distribute-zboxcli-choco.yml @@ -74,6 +74,8 @@ jobs: ${{ env.PACKAGE_ID }} ${{ env.APP_VERSION }} + Saswata Basu + Saswata Basu https://github.com/0chain/zboxcli/blob/staging/LICENSE https://github.com/0chain/zboxcli zbox is a command line interface (CLI) tool to understand the capabilities of Züs dStorage and prototype your app. From 30fb79e81281586eaa917ce60b46e7adfe7212b1 Mon Sep 17 00:00:00 2001 From: Arun Ramanathan Date: Tue, 3 Sep 2024 10:02:16 +0530 Subject: [PATCH 183/228] fix distribute workflow --- .github/workflows/distribute-zboxcli-choco.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/distribute-zboxcli-choco.yml b/.github/workflows/distribute-zboxcli-choco.yml index bcbd82c6..d0909444 100644 --- a/.github/workflows/distribute-zboxcli-choco.yml +++ b/.github/workflows/distribute-zboxcli-choco.yml @@ -104,4 +104,9 @@ jobs: - name: Push Chocolatey Package run: | - choco push ${{ env.PACKAGE_ID }}.${{ env.APP_VERSION }}.nupkg --source https://push.chocolatey.org/ -k ${{ secrets.CHOCOLATEY_API_KEY }} + Set-Location -Path "${{ env.PACKAGE_DIR }}" + $location = Get-Location + Write-Host "Current Directory: $location" + $files = Get-ChildItem "${{ env.PACKAGE_DIR }}" + Write-Host "Files in Directory: $files" + choco push ${{ env.PACKAGE_ID }}.${{ env.APP_VERSION }}.nupkg --source https://push.chocolatey.org/ -k ${{ secrets.CHOCOLATEY_API_KEY }} From b38ac25010aab47ac3a4f16dc38f399927166ecb Mon Sep 17 00:00:00 2001 From: yash10019coder Date: Thu, 5 Sep 2024 20:01:27 +0530 Subject: [PATCH 184/228] update gosdk v1.17.3 --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index eaf29b2e..44fdd382 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.17.1 + github.com/0chain/gosdk v1.17.3 github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 diff --git a/go.sum b/go.sum index 4b257843..0474fc2d 100644 --- a/go.sum +++ b/go.sum @@ -42,6 +42,8 @@ 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.17.1 h1:nyUN2BY/Hcd31ljwK3ITCogjBeEVov/3YTEkDcENecM= github.com/0chain/gosdk v1.17.1/go.mod h1:y7Ucdmv40VltqulZnncMNjNQ4piX5Dta5ujNmPmXnxg= +github.com/0chain/gosdk v1.17.3 h1:nL6x1saSwTku1UFDYoX/uKJO57VQTgowp6id+7UHb7g= +github.com/0chain/gosdk v1.17.3/go.mod h1:y7Ucdmv40VltqulZnncMNjNQ4piX5Dta5ujNmPmXnxg= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= From 7dc3982379b6ba94c0f70ec331d2e999dab0c677 Mon Sep 17 00:00:00 2001 From: Jayash Satolia Date: Fri, 6 Sep 2024 00:55:58 +0530 Subject: [PATCH 185/228] go mod tidy --- go.sum | 2 -- 1 file changed, 2 deletions(-) diff --git a/go.sum b/go.sum index 0474fc2d..8d53024a 100644 --- a/go.sum +++ b/go.sum @@ -40,8 +40,6 @@ github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565 h1:z+DtCR8mBsjPnEs github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565/go.mod h1:UyDC8Qyl5z9lGkCnf9RHJPMektnFX8XtCJZHXCCVj8E= 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.17.1 h1:nyUN2BY/Hcd31ljwK3ITCogjBeEVov/3YTEkDcENecM= -github.com/0chain/gosdk v1.17.1/go.mod h1:y7Ucdmv40VltqulZnncMNjNQ4piX5Dta5ujNmPmXnxg= github.com/0chain/gosdk v1.17.3 h1:nL6x1saSwTku1UFDYoX/uKJO57VQTgowp6id+7UHb7g= github.com/0chain/gosdk v1.17.3/go.mod h1:y7Ucdmv40VltqulZnncMNjNQ4piX5Dta5ujNmPmXnxg= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= From b33f30040a5c8285e37285fb08f0cb132c33de28 Mon Sep 17 00:00:00 2001 From: Arun Ramanathan Date: Fri, 6 Sep 2024 16:28:52 +0530 Subject: [PATCH 186/228] resolve requirements --- .../workflows/distribute-zboxcli-choco.yml | 84 +++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/.github/workflows/distribute-zboxcli-choco.yml b/.github/workflows/distribute-zboxcli-choco.yml index d0909444..6c9c6dbc 100644 --- a/.github/workflows/distribute-zboxcli-choco.yml +++ b/.github/workflows/distribute-zboxcli-choco.yml @@ -61,6 +61,66 @@ jobs: go build -x -v -tags bn256 -ldflags "-X main.VersionStr=v${{ env.APP_VERSION }}" -o ${{ env.OUTPUT_DIR }}\amd64\${{ env.APP_NAME }}.exe . shell: pwsh + - name: Generate SHA256 Checksum + id: checksum + shell: pwsh + run: | + $checksum = Get-FileHash "${{ env.OUTPUT_DIR }}\amd64\${{ env.APP_NAME }}.exe" -Algorithm SHA256 + Write-Output "::set-output name=checksum::$($checksum.Hash)" + + - name: Create VERIFICATION.txt + shell: pwsh + run: | + Set-Location -Path "${{ env.PACKAGE_DIR }}" + $location = Get-Location + Write-Host "Current Directory: $location" + $files = Get-ChildItem "${{ env.PACKAGE_DIR }}" + Write-Host "Files in Directory: $files" + + $verificationContent = @" + The binaries in this package were sourced from the official https://github.com/0chain/zboxcli repository. + + Verification Steps: + 1. The SHA256 checksum of the binary was calculated. + 2. Users can verify the binary themselves by running the following command: + `Get-FileHash -Algorithm SHA256 ${{ env.APP_NAME }}.exe` + + Expected checksum: + ${{ steps.checksum.outputs.checksum }} + "@ + + $verificationContent | Out-File -FilePath "VERIFICATION.txt" -Encoding utf8 + Write-Host "Created VERIFICATION.txt file" + Get-ChildItem "${{ env.PACKAGE_DIR }}" + + $fileContent = Get-Content -Path "VERIFICATION.txt" + Write-Host "File Content: $fileContent" + + - name: Create Chocolatey Install Script + run: | + Set-Location -Path "${{ env.PACKAGE_DIR }}" + $location = Get-Location + Write-Host "Current Directory: $location" + $files = Get-ChildItem "${{ env.PACKAGE_DIR }}" + Write-Host "Files in Directory: $files" + + $content = @' + $installDir = "$(Get-ToolsLocation)\zbox" + $envPath = [System.Environment]::GetEnvironmentVariable('Path', 'Machine') + + if ($envPath -notlike "*$installDir*") { + Write-Host "Adding $installDir to PATH" + [System.Environment]::SetEnvironmentVariable('Path', "$envPath;$installDir", 'Machine') + } + '@ + + $content | Out-File -FilePath "chocolateyInstall.ps1" -Encoding utf8 + Write-Host "Created chocolateyInstall.ps1 file" + Get-ChildItem "${{ env.PACKAGE_DIR }}" + + $fileContent = Get-Content -Path "chocolateyInstall.ps1" + Write-Host "File Content: $fileContent" + - name: Create .nuspec file run: | Set-Location -Path "${{ env.PACKAGE_DIR }}" @@ -76,12 +136,20 @@ jobs: ${{ env.APP_VERSION }} Saswata Basu Saswata Basu + zbox cloud storage cli windows golang https://github.com/0chain/zboxcli/blob/staging/LICENSE https://github.com/0chain/zboxcli + https://github.com/0chain/zboxcli + https://github.com/0chain/zboxcli/releases/latest + zbox is a command line interface (CLI) tool to understand the capabilities of Züs dStorage and prototype your app. zbox is a command line interface (CLI) tool to understand the capabilities of Züs dStorage and prototype your app. + zbox CLI + + + "@ @@ -110,3 +178,19 @@ jobs: $files = Get-ChildItem "${{ env.PACKAGE_DIR }}" Write-Host "Files in Directory: $files" choco push ${{ env.PACKAGE_ID }}.${{ env.APP_VERSION }}.nupkg --source https://push.chocolatey.org/ -k ${{ secrets.CHOCOLATEY_API_KEY }} + + verify-install: + runs-on: windows-latest + needs: build + + steps: + - name: Install zbox via Chocolatey + run: choco install zbox --version {{ env.APP_VERSION }} --source="https://push.chocolatey.org/" + + - name: Verify zbox Installation + run: | + if (Get-Command zbox -ErrorAction SilentlyContinue) { + Write-Output "zbox is installed successfully!" + } else { + throw "zbox installation failed!" + } From e00e7ab62d765c5cb08e82c0be1eef0da24d8cd0 Mon Sep 17 00:00:00 2001 From: Jayash Satolia Date: Sun, 8 Sep 2024 01:16:19 +0530 Subject: [PATCH 187/228] Fix --- cmd/root.go | 2 ++ go.mod | 4 ++-- go.sum | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index cb4f2b82..b5c273a9 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -127,6 +127,8 @@ func initConfig() { walletFilePath = configDir + string(os.PathSeparator) + "wallet.json" } + zcncore.InitSignatureScheme("bls0chain") + if _, err = os.Stat(walletFilePath); os.IsNotExist(err) { wallet, err := zcncore.CreateWalletOffline() if err != nil { diff --git a/go.mod b/go.mod index fea242d8..dd3460fa 100644 --- a/go.mod +++ b/go.mod @@ -4,12 +4,11 @@ go 1.21 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.17.0-RC4.0.20240824180725-75009fe9b380 + github.com/0chain/gosdk v1.17.4-0.20240907144423-14c6c99c435b github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 github.com/spf13/pflag v1.0.5 - github.com/spf13/viper v1.15.0 gopkg.in/cheggaaa/pb.v1 v1.0.28 ) @@ -58,6 +57,7 @@ require ( github.com/spf13/afero v1.9.3 // indirect github.com/spf13/cast v1.5.0 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect + github.com/spf13/viper v1.15.0 // indirect github.com/subosito/gotenv v1.4.2 // indirect github.com/tinylib/msgp v1.1.6 // indirect github.com/tklauser/go-sysconf v0.3.11 // indirect diff --git a/go.sum b/go.sum index 49868967..fa7155ff 100644 --- a/go.sum +++ b/go.sum @@ -40,8 +40,8 @@ github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565 h1:z+DtCR8mBsjPnEs github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565/go.mod h1:UyDC8Qyl5z9lGkCnf9RHJPMektnFX8XtCJZHXCCVj8E= 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.17.0-RC4.0.20240824180725-75009fe9b380 h1:LiGPV/fYaFxv9pdlJtjVhCwKqapj2v1pAqH92meSyWA= -github.com/0chain/gosdk v1.17.0-RC4.0.20240824180725-75009fe9b380/go.mod h1:/PXIXnUGWUXqtl9vP3qHfvD+OD7f7TqS9GsWW7YjVGg= +github.com/0chain/gosdk v1.17.4-0.20240907144423-14c6c99c435b h1:o4YvZ1+OofKMZGo8er3VnkLkcimAQ5Xm3N+tFBfjApE= +github.com/0chain/gosdk v1.17.4-0.20240907144423-14c6c99c435b/go.mod h1:/PXIXnUGWUXqtl9vP3qHfvD+OD7f7TqS9GsWW7YjVGg= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= From 2139c3a1de246047d4ed12d41760d0d2f451774c Mon Sep 17 00:00:00 2001 From: Arun Ramanathan Date: Mon, 9 Sep 2024 18:54:29 +0530 Subject: [PATCH 188/228] refactor --- .../workflows/distribute-zboxcli-choco.yml | 23 +------------------ 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/.github/workflows/distribute-zboxcli-choco.yml b/.github/workflows/distribute-zboxcli-choco.yml index 6c9c6dbc..f6e6fc4a 100644 --- a/.github/workflows/distribute-zboxcli-choco.yml +++ b/.github/workflows/distribute-zboxcli-choco.yml @@ -1,11 +1,6 @@ name: Distribute zbox using choco on: - # Remove push trigger once tested - push: - branches: - - windows-build - workflow_dispatch: inputs: version: @@ -16,7 +11,7 @@ on: env: APP_NAME: zbox PACKAGE_ID: zbox - APP_VERSION: '1.17.0' # Update to ${{ github.event.inputs.version }} once tested + APP_VERSION: ${{ github.event.inputs.version }} GO_VERSION: '1.21' jobs: @@ -178,19 +173,3 @@ jobs: $files = Get-ChildItem "${{ env.PACKAGE_DIR }}" Write-Host "Files in Directory: $files" choco push ${{ env.PACKAGE_ID }}.${{ env.APP_VERSION }}.nupkg --source https://push.chocolatey.org/ -k ${{ secrets.CHOCOLATEY_API_KEY }} - - verify-install: - runs-on: windows-latest - needs: build - - steps: - - name: Install zbox via Chocolatey - run: choco install zbox --version {{ env.APP_VERSION }} --source="https://push.chocolatey.org/" - - - name: Verify zbox Installation - run: | - if (Get-Command zbox -ErrorAction SilentlyContinue) { - Write-Output "zbox is installed successfully!" - } else { - throw "zbox installation failed!" - } From fb615c94e71eceb5fef7621a048b7967c1fdb151 Mon Sep 17 00:00:00 2001 From: shahnawaz-creator <117025384+shahnawaz-creator@users.noreply.github.com> Date: Tue, 10 Sep 2024 02:50:20 +0530 Subject: [PATCH 189/228] Update LICENSE --- LICENSE | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/LICENSE b/LICENSE index 5aa4265b..466ba208 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,28 @@ -MIT License +Non-compete BSD-3-Clause -Copyright (c) 2019 0Chain +Copyright © 2019 0Chain,LLC. -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +Redistribution and use in source and binary forms, with or without modification, are permitted provided +that the following conditions are met: -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software +without specific prior written permission. + +4. It is not permitted to provide any offering that competes with the source code and binary form +or any other offering the licensor provides using the source code and binary form. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT +SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR +TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. From 70c1baa63e1949d1845012da1089df9ed20589ba Mon Sep 17 00:00:00 2001 From: Jayash Satolia Date: Wed, 11 Sep 2024 18:43:17 +0530 Subject: [PATCH 190/228] Fix --- cmd/root.go | 2 -- cmd/storage.go | 11 ++++++----- go.mod | 2 +- go.sum | 4 ++-- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index b5c273a9..cb4f2b82 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -127,8 +127,6 @@ func initConfig() { walletFilePath = configDir + string(os.PathSeparator) + "wallet.json" } - zcncore.InitSignatureScheme("bls0chain") - if _, err = os.Stat(walletFilePath); os.IsNotExist(err) { wallet, err := zcncore.CreateWalletOffline() if err != nil { diff --git a/cmd/storage.go b/cmd/storage.go index 7da2cf4a..834eaee1 100644 --- a/cmd/storage.go +++ b/cmd/storage.go @@ -2,6 +2,7 @@ package cmd import ( "fmt" + "github.com/0chain/gosdk/core/transaction" "log" "time" @@ -23,7 +24,7 @@ var scConfig = &cobra.Command{ Run: func(cmd *cobra.Command, args []string) { doJSON, _ := cmd.Flags().GetBool("json") - var conf, err = sdk.GetStorageSCConfig() + var conf, err = transaction.GetConfig("storage_sc_config") if err != nil { log.Fatalf("Failed to get storage SC configurations: %v", err) } @@ -290,10 +291,10 @@ var blobberUpdateCmd = &cobra.Command{ } var resetBlobberStatsCmd = &cobra.Command{ - Use: "reset-blobber-stats", - Short: "Reset blobber stats", - Long: `Reset blobber stats`, - Args: cobra.MinimumNArgs(0), + Use: "reset-blobber-stats", + Short: "Reset blobber stats", + Long: `Reset blobber stats`, + Args: cobra.MinimumNArgs(0), Hidden: true, Run: func(cmd *cobra.Command, args []string) { var ( diff --git a/go.mod b/go.mod index dd3460fa..70c5908a 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.17.4-0.20240907144423-14c6c99c435b + github.com/0chain/gosdk v1.17.7-0.20240911131154-d83cf1845a1e github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 diff --git a/go.sum b/go.sum index fa7155ff..8b080ecb 100644 --- a/go.sum +++ b/go.sum @@ -40,8 +40,8 @@ github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565 h1:z+DtCR8mBsjPnEs github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565/go.mod h1:UyDC8Qyl5z9lGkCnf9RHJPMektnFX8XtCJZHXCCVj8E= 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.17.4-0.20240907144423-14c6c99c435b h1:o4YvZ1+OofKMZGo8er3VnkLkcimAQ5Xm3N+tFBfjApE= -github.com/0chain/gosdk v1.17.4-0.20240907144423-14c6c99c435b/go.mod h1:/PXIXnUGWUXqtl9vP3qHfvD+OD7f7TqS9GsWW7YjVGg= +github.com/0chain/gosdk v1.17.7-0.20240911131154-d83cf1845a1e h1:c6qD84zZbz1snwic6AJPV7C6gy5Hk+k4l4M2CJGP8DA= +github.com/0chain/gosdk v1.17.7-0.20240911131154-d83cf1845a1e/go.mod h1:/PXIXnUGWUXqtl9vP3qHfvD+OD7f7TqS9GsWW7YjVGg= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= From dfa88b4e585e4df1c7c046ca90de7a4626a9e758 Mon Sep 17 00:00:00 2001 From: Jayash Satolia Date: Wed, 11 Sep 2024 21:48:21 +0530 Subject: [PATCH 191/228] Fix --- cmd/storage.go | 2 +- go.mod | 4 +++- go.sum | 11 +++++++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/cmd/storage.go b/cmd/storage.go index 834eaee1..a66f793a 100644 --- a/cmd/storage.go +++ b/cmd/storage.go @@ -78,7 +78,7 @@ var lsBlobers = &cobra.Command{ } list, err := sdk.GetBlobbers(isActive, isStakable) if err != nil { - log.Fatalf("Failed to get storage SC configurations: %v", err) + log.Fatalf("Failed to get blobbers: %v", err) } if doJSON { diff --git a/go.mod b/go.mod index 70c5908a..6fc826f9 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.17.7-0.20240911131154-d83cf1845a1e + github.com/0chain/gosdk v1.17.7-0.20240911161636-c9dfb8637fff github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 @@ -31,6 +31,8 @@ require ( github.com/h2non/filetype v1.1.4-0.20231228185113-6469358c2bcb // indirect github.com/hack-pad/go-webworkers v0.1.0 // indirect github.com/hack-pad/safejs v0.1.1 // indirect + github.com/hashicorp/go-cleanhttp v0.5.2 // indirect + github.com/hashicorp/go-retryablehttp v0.7.2 // indirect github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect github.com/hashicorp/golang-lru/v2 v2.0.1 // indirect github.com/hashicorp/hcl v1.0.0 // indirect diff --git a/go.sum b/go.sum index 8b080ecb..c3cea2c4 100644 --- a/go.sum +++ b/go.sum @@ -40,8 +40,8 @@ github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565 h1:z+DtCR8mBsjPnEs github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565/go.mod h1:UyDC8Qyl5z9lGkCnf9RHJPMektnFX8XtCJZHXCCVj8E= 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.17.7-0.20240911131154-d83cf1845a1e h1:c6qD84zZbz1snwic6AJPV7C6gy5Hk+k4l4M2CJGP8DA= -github.com/0chain/gosdk v1.17.7-0.20240911131154-d83cf1845a1e/go.mod h1:/PXIXnUGWUXqtl9vP3qHfvD+OD7f7TqS9GsWW7YjVGg= +github.com/0chain/gosdk v1.17.7-0.20240911161636-c9dfb8637fff h1:t0P9is+aUoVzxRka0gvrQESOcH5nykwYfJ4wbm+uT1k= +github.com/0chain/gosdk v1.17.7-0.20240911161636-c9dfb8637fff/go.mod h1:/PXIXnUGWUXqtl9vP3qHfvD+OD7f7TqS9GsWW7YjVGg= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= @@ -209,6 +209,13 @@ github.com/hack-pad/safejs v0.1.1 h1:d5qPO0iQ7h2oVtpzGnLExE+Wn9AtytxIfltcS2b9KD8 github.com/hack-pad/safejs v0.1.1/go.mod h1:HdS+bKF1NrE72VoXZeWzxFOVQVUSqZJAG0xNCnb+Tio= github.com/hashicorp/go-bexpr v0.1.10 h1:9kuI5PFotCboP3dkDYFr/wi0gg0QVbSNz5oFRpxn4uE= github.com/hashicorp/go-bexpr v0.1.10/go.mod h1:oxlubA2vC/gFVfX1A6JGp7ls7uCDlfJn732ehYYg+g0= +github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= +github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= +github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= +github.com/hashicorp/go-hclog v1.2.0 h1:La19f8d7WIlm4ogzNHB0JGqs5AUDAZ2UfCY4sJXcJdM= +github.com/hashicorp/go-hclog v1.2.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= +github.com/hashicorp/go-retryablehttp v0.7.2 h1:AcYqCvkpalPnPF2pn0KamgwamS42TqUDDYFRKq/RAd0= +github.com/hashicorp/go-retryablehttp v0.7.2/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d h1:dg1dEPuWpEqDnvIw251EVy4zlP8gWbsGj4BsUKCRpYs= From afe72a3c97fb8b162b00b76b231a823774283abe Mon Sep 17 00:00:00 2001 From: Jayash Satolia Date: Fri, 13 Sep 2024 02:14:15 +0530 Subject: [PATCH 192/228] Updated gosdk --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 6fc826f9..da68b1f3 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.17.7-0.20240911161636-c9dfb8637fff + github.com/0chain/gosdk v1.17.7-0.20240912204323-c9723ae708ba github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 diff --git a/go.sum b/go.sum index c3cea2c4..27ecf888 100644 --- a/go.sum +++ b/go.sum @@ -40,8 +40,8 @@ github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565 h1:z+DtCR8mBsjPnEs github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565/go.mod h1:UyDC8Qyl5z9lGkCnf9RHJPMektnFX8XtCJZHXCCVj8E= 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.17.7-0.20240911161636-c9dfb8637fff h1:t0P9is+aUoVzxRka0gvrQESOcH5nykwYfJ4wbm+uT1k= -github.com/0chain/gosdk v1.17.7-0.20240911161636-c9dfb8637fff/go.mod h1:/PXIXnUGWUXqtl9vP3qHfvD+OD7f7TqS9GsWW7YjVGg= +github.com/0chain/gosdk v1.17.7-0.20240912204323-c9723ae708ba h1:2X09qkANlLQV307OE8ePe98eMdfSnTVMtuRCAn6CZ8s= +github.com/0chain/gosdk v1.17.7-0.20240912204323-c9723ae708ba/go.mod h1:/PXIXnUGWUXqtl9vP3qHfvD+OD7f7TqS9GsWW7YjVGg= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= From 678be323f11c63ca1999a30de44c99c1ee6e8a45 Mon Sep 17 00:00:00 2001 From: Jayash Satolia Date: Fri, 13 Sep 2024 21:28:27 +0530 Subject: [PATCH 193/228] Fix --- go.mod | 4 ++-- go.sum | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index da68b1f3..b9c3115c 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.17.7-0.20240912204323-c9723ae708ba + github.com/0chain/gosdk v1.17.7-0.20240913155712-042f96bf0ab3 github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 @@ -84,4 +84,4 @@ require ( ) // temporary, for development -// replace github.com/0chain/gosdk => ../gosdk +replace github.com/0chain/gosdk => ../gosdk diff --git a/go.sum b/go.sum index 27ecf888..e5c904c4 100644 --- a/go.sum +++ b/go.sum @@ -40,8 +40,6 @@ github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565 h1:z+DtCR8mBsjPnEs github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565/go.mod h1:UyDC8Qyl5z9lGkCnf9RHJPMektnFX8XtCJZHXCCVj8E= 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.17.7-0.20240912204323-c9723ae708ba h1:2X09qkANlLQV307OE8ePe98eMdfSnTVMtuRCAn6CZ8s= -github.com/0chain/gosdk v1.17.7-0.20240912204323-c9723ae708ba/go.mod h1:/PXIXnUGWUXqtl9vP3qHfvD+OD7f7TqS9GsWW7YjVGg= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= @@ -80,7 +78,6 @@ github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= From 8ee4002d085c52d79bc58598b256387e5485aceb Mon Sep 17 00:00:00 2001 From: Jayash Satolia Date: Sat, 14 Sep 2024 02:44:57 +0530 Subject: [PATCH 194/228] Fix --- go.mod | 4 ++-- go.sum | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index b9c3115c..af5da8ab 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.17.7-0.20240913155712-042f96bf0ab3 + github.com/0chain/gosdk v1.17.7-0.20240913203625-aa521ff941e2 github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 @@ -84,4 +84,4 @@ require ( ) // temporary, for development -replace github.com/0chain/gosdk => ../gosdk +//replace github.com/0chain/gosdk => ../gosdk diff --git a/go.sum b/go.sum index e5c904c4..147e398c 100644 --- a/go.sum +++ b/go.sum @@ -40,6 +40,8 @@ github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565 h1:z+DtCR8mBsjPnEs github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565/go.mod h1:UyDC8Qyl5z9lGkCnf9RHJPMektnFX8XtCJZHXCCVj8E= 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.17.7-0.20240913203625-aa521ff941e2 h1:WdqlbYiessCc25jLgydZtNwuIOi0F1Q87s2xfJG8vE8= +github.com/0chain/gosdk v1.17.7-0.20240913203625-aa521ff941e2/go.mod h1:+9quBj37eUmdFrWbvDv1Fs4+gG/Vz8Ls/4Ywu/sd8GI= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= From f4dd94793d60cb2890d02a94c9f71b90ddc2b344 Mon Sep 17 00:00:00 2001 From: sandeep kumar Date: Sat, 14 Sep 2024 10:52:41 +0530 Subject: [PATCH 195/228] added new cmd action to download dir --- cmd/downdir.go | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 cmd/downdir.go diff --git a/cmd/downdir.go b/cmd/downdir.go new file mode 100644 index 00000000..df9eeec5 --- /dev/null +++ b/cmd/downdir.go @@ -0,0 +1,66 @@ +package cmd + +import ( + "context" + "os" + "sync" + + "github.com/0chain/gosdk/zboxcore/sdk" + "github.com/spf13/cobra" +) + +// downloadCmd represents download directory command +var downdirCmd = &cobra.Command{ + Use: "downdir", + Short: "download directory from blobbers", + Long: `download directory from blobbers`, + Args: cobra.MinimumNArgs(0), + Run: func(cmd *cobra.Command, args []string) { + fflags := cmd.Flags() // fflags is a *flag.FlagSet + if !(fflags.Changed("remotepath") || fflags.Changed("authticket")) { + PrintError("Error: remotepath / authticket flag is missing") + os.Exit(1) + } + + remotePath := cmd.Flag("remotepath").Value.String() + authTicket := cmd.Flag("authticket").Value.String() + localPath := cmd.Flag("localpath").Value.String() + allocationID := cmd.Flag("allocation").Value.String() + + var allocationObj *sdk.Allocation + if !fflags.Changed("allocation") { // check if the flag "path" is set + PrintError("Error: allocation flag is missing") // If not, we'll let the user know + os.Exit(1) // and return + } + allocationObj, err := sdk.GetAllocation(allocationID) + if err != nil { + PrintError("Error fetching the allocation", err) + os.Exit(1) + } + wg := &sync.WaitGroup{} + statusBar := &StatusBar{wg: wg} + wg.Add(1) + errE := allocationObj.DownloadDirectory(context.Background(), remotePath, localPath, authTicket, statusBar) + if errE == nil { + wg.Wait() + } else { + PrintError("Download failed.", errE.Error()) + os.Exit(1) + } + if !statusBar.success { + os.Exit(1) + } + }, +} + +func init() { + rootCmd.AddCommand(downdirCmd) + downloadCmd.PersistentFlags().String("allocation", "", "Allocation ID") + downloadCmd.PersistentFlags().String("remotepath", "", "Remote path of directory to download") + downloadCmd.PersistentFlags().String("localpath", "", "Local path of directory to download") + downloadCmd.PersistentFlags().String("authticket", "", "Auth ticket fot the file to download if you dont own it") + + downloadCmd.MarkFlagRequired("allocation") + downloadCmd.MarkFlagRequired("localpath") + downloadCmd.MarkFlagRequired("remotepath") +} From b6e33809967858bf3590e80d676b3a0c0ebe7cd1 Mon Sep 17 00:00:00 2001 From: sandeep kumar Date: Sun, 15 Sep 2024 09:51:34 +0530 Subject: [PATCH 196/228] added new cmd action to download dir --- cmd/{downdir.go => downloaddir.go} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename cmd/{downdir.go => downloaddir.go} (98%) diff --git a/cmd/downdir.go b/cmd/downloaddir.go similarity index 98% rename from cmd/downdir.go rename to cmd/downloaddir.go index df9eeec5..f455b598 100644 --- a/cmd/downdir.go +++ b/cmd/downloaddir.go @@ -11,7 +11,7 @@ import ( // downloadCmd represents download directory command var downdirCmd = &cobra.Command{ - Use: "downdir", + Use: "downloaddir", Short: "download directory from blobbers", Long: `download directory from blobbers`, Args: cobra.MinimumNArgs(0), From 17e7f6163d7db40c07e7d62a3c1264913ad46dad Mon Sep 17 00:00:00 2001 From: sandeep kumar Date: Sun, 15 Sep 2024 11:12:16 +0530 Subject: [PATCH 197/228] updated download dir --- cmd/downloaddir.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cmd/downloaddir.go b/cmd/downloaddir.go index f455b598..63fa762a 100644 --- a/cmd/downloaddir.go +++ b/cmd/downloaddir.go @@ -55,12 +55,12 @@ var downdirCmd = &cobra.Command{ func init() { rootCmd.AddCommand(downdirCmd) - downloadCmd.PersistentFlags().String("allocation", "", "Allocation ID") - downloadCmd.PersistentFlags().String("remotepath", "", "Remote path of directory to download") - downloadCmd.PersistentFlags().String("localpath", "", "Local path of directory to download") - downloadCmd.PersistentFlags().String("authticket", "", "Auth ticket fot the file to download if you dont own it") + downdirCmd.PersistentFlags().String("allocation", "", "Allocation ID") + downdirCmd.PersistentFlags().String("remotepath", "", "Remote path of directory to download") + downdirCmd.PersistentFlags().String("localpath", "", "Local path of directory to download") + downdirCmd.PersistentFlags().String("authticket", "", "Auth ticket fot the file to download if you dont own it") - downloadCmd.MarkFlagRequired("allocation") - downloadCmd.MarkFlagRequired("localpath") - downloadCmd.MarkFlagRequired("remotepath") + downdirCmd.MarkFlagRequired("allocation") + downdirCmd.MarkFlagRequired("localpath") + downdirCmd.MarkFlagRequired("remotepath") } From bf7043a2426f8e17509eb9a18d0014a9950f766b Mon Sep 17 00:00:00 2001 From: Jayash Satolia Date: Fri, 20 Sep 2024 02:05:11 +0530 Subject: [PATCH 198/228] Fix --- cmd/walletinfo.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/walletinfo.go b/cmd/walletinfo.go index f7d44bcf..16aba871 100644 --- a/cmd/walletinfo.go +++ b/cmd/walletinfo.go @@ -48,11 +48,11 @@ var walletinfoCmd = &cobra.Command{ fmt.Println("Error getting the public key for encryption. ", err.Error()) return } - data[0] = []string{client.PublicKey(), client.ClientID(), encPubKey} + data[0] = []string{client.PublicKey(), client.Id(), encPubKey} if doJSON { j := make(map[string]string) j["client_public_key"] = client.PublicKey() - j["client_id"] = client.ClientID() + j["client_id"] = client.Id() j["encryption_public_key"] = encPubKey util.PrintJSON(j) return @@ -70,7 +70,7 @@ var signCmd = &cobra.Command{ Run: func(cmd *cobra.Command, args []string) { data, _ := cmd.Flags().GetString("data") if data == "" { - data = client.ClientID() + data = client.Id() } else { data = encryption.Hash(data) } From 54cd05e92e588d8559a481ed57485080a4e3da44 Mon Sep 17 00:00:00 2001 From: Jayash Satolia Date: Fri, 20 Sep 2024 02:05:36 +0530 Subject: [PATCH 199/228] Revert "Fix" This reverts commit bf7043a2426f8e17509eb9a18d0014a9950f766b. --- cmd/walletinfo.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/walletinfo.go b/cmd/walletinfo.go index 16aba871..f7d44bcf 100644 --- a/cmd/walletinfo.go +++ b/cmd/walletinfo.go @@ -48,11 +48,11 @@ var walletinfoCmd = &cobra.Command{ fmt.Println("Error getting the public key for encryption. ", err.Error()) return } - data[0] = []string{client.PublicKey(), client.Id(), encPubKey} + data[0] = []string{client.PublicKey(), client.ClientID(), encPubKey} if doJSON { j := make(map[string]string) j["client_public_key"] = client.PublicKey() - j["client_id"] = client.Id() + j["client_id"] = client.ClientID() j["encryption_public_key"] = encPubKey util.PrintJSON(j) return @@ -70,7 +70,7 @@ var signCmd = &cobra.Command{ Run: func(cmd *cobra.Command, args []string) { data, _ := cmd.Flags().GetString("data") if data == "" { - data = client.Id() + data = client.ClientID() } else { data = encryption.Hash(data) } From 8098527326bca2cafbd4e98a71508fe1cfdc82e4 Mon Sep 17 00:00:00 2001 From: Jayash Satolia Date: Mon, 23 Sep 2024 02:36:59 +0530 Subject: [PATCH 200/228] Fix --- cmd/readpool.go | 157 ------------------------------------------------ go.mod | 4 +- go.sum | 8 +-- 3 files changed, 6 insertions(+), 163 deletions(-) delete mode 100644 cmd/readpool.go diff --git a/cmd/readpool.go b/cmd/readpool.go deleted file mode 100644 index a6c85c70..00000000 --- a/cmd/readpool.go +++ /dev/null @@ -1,157 +0,0 @@ -package cmd - -import ( - "fmt" - "log" - - "github.com/0chain/gosdk/zboxcore/sdk" - "github.com/0chain/gosdk/zcncore" - "github.com/0chain/zboxcli/util" - "github.com/spf13/cobra" -) - -// rpCreate creates read pool -var rpCreate = &cobra.Command{ - Use: "rp-create", - Short: "Create read pool if missing", - Long: `Create read pool in storage SC if the pool is missing.`, - Args: cobra.MinimumNArgs(0), - Run: func(cmd *cobra.Command, args []string) { - var err error - if _, _, err = sdk.CreateReadPool(); err != nil { - log.Fatalf("Failed to create read pool: %v\n", err) - } - fmt.Println("Read pool created successfully") - }, -} - -// rpInfo information -var rpInfo = &cobra.Command{ - Use: "rp-info", - Short: "Read pool information.", - Long: `Read pool information.`, - Args: cobra.MinimumNArgs(0), - Run: func(cmd *cobra.Command, args []string) { - doJSON, _ := cmd.Flags().GetBool("json") - - info, err := sdk.GetReadPoolInfo("") - if err != nil { - log.Fatalf("Failed to get read pool info: %v", err) - } - - token, err := info.Balance.ToToken() - if err != nil { - log.Fatal(err) - } - usd, err := zcncore.ConvertTokenToUSD(token) - var bt = float64(info.Balance) / 1e10 - if err != nil { - log.Fatalf("Failed to convert token to usd: %v", err) - } - - if info.Balance == 0 { - fmt.Println("no tokens locked") - return - } - - if doJSON { - jsonCurrencies := map[string]interface{}{ - "usd": usd, - "zcn": bt, - "fmt": info.Balance, - } - - util.PrintJSON(jsonCurrencies) - return - } - fmt.Printf("\nRead pool Balance: %v (%.2f USD)\n", info.Balance, usd) - }, -} - -// rpLock locks tokens in read pool -var rpLock = &cobra.Command{ - Use: "rp-lock", - Short: "Lock some tokens in read pool.", - Long: `Lock some tokens in read pool.`, - Args: cobra.MinimumNArgs(0), - Run: func(cmd *cobra.Command, args []string) { - - var ( - flags = cmd.Flags() - tokens float64 - fee float64 - err error - ) - - if !flags.Changed("tokens") { - log.Fatal("missing required 'tokens' flag") - } - - if tokens, err = flags.GetFloat64("tokens"); err != nil { - log.Fatal("invalid 'tokens' flag: ", err) - } - - if tokens < 0 { - log.Fatal("invalid token amount: negative") - } - - if flags.Changed("fee") { - if fee, err = flags.GetFloat64("fee"); err != nil { - log.Fatal("invalid 'fee' flag: ", err) - } - } - - _, _, err = sdk.ReadPoolLock(zcncore.ConvertToValue(tokens), zcncore.ConvertToValue(fee)) - if err != nil { - log.Fatalf("Failed to lock tokens in read pool: %v", err) - } - - fmt.Println("locked") - }, -} - -// rpUnlock unlocks tokens in a read pool -var rpUnlock = &cobra.Command{ - Use: "rp-unlock", - Short: "Unlock some expired tokens in a read pool.", - Long: `Unlock some expired tokens in a read pool.`, - Args: cobra.MinimumNArgs(0), - Run: func(cmd *cobra.Command, args []string) { - - var ( - flags = cmd.Flags() - fee float64 - err error - ) - - if flags.Changed("fee") { - if fee, err = flags.GetFloat64("fee"); err != nil { - log.Fatal("invalid 'fee' flag: ", err) - } - } - - _, _, err = sdk.ReadPoolUnlock(zcncore.ConvertToValue(fee)) - if err != nil { - log.Fatalf("Failed to unlock tokens in read pool: %v", err) - } - fmt.Println("unlocked") - }, -} - -func init() { - rootCmd.AddCommand(rpCreate) - rootCmd.AddCommand(rpInfo) - rootCmd.AddCommand(rpLock) - rootCmd.AddCommand(rpUnlock) - - rpInfo.Flags().Bool("json", false, "(default false) pass this option to print response as json data") - - rpLock.PersistentFlags().Float64("tokens", 0.0, - "lock tokens number, required") - rpLock.PersistentFlags().Float64("fee", 0.0, - "transaction fee, default 0") - rpLock.MarkFlagRequired("tokens") - - rpUnlock.PersistentFlags().Float64("fee", 0.0, - "transaction fee, default 0") -} diff --git a/go.mod b/go.mod index af5da8ab..5f37770d 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.17.7-0.20240913203625-aa521ff941e2 + github.com/0chain/gosdk v1.17.10-0.20240922210048-bdbd749b25b1 github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 @@ -37,7 +37,7 @@ require ( github.com/hashicorp/golang-lru/v2 v2.0.1 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/herumi/bls-go-binary v1.31.0 // indirect - github.com/hitenjain14/fasthttp v0.0.0-20240527123209-06019e79bff9 // indirect + github.com/hitenjain14/fasthttp v0.0.0-20240916135632-f9303a91736c // indirect github.com/inconshreveable/mousetrap v1.0.1 // indirect github.com/klauspost/compress v1.17.0 // indirect github.com/klauspost/cpuid/v2 v2.2.4 // indirect diff --git a/go.sum b/go.sum index 147e398c..e070aea7 100644 --- a/go.sum +++ b/go.sum @@ -40,8 +40,8 @@ github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565 h1:z+DtCR8mBsjPnEs github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565/go.mod h1:UyDC8Qyl5z9lGkCnf9RHJPMektnFX8XtCJZHXCCVj8E= 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.17.7-0.20240913203625-aa521ff941e2 h1:WdqlbYiessCc25jLgydZtNwuIOi0F1Q87s2xfJG8vE8= -github.com/0chain/gosdk v1.17.7-0.20240913203625-aa521ff941e2/go.mod h1:+9quBj37eUmdFrWbvDv1Fs4+gG/Vz8Ls/4Ywu/sd8GI= +github.com/0chain/gosdk v1.17.10-0.20240922210048-bdbd749b25b1 h1:EQFVDPMXbLn9h1XERahmdkmQqDAn1FMhBN9APiWXQzI= +github.com/0chain/gosdk v1.17.10-0.20240922210048-bdbd749b25b1/go.mod h1:3gt3zG/TQRn+ymsGD8DaOQhKoPHADjtcvqX52JzYUW4= 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/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= @@ -225,8 +225,8 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/herumi/bls-go-binary v1.31.0 h1:L1goQ2tMtGgpXCg5AwHAdJQpLs/pfnWWEc3Wog6OhmI= github.com/herumi/bls-go-binary v1.31.0/go.mod h1:O4Vp1AfR4raRGwFeQpr9X/PQtncEicMoOe6BQt1oX0Y= -github.com/hitenjain14/fasthttp v0.0.0-20240527123209-06019e79bff9 h1:Z6Mu2JCsW2hbqx91L0HNPRPQ10RyAFvPocQHlrRo1Jk= -github.com/hitenjain14/fasthttp v0.0.0-20240527123209-06019e79bff9/go.mod h1:RZMcXy7u4S+E97IXYTe7WHZ3+mCYOh4vys8PkIGZeXk= +github.com/hitenjain14/fasthttp v0.0.0-20240916135632-f9303a91736c h1:lDSIbcLu5TdT+uwb4wPzZgo1pQvKjP/tArL5QKjDJdI= +github.com/hitenjain14/fasthttp v0.0.0-20240916135632-f9303a91736c/go.mod h1:RZMcXy7u4S+E97IXYTe7WHZ3+mCYOh4vys8PkIGZeXk= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= github.com/holiman/uint256 v1.2.2-0.20230321075855-87b91420868c h1:DZfsyhDK1hnSS5lH8l+JggqzEleHteTYfutAiVlSUM8= From a6db28e107829c81f5f3b9c9618c152e0df83b71 Mon Sep 17 00:00:00 2001 From: Jayash Satolia Date: Sat, 28 Sep 2024 19:51:56 +0530 Subject: [PATCH 201/228] Fix --- cmd/root.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/root.go b/cmd/root.go index cb4f2b82..8443366e 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -166,13 +166,14 @@ func initConfig() { } //init the storage sdk with the known miners, sharders and client wallet info - if err = sdk.InitStorageSDK( + if err = client.InitSDK( walletJSON, cfg.BlockWorker, cfg.ChainID, cfg.SignatureScheme, cfg.PreferredBlobbers, nonce, + false, true, zcncore.ConvertToValue(txFee), ); err != nil { fmt.Println("Error in sdk init", err) From 92cb644334254da00ca9a23dcb909320a58c4a6a Mon Sep 17 00:00:00 2001 From: Jayash Satolia Date: Thu, 3 Oct 2024 01:46:12 +0530 Subject: [PATCH 202/228] Fix gosdk init --- cmd/root.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index 8443366e..bc3fef4f 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -171,10 +171,9 @@ func initConfig() { cfg.BlockWorker, cfg.ChainID, cfg.SignatureScheme, - cfg.PreferredBlobbers, nonce, false, true, - zcncore.ConvertToValue(txFee), + int(zcncore.ConvertToValue(txFee)), ); err != nil { fmt.Println("Error in sdk init", err) os.Exit(1) From 97eb6c9f7eec63ff6a1720e89857d8509ffa6b27 Mon Sep 17 00:00:00 2001 From: Jayash Date: Tue, 8 Oct 2024 01:48:19 +0530 Subject: [PATCH 203/228] Update blobber new fields --- cmd/storage.go | 26 ++++++++++++++--- go.mod | 14 ++++++---- go.sum | 75 ++++++++++++++++++++++++++++++++++++++------------ 3 files changed, 88 insertions(+), 27 deletions(-) diff --git a/cmd/storage.go b/cmd/storage.go index 7da2cf4a..2186816c 100644 --- a/cmd/storage.go +++ b/cmd/storage.go @@ -187,6 +187,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") { @@ -290,10 +306,10 @@ var blobberUpdateCmd = &cobra.Command{ } var resetBlobberStatsCmd = &cobra.Command{ - Use: "reset-blobber-stats", - Short: "Reset blobber stats", - Long: `Reset blobber stats`, - Args: cobra.MinimumNArgs(0), + Use: "reset-blobber-stats", + Short: "Reset blobber stats", + Long: `Reset blobber stats`, + Args: cobra.MinimumNArgs(0), Hidden: true, Run: func(cmd *cobra.Command, args []string) { var ( @@ -378,6 +394,8 @@ func init() { buf := blobberUpdateCmd.Flags() buf.String("blobber_id", "", "blobber ID, required") + buf.String("delegate_wallet", "", "delegate wallet, optional") + buf.Int("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") diff --git a/go.mod b/go.mod index 44fdd382..98d17e49 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.17.3 + github.com/0chain/gosdk v1.17.10-0.20241007201651-616a0bd61e84 github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 @@ -14,7 +14,7 @@ require ( ) require ( - github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565 // indirect + github.com/0chain/common v1.13.1-0.20240926135437-61b88d39bbbd // 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 @@ -25,6 +25,7 @@ require ( github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect github.com/ethereum/go-ethereum v1.10.26 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect + github.com/fxamacker/cbor/v2 v2.7.0 // indirect github.com/go-ole/go-ole v1.2.6 // indirect github.com/go-stack/stack v1.8.1 // indirect github.com/google/uuid v1.3.0 // indirect @@ -36,7 +37,7 @@ require ( github.com/hashicorp/golang-lru/v2 v2.0.1 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/herumi/bls-go-binary v1.31.0 // indirect - github.com/hitenjain14/fasthttp v0.0.0-20240527123209-06019e79bff9 // indirect + github.com/hitenjain14/fasthttp v0.0.0-20240916135632-f9303a91736c // indirect github.com/inconshreveable/mousetrap v1.0.1 // indirect github.com/klauspost/compress v1.17.0 // indirect github.com/klauspost/cpuid/v2 v2.2.4 // indirect @@ -65,15 +66,16 @@ require ( github.com/tyler-smith/go-bip39 v1.1.0 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fasthttp v1.51.0 // indirect + github.com/x448/float16 v0.8.4 // indirect github.com/yusufpapurcu/wmi v1.2.2 // indirect go.dedis.ch/fixbuf v1.0.3 // indirect go.dedis.ch/kyber/v3 v3.1.0 // indirect go.uber.org/atomic v1.10.0 // indirect go.uber.org/multierr v1.9.0 // indirect go.uber.org/zap v1.24.0 // indirect - golang.org/x/crypto v0.17.0 // indirect - golang.org/x/sync v0.5.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/crypto v0.21.0 // indirect + golang.org/x/sync v0.7.0 // indirect + golang.org/x/sys v0.18.0 // indirect golang.org/x/text v0.14.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect diff --git a/go.sum b/go.sum index 8d53024a..45db5a1f 100644 --- a/go.sum +++ b/go.sum @@ -36,14 +36,16 @@ 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 v0.0.6-0.20230127095721-8df4d1d72565 h1:z+DtCR8mBsjPnEsT2XtRu4X7GfBiMnz9dYvWYs9V0B4= -github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565/go.mod h1:UyDC8Qyl5z9lGkCnf9RHJPMektnFX8XtCJZHXCCVj8E= +github.com/0chain/common v1.13.1-0.20240926135437-61b88d39bbbd h1:PDnzyJJA4rF2LBW+0OQJ5y9vIwsPYYjbbFwImvgiDdY= +github.com/0chain/common v1.13.1-0.20240926135437-61b88d39bbbd/go.mod h1:vHK9Q0/nz28PxmKsLSMLzEs5iK6QVgl1LxdDQdR7y6s= 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.17.3 h1:nL6x1saSwTku1UFDYoX/uKJO57VQTgowp6id+7UHb7g= -github.com/0chain/gosdk v1.17.3/go.mod h1:y7Ucdmv40VltqulZnncMNjNQ4piX5Dta5ujNmPmXnxg= +github.com/0chain/gosdk v1.17.10-0.20241007201651-616a0bd61e84 h1:0FGS+o8QCEsibCA2bqdjAOSZTiLnEV5LkvyQxKAEomQ= +github.com/0chain/gosdk v1.17.10-0.20241007201651-616a0bd61e84/go.mod h1:mr7LcQicFFrSzFujItjkLP1LvXz9S0j73i7KDEpMXLo= 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= +github.com/DataDog/zstd v1.4.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= github.com/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= github.com/Luzifer/go-openssl/v3 v3.1.0/go.mod h1:liy3FXuuS8hfDlYh1T+l78AwQ/NjZflJz0NDvjKhwDs= github.com/VictoriaMetrics/fastcache v1.6.0 h1:C/3Oi3EiBCqufydp1neRZkqcwmEiuRT9c3fqvvgKm5o= @@ -53,6 +55,8 @@ github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/ github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c/go.mod h1:tjmYdS6MLJ5/s0Fj4DbLgSbDHbEqLJrtnHecBFkdz5M= github.com/btcsuite/btcd v0.23.0/go.mod h1:0QJIIN1wwIXF/3G/m87gIwGniDMDQqjVn4SZgnFpsYY= @@ -90,6 +94,18 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cockroachdb/errors v1.11.3 h1:5bA+k2Y6r+oz/6Z/RFlNeVCesGARKuC6YymtcDrbC/I= +github.com/cockroachdb/errors v1.11.3/go.mod h1:m4UIW4CDjx+R5cybPsNrRbreomiFqt8o1h1wUVazSd8= +github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce h1:giXvy4KSc/6g/esnpM7Geqxka4WSqI1SZc7sMJFd3y4= +github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce/go.mod h1:9/y3cnZ5GKakj/H4y9r9GTjCvAFta7KLgSHPJJYc52M= +github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= +github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= +github.com/cockroachdb/pebble v1.1.2 h1:CUh2IPtR4swHlEj48Rhfzw6l/d0qA31fItcIszQVIsA= +github.com/cockroachdb/pebble v1.1.2/go.mod h1:4exszw1r40423ZsmkG/09AFEG83I0uDgfujJdbL6kYU= +github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30= +github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= +github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= +github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -124,8 +140,12 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= +github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E= +github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= +github.com/getsentry/sentry-go v0.27.0 h1:Pv98CIbtB3LkMWmXi4Joa5OOcwbmnX88sF5qbK3r3Ps= +github.com/getsentry/sentry-go v0.27.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -133,6 +153,8 @@ github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw= github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang-jwt/jwt/v4 v4.3.0 h1:kHL1vqdqWNfATmA0FNMdmZNMyZI1U6O31X4rlIPoBog= github.com/golang-jwt/jwt/v4 v4.3.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= @@ -160,6 +182,8 @@ github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvq github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk= github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= @@ -219,8 +243,8 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/herumi/bls-go-binary v1.31.0 h1:L1goQ2tMtGgpXCg5AwHAdJQpLs/pfnWWEc3Wog6OhmI= github.com/herumi/bls-go-binary v1.31.0/go.mod h1:O4Vp1AfR4raRGwFeQpr9X/PQtncEicMoOe6BQt1oX0Y= -github.com/hitenjain14/fasthttp v0.0.0-20240527123209-06019e79bff9 h1:Z6Mu2JCsW2hbqx91L0HNPRPQ10RyAFvPocQHlrRo1Jk= -github.com/hitenjain14/fasthttp v0.0.0-20240527123209-06019e79bff9/go.mod h1:RZMcXy7u4S+E97IXYTe7WHZ3+mCYOh4vys8PkIGZeXk= +github.com/hitenjain14/fasthttp v0.0.0-20240916135632-f9303a91736c h1:lDSIbcLu5TdT+uwb4wPzZgo1pQvKjP/tArL5QKjDJdI= +github.com/hitenjain14/fasthttp v0.0.0-20240916135632-f9303a91736c/go.mod h1:RZMcXy7u4S+E97IXYTe7WHZ3+mCYOh4vys8PkIGZeXk= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= github.com/holiman/uint256 v1.2.2-0.20230321075855-87b91420868c h1:DZfsyhDK1hnSS5lH8l+JggqzEleHteTYfutAiVlSUM8= @@ -274,6 +298,8 @@ github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/ github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI= +github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM= github.com/minio/sha256-simd v1.0.1/go.mod h1:Pz6AKMiUdngCLpeTL/RJY1M9rUuPMYujV5xJjtbRSN8= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= @@ -304,7 +330,15 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v1.12.0 h1:C+UIj/QWtmqY13Arb8kwMt5j34/0Z2iKamrJ+ryC0Gg= +github.com/prometheus/client_golang v1.12.0/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.2.1-0.20210607210712-147c58e9608a h1:CmF68hwI0XsOQ5UwlBopMi2Ow4Pbg32akc4KIVCOm+Y= +github.com/prometheus/client_model v0.2.1-0.20210607210712-147c58e9608a/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= +github.com/prometheus/common v0.32.1 h1:hWIdL3N2HoUx3B8j3YN9mWor0qhY/NlEKZEaXxuIRh4= +github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= +github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU= +github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/tsdb v0.7.1 h1:YZcsG11NqnK4czYLrWd9mpEuAJIHVQLwdrleYfszMAA= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/remeh/sizedwaitgroup v1.0.0 h1:VNGGFwNo/R5+MJBf6yrsr110p0m4/OX4S3DCy7Kyl5E= @@ -315,8 +349,8 @@ github.com/rivo/uniseg v0.4.3/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUc github.com/rjeczalik/notify v0.9.1 h1:CLCKso/QK1snAlnhNR/CNvNiFU2saUtjV0bx3EwNeCE= github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= -github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= @@ -341,8 +375,9 @@ github.com/status-im/keycard-go v0.2.0 h1:QDLFswOQu1r5jsycloeQh3bVU8n/NatHHaZobt github.com/status-im/keycard-go v0.2.0/go.mod h1:wlp8ZLbsmrF6g6WjugPAx+IzoLrkdf9+mHxBEeo3Hbg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= @@ -351,8 +386,8 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8= github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= @@ -371,6 +406,8 @@ github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6Kllzaw github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasthttp v1.51.0 h1:8b30A5JlZ6C7AS81RsWjYMQmrZG6feChmgAolCl1SqA= github.com/valyala/fasthttp v1.51.0/go.mod h1:oI2XroL+lI7vdXyYoQk03bXBThfFl2cVdIA3Xl7cH8g= +github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= +github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -415,8 +452,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= -golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= +golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -427,6 +464,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df h1:UA2aFVmmsIlefxMk29Dp2juaUSth8Pyn3Tq5Y5mJGME= +golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -504,8 +543,8 @@ golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= -golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190124100055-b90733256f2e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -551,8 +590,8 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -708,6 +747,8 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From 30debcda113dc1b98fbad2a039d186ec18f7dc4f Mon Sep 17 00:00:00 2001 From: sandeep kumar Date: Wed, 9 Oct 2024 08:16:03 +0530 Subject: [PATCH 204/228] santised --- cmd/downloaddir.go | 1 - 1 file changed, 1 deletion(-) diff --git a/cmd/downloaddir.go b/cmd/downloaddir.go index 63fa762a..b3391042 100644 --- a/cmd/downloaddir.go +++ b/cmd/downloaddir.go @@ -59,7 +59,6 @@ func init() { downdirCmd.PersistentFlags().String("remotepath", "", "Remote path of directory to download") downdirCmd.PersistentFlags().String("localpath", "", "Local path of directory to download") downdirCmd.PersistentFlags().String("authticket", "", "Auth ticket fot the file to download if you dont own it") - downdirCmd.MarkFlagRequired("allocation") downdirCmd.MarkFlagRequired("localpath") downdirCmd.MarkFlagRequired("remotepath") From f997e82cca62bf79ec9186c0a4c60e523bc26f8d Mon Sep 17 00:00:00 2001 From: Akhilesh Mahajan Date: Thu, 10 Oct 2024 23:36:47 +0530 Subject: [PATCH 205/228] updated: added storage version and managing tags --- cmd/newallocation.go | 22 ++++++++++++++++++++++ cmd/storage.go | 29 +++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/cmd/newallocation.go b/cmd/newallocation.go index 460fdadd..3e1faa00 100755 --- a/cmd/newallocation.go +++ b/cmd/newallocation.go @@ -237,6 +237,22 @@ 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 managingWallet string + if flags.Changed("managing_wallet") { + managingWallet, err = flags.GetString("managing_wallet") + if err != nil { + log.Fatal("invalid managing wallet: ", err) + } + } + var allocationID string if len(owner) == 0 { options := sdk.CreateAllocationOptions{ @@ -258,6 +274,8 @@ var newallocationCmd = &cobra.Command{ ThirdPartyExtendable: thirdPartyExtendable, Force: force, IsEnterprise: isEnterprise, + StorageVersion: storageVersion, + ManagingWallet: managingWallet, } allocationID, _, _, err = sdk.CreateAllocationWith(options) if err != nil { @@ -355,6 +373,10 @@ 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().String("storage_version", "", "storage version of the blobber") + newallocationCmd.Flags().String("managing_wallet", "", "managing wallet of the blobber") + } func storeAllocation(allocationID string) { diff --git a/cmd/storage.go b/cmd/storage.go index 7da2cf4a..c7db7d8f 100644 --- a/cmd/storage.go +++ b/cmd/storage.go @@ -234,6 +234,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 { @@ -274,6 +283,22 @@ var blobberUpdateCmd = &cobra.Command{ updateBlobber.IsRestricted = &ia } + var storageVersion int64 + if flags.Changed("storage_version"){ + if storageVersion, err = flags.GetInt64("storage_version"); err != nil{ + log.Fatal(err) + } + updateBlobber.StorageVersion = &storageVersion + } + + var managingWallet string + if flags.Changed("managing_wallet"){ + if managingWallet, err = flags.GetString("managing_wallet"); err != nil{ + log.Fatal(err) + } + updateBlobber.ManagingWallet = &managingWallet + } + if termsChanged { updateBlobber.Terms = terms } @@ -389,6 +414,10 @@ func init() { buf.Bool("not_available", true, "(default false) set blobber's availability for new allocations") buf.Bool("is_restricted", true, "(default false) set is_restricted") buf.String("url", "", "update the url of the blobber, optional") + buf.Int64("storage_version", 2, "storage version of the blobber, optional") + buf.String("delegate_wallet", "", "delegate wallet of the blobber, optional") + buf.String("managing_wallet", "", "managing wallet of the blobber, optional") + blobberUpdateCmd.MarkFlagRequired("blobber_id") resetBlobberStatsCmd.Flags().String("blobber_id", "", "blobber_id is required") From f02957a08145b1b6c31ad6a187bdc3461acb32ec Mon Sep 17 00:00:00 2001 From: Akhilesh Mahajan Date: Fri, 11 Oct 2024 00:53:46 +0530 Subject: [PATCH 206/228] updated: resolved comments --- cmd/newallocation.go | 11 ----------- cmd/storage.go | 8 -------- 2 files changed, 19 deletions(-) diff --git a/cmd/newallocation.go b/cmd/newallocation.go index 3e1faa00..cdcf119c 100755 --- a/cmd/newallocation.go +++ b/cmd/newallocation.go @@ -245,14 +245,6 @@ var newallocationCmd = &cobra.Command{ } } - var managingWallet string - if flags.Changed("managing_wallet") { - managingWallet, err = flags.GetString("managing_wallet") - if err != nil { - log.Fatal("invalid managing wallet: ", err) - } - } - var allocationID string if len(owner) == 0 { options := sdk.CreateAllocationOptions{ @@ -275,7 +267,6 @@ var newallocationCmd = &cobra.Command{ Force: force, IsEnterprise: isEnterprise, StorageVersion: storageVersion, - ManagingWallet: managingWallet, } allocationID, _, _, err = sdk.CreateAllocationWith(options) if err != nil { @@ -375,8 +366,6 @@ func init() { newallocationCmd.Flags().Bool("forbid_rename", false, "(default false) specify if the users cannot rename objects in this allocation") newallocationCmd.Flags().String("storage_version", "", "storage version of the blobber") - newallocationCmd.Flags().String("managing_wallet", "", "managing wallet of the blobber") - } func storeAllocation(allocationID string) { diff --git a/cmd/storage.go b/cmd/storage.go index c7db7d8f..595618c4 100644 --- a/cmd/storage.go +++ b/cmd/storage.go @@ -291,13 +291,6 @@ var blobberUpdateCmd = &cobra.Command{ updateBlobber.StorageVersion = &storageVersion } - var managingWallet string - if flags.Changed("managing_wallet"){ - if managingWallet, err = flags.GetString("managing_wallet"); err != nil{ - log.Fatal(err) - } - updateBlobber.ManagingWallet = &managingWallet - } if termsChanged { updateBlobber.Terms = terms @@ -416,7 +409,6 @@ func init() { buf.String("url", "", "update the url of the blobber, optional") buf.Int64("storage_version", 2, "storage version of the blobber, optional") buf.String("delegate_wallet", "", "delegate wallet of the blobber, optional") - buf.String("managing_wallet", "", "managing wallet of the blobber, optional") blobberUpdateCmd.MarkFlagRequired("blobber_id") From 518c6734b0df6bf2308ef30d3437c26c5227e6f7 Mon Sep 17 00:00:00 2001 From: Akhilesh Mahajan Date: Fri, 11 Oct 2024 00:56:38 +0530 Subject: [PATCH 207/228] updated: resolved coments --- cmd/storage.go | 9 --------- 1 file changed, 9 deletions(-) diff --git a/cmd/storage.go b/cmd/storage.go index b6d5dc84..75eec50b 100644 --- a/cmd/storage.go +++ b/cmd/storage.go @@ -299,15 +299,6 @@ var blobberUpdateCmd = &cobra.Command{ updateBlobber.IsRestricted = &ia } - var storageVersion int64 - if flags.Changed("storage_version"){ - if storageVersion, err = flags.GetInt64("storage_version"); err != nil{ - log.Fatal(err) - } - updateBlobber.StorageVersion = &storageVersion - } - - if termsChanged { updateBlobber.Terms = terms } From 61d7976ff7f6b8039b7d7bde1415b870e243b42b Mon Sep 17 00:00:00 2001 From: Akhilesh Mahajan Date: Fri, 11 Oct 2024 09:37:24 +0530 Subject: [PATCH 208/228] updated: removed duplicated cmds --- cmd/storage.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/cmd/storage.go b/cmd/storage.go index 75eec50b..6049d5db 100644 --- a/cmd/storage.go +++ b/cmd/storage.go @@ -404,7 +404,7 @@ func init() { buf := blobberUpdateCmd.Flags() buf.String("blobber_id", "", "blobber ID, required") buf.String("delegate_wallet", "", "delegate wallet, optional") - buf.Int("storage_version", 0, "update storage version, 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") @@ -416,9 +416,6 @@ func init() { buf.Bool("not_available", true, "(default false) set blobber's availability for new allocations") buf.Bool("is_restricted", true, "(default false) set is_restricted") buf.String("url", "", "update the url of the blobber, optional") - buf.Int64("storage_version", 2, "storage version of the blobber, optional") - buf.String("delegate_wallet", "", "delegate wallet of the blobber, optional") - blobberUpdateCmd.MarkFlagRequired("blobber_id") resetBlobberStatsCmd.Flags().String("blobber_id", "", "blobber_id is required") From d90ab6b54a3ac26092321f1a80501542b38603e2 Mon Sep 17 00:00:00 2001 From: Akhilesh Mahajan Date: Fri, 11 Oct 2024 09:42:05 +0530 Subject: [PATCH 209/228] updated: type changed for storage version --- cmd/newallocation.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/newallocation.go b/cmd/newallocation.go index cdcf119c..ba0a5969 100755 --- a/cmd/newallocation.go +++ b/cmd/newallocation.go @@ -365,7 +365,7 @@ func init() { 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().String("storage_version", "", "storage version of the blobber") + newallocationCmd.Flags().Int64("storage_version", 0, "storaage version of allocation") } func storeAllocation(allocationID string) { From ef9dd6a429165b322692de845cbf9cc3d9f794f1 Mon Sep 17 00:00:00 2001 From: dabasov Date: Sat, 19 Oct 2024 21:12:22 +0300 Subject: [PATCH 210/228] updated gosdk --- cmd/storage.go | 10 +++++----- go.mod | 14 ++++++++------ 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/cmd/storage.go b/cmd/storage.go index 7da2cf4a..80d873f8 100644 --- a/cmd/storage.go +++ b/cmd/storage.go @@ -290,10 +290,10 @@ var blobberUpdateCmd = &cobra.Command{ } var resetBlobberStatsCmd = &cobra.Command{ - Use: "reset-blobber-stats", - Short: "Reset blobber stats", - Long: `Reset blobber stats`, - Args: cobra.MinimumNArgs(0), + Use: "reset-blobber-stats", + Short: "Reset blobber stats", + Long: `Reset blobber stats`, + Args: cobra.MinimumNArgs(0), Hidden: true, Run: func(cmd *cobra.Command, args []string) { var ( @@ -378,7 +378,7 @@ func init() { buf := blobberUpdateCmd.Flags() buf.String("blobber_id", "", "blobber ID, required") - buf.Int64("capacity", 0, "update blobber capacity bid, 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 44fdd382..efffd094 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.17.3 + github.com/0chain/gosdk v1.18.0-RC1 github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 @@ -14,7 +14,7 @@ require ( ) require ( - github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565 // indirect + github.com/0chain/common v1.13.1-0.20240926135437-61b88d39bbbd // 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 @@ -25,6 +25,7 @@ require ( github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect github.com/ethereum/go-ethereum v1.10.26 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect + github.com/fxamacker/cbor/v2 v2.7.0 // indirect github.com/go-ole/go-ole v1.2.6 // indirect github.com/go-stack/stack v1.8.1 // indirect github.com/google/uuid v1.3.0 // indirect @@ -36,7 +37,7 @@ require ( github.com/hashicorp/golang-lru/v2 v2.0.1 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/herumi/bls-go-binary v1.31.0 // indirect - github.com/hitenjain14/fasthttp v0.0.0-20240527123209-06019e79bff9 // indirect + github.com/hitenjain14/fasthttp v0.0.0-20240916135632-f9303a91736c // indirect github.com/inconshreveable/mousetrap v1.0.1 // indirect github.com/klauspost/compress v1.17.0 // indirect github.com/klauspost/cpuid/v2 v2.2.4 // indirect @@ -65,15 +66,16 @@ require ( github.com/tyler-smith/go-bip39 v1.1.0 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fasthttp v1.51.0 // indirect + github.com/x448/float16 v0.8.4 // indirect github.com/yusufpapurcu/wmi v1.2.2 // indirect go.dedis.ch/fixbuf v1.0.3 // indirect go.dedis.ch/kyber/v3 v3.1.0 // indirect go.uber.org/atomic v1.10.0 // indirect go.uber.org/multierr v1.9.0 // indirect go.uber.org/zap v1.24.0 // indirect - golang.org/x/crypto v0.17.0 // indirect - golang.org/x/sync v0.5.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/crypto v0.21.0 // indirect + golang.org/x/sync v0.7.0 // indirect + golang.org/x/sys v0.18.0 // indirect golang.org/x/text v0.14.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect From 30033196e8955e4d111c0956468d7f1830c3e401 Mon Sep 17 00:00:00 2001 From: dabasov Date: Sat, 19 Oct 2024 21:12:49 +0300 Subject: [PATCH 211/228] updated gosdk --- go.sum | 75 +++++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 58 insertions(+), 17 deletions(-) diff --git a/go.sum b/go.sum index 8d53024a..302f68d2 100644 --- a/go.sum +++ b/go.sum @@ -36,14 +36,16 @@ 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 v0.0.6-0.20230127095721-8df4d1d72565 h1:z+DtCR8mBsjPnEsT2XtRu4X7GfBiMnz9dYvWYs9V0B4= -github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565/go.mod h1:UyDC8Qyl5z9lGkCnf9RHJPMektnFX8XtCJZHXCCVj8E= +github.com/0chain/common v1.13.1-0.20240926135437-61b88d39bbbd h1:PDnzyJJA4rF2LBW+0OQJ5y9vIwsPYYjbbFwImvgiDdY= +github.com/0chain/common v1.13.1-0.20240926135437-61b88d39bbbd/go.mod h1:vHK9Q0/nz28PxmKsLSMLzEs5iK6QVgl1LxdDQdR7y6s= 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.17.3 h1:nL6x1saSwTku1UFDYoX/uKJO57VQTgowp6id+7UHb7g= -github.com/0chain/gosdk v1.17.3/go.mod h1:y7Ucdmv40VltqulZnncMNjNQ4piX5Dta5ujNmPmXnxg= +github.com/0chain/gosdk v1.18.0-RC1 h1:vQ5Z46Q7GQ5qU6bT098riVbdwC0GO1YOXZmLjlQv5Ho= +github.com/0chain/gosdk v1.18.0-RC1/go.mod h1:mr7LcQicFFrSzFujItjkLP1LvXz9S0j73i7KDEpMXLo= 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= +github.com/DataDog/zstd v1.4.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= github.com/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw= github.com/Luzifer/go-openssl/v3 v3.1.0/go.mod h1:liy3FXuuS8hfDlYh1T+l78AwQ/NjZflJz0NDvjKhwDs= github.com/VictoriaMetrics/fastcache v1.6.0 h1:C/3Oi3EiBCqufydp1neRZkqcwmEiuRT9c3fqvvgKm5o= @@ -53,6 +55,8 @@ github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/ github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c/go.mod h1:tjmYdS6MLJ5/s0Fj4DbLgSbDHbEqLJrtnHecBFkdz5M= github.com/btcsuite/btcd v0.23.0/go.mod h1:0QJIIN1wwIXF/3G/m87gIwGniDMDQqjVn4SZgnFpsYY= @@ -90,6 +94,18 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cockroachdb/errors v1.11.3 h1:5bA+k2Y6r+oz/6Z/RFlNeVCesGARKuC6YymtcDrbC/I= +github.com/cockroachdb/errors v1.11.3/go.mod h1:m4UIW4CDjx+R5cybPsNrRbreomiFqt8o1h1wUVazSd8= +github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce h1:giXvy4KSc/6g/esnpM7Geqxka4WSqI1SZc7sMJFd3y4= +github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce/go.mod h1:9/y3cnZ5GKakj/H4y9r9GTjCvAFta7KLgSHPJJYc52M= +github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= +github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= +github.com/cockroachdb/pebble v1.1.2 h1:CUh2IPtR4swHlEj48Rhfzw6l/d0qA31fItcIszQVIsA= +github.com/cockroachdb/pebble v1.1.2/go.mod h1:4exszw1r40423ZsmkG/09AFEG83I0uDgfujJdbL6kYU= +github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30= +github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= +github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= +github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -124,8 +140,12 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= +github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E= +github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= +github.com/getsentry/sentry-go v0.27.0 h1:Pv98CIbtB3LkMWmXi4Joa5OOcwbmnX88sF5qbK3r3Ps= +github.com/getsentry/sentry-go v0.27.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -133,6 +153,8 @@ github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw= github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang-jwt/jwt/v4 v4.3.0 h1:kHL1vqdqWNfATmA0FNMdmZNMyZI1U6O31X4rlIPoBog= github.com/golang-jwt/jwt/v4 v4.3.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= @@ -160,6 +182,8 @@ github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvq github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk= github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= @@ -219,8 +243,8 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/herumi/bls-go-binary v1.31.0 h1:L1goQ2tMtGgpXCg5AwHAdJQpLs/pfnWWEc3Wog6OhmI= github.com/herumi/bls-go-binary v1.31.0/go.mod h1:O4Vp1AfR4raRGwFeQpr9X/PQtncEicMoOe6BQt1oX0Y= -github.com/hitenjain14/fasthttp v0.0.0-20240527123209-06019e79bff9 h1:Z6Mu2JCsW2hbqx91L0HNPRPQ10RyAFvPocQHlrRo1Jk= -github.com/hitenjain14/fasthttp v0.0.0-20240527123209-06019e79bff9/go.mod h1:RZMcXy7u4S+E97IXYTe7WHZ3+mCYOh4vys8PkIGZeXk= +github.com/hitenjain14/fasthttp v0.0.0-20240916135632-f9303a91736c h1:lDSIbcLu5TdT+uwb4wPzZgo1pQvKjP/tArL5QKjDJdI= +github.com/hitenjain14/fasthttp v0.0.0-20240916135632-f9303a91736c/go.mod h1:RZMcXy7u4S+E97IXYTe7WHZ3+mCYOh4vys8PkIGZeXk= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= github.com/holiman/uint256 v1.2.2-0.20230321075855-87b91420868c h1:DZfsyhDK1hnSS5lH8l+JggqzEleHteTYfutAiVlSUM8= @@ -274,6 +298,8 @@ github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/ github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI= +github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM= github.com/minio/sha256-simd v1.0.1/go.mod h1:Pz6AKMiUdngCLpeTL/RJY1M9rUuPMYujV5xJjtbRSN8= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= @@ -304,7 +330,15 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v1.12.0 h1:C+UIj/QWtmqY13Arb8kwMt5j34/0Z2iKamrJ+ryC0Gg= +github.com/prometheus/client_golang v1.12.0/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.2.1-0.20210607210712-147c58e9608a h1:CmF68hwI0XsOQ5UwlBopMi2Ow4Pbg32akc4KIVCOm+Y= +github.com/prometheus/client_model v0.2.1-0.20210607210712-147c58e9608a/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= +github.com/prometheus/common v0.32.1 h1:hWIdL3N2HoUx3B8j3YN9mWor0qhY/NlEKZEaXxuIRh4= +github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= +github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU= +github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/tsdb v0.7.1 h1:YZcsG11NqnK4czYLrWd9mpEuAJIHVQLwdrleYfszMAA= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/remeh/sizedwaitgroup v1.0.0 h1:VNGGFwNo/R5+MJBf6yrsr110p0m4/OX4S3DCy7Kyl5E= @@ -315,8 +349,8 @@ github.com/rivo/uniseg v0.4.3/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUc github.com/rjeczalik/notify v0.9.1 h1:CLCKso/QK1snAlnhNR/CNvNiFU2saUtjV0bx3EwNeCE= github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= -github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= @@ -341,8 +375,9 @@ github.com/status-im/keycard-go v0.2.0 h1:QDLFswOQu1r5jsycloeQh3bVU8n/NatHHaZobt github.com/status-im/keycard-go v0.2.0/go.mod h1:wlp8ZLbsmrF6g6WjugPAx+IzoLrkdf9+mHxBEeo3Hbg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= @@ -351,8 +386,8 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8= github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= @@ -371,6 +406,8 @@ github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6Kllzaw github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasthttp v1.51.0 h1:8b30A5JlZ6C7AS81RsWjYMQmrZG6feChmgAolCl1SqA= github.com/valyala/fasthttp v1.51.0/go.mod h1:oI2XroL+lI7vdXyYoQk03bXBThfFl2cVdIA3Xl7cH8g= +github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= +github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -415,8 +452,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= -golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= +golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -427,6 +464,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df h1:UA2aFVmmsIlefxMk29Dp2juaUSth8Pyn3Tq5Y5mJGME= +golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -504,8 +543,8 @@ golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= -golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190124100055-b90733256f2e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -551,8 +590,8 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -708,6 +747,8 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From 0beaba312f742f28c91ccddab73e56edf4eb865d Mon Sep 17 00:00:00 2001 From: Jayash Satolia Date: Sun, 20 Oct 2024 02:21:02 +0530 Subject: [PATCH 212/228] Feature multi wallet --- cmd/walletinfo.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/walletinfo.go b/cmd/walletinfo.go index f7d44bcf..16aba871 100644 --- a/cmd/walletinfo.go +++ b/cmd/walletinfo.go @@ -48,11 +48,11 @@ var walletinfoCmd = &cobra.Command{ fmt.Println("Error getting the public key for encryption. ", err.Error()) return } - data[0] = []string{client.PublicKey(), client.ClientID(), encPubKey} + data[0] = []string{client.PublicKey(), client.Id(), encPubKey} if doJSON { j := make(map[string]string) j["client_public_key"] = client.PublicKey() - j["client_id"] = client.ClientID() + j["client_id"] = client.Id() j["encryption_public_key"] = encPubKey util.PrintJSON(j) return @@ -70,7 +70,7 @@ var signCmd = &cobra.Command{ Run: func(cmd *cobra.Command, args []string) { data, _ := cmd.Flags().GetString("data") if data == "" { - data = client.ClientID() + data = client.Id() } else { data = encryption.Hash(data) } From 1f0469866b8471eae7c6073aae8332e68577a755 Mon Sep 17 00:00:00 2001 From: dabasov Date: Tue, 22 Oct 2024 21:36:38 +0300 Subject: [PATCH 213/228] updated gosdk --- go.mod | 10 +++++----- go.sum | 15 ++++----------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/go.mod b/go.mod index aecd3151..2f3a5b5b 100644 --- a/go.mod +++ b/go.mod @@ -1,10 +1,12 @@ module github.com/0chain/zboxcli -go 1.21 +go 1.22.0 + +toolchain go1.22.5 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.17.10-0.20240922210048-bdbd749b25b1 + github.com/0chain/gosdk v1.18.0-RC3 github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 @@ -32,8 +34,6 @@ require ( github.com/h2non/filetype v1.1.4-0.20231228185113-6469358c2bcb // indirect github.com/hack-pad/go-webworkers v0.1.0 // indirect github.com/hack-pad/safejs v0.1.1 // indirect - github.com/hashicorp/go-cleanhttp v0.5.2 // indirect - github.com/hashicorp/go-retryablehttp v0.7.2 // indirect github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect github.com/hashicorp/golang-lru/v2 v2.0.1 // indirect github.com/hashicorp/hcl v1.0.0 // indirect @@ -75,7 +75,7 @@ require ( go.uber.org/atomic v1.10.0 // indirect go.uber.org/multierr v1.9.0 // indirect go.uber.org/zap v1.24.0 // indirect - golang.org/x/crypto v0.26.0 // indirect + golang.org/x/crypto v0.26.0 // indirect golang.org/x/sync v0.8.0 // indirect golang.org/x/sys v0.23.0 // indirect golang.org/x/text v0.17.0 // indirect diff --git a/go.sum b/go.sum index d24bd735..77669f05 100644 --- a/go.sum +++ b/go.sum @@ -40,8 +40,8 @@ github.com/0chain/common v1.13.1-0.20240926135437-61b88d39bbbd h1:PDnzyJJA4rF2LB github.com/0chain/common v1.13.1-0.20240926135437-61b88d39bbbd/go.mod h1:vHK9Q0/nz28PxmKsLSMLzEs5iK6QVgl1LxdDQdR7y6s= 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.17.10-0.20240922210048-bdbd749b25b1 h1:EQFVDPMXbLn9h1XERahmdkmQqDAn1FMhBN9APiWXQzI= -github.com/0chain/gosdk v1.17.10-0.20240922210048-bdbd749b25b1/go.mod h1:3gt3zG/TQRn+ymsGD8DaOQhKoPHADjtcvqX52JzYUW4= +github.com/0chain/gosdk v1.18.0-RC3 h1:62E+HIprNStAZA/BJw6rGI8pQa7iY0PyeKux9ot0duU= +github.com/0chain/gosdk v1.18.0-RC3/go.mod h1:OxXnxfqGJ9OIwX7WITV/A9ZctYorVMbaHuqkhERAImU= 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= @@ -197,8 +197,8 @@ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= @@ -232,13 +232,6 @@ github.com/hack-pad/safejs v0.1.1 h1:d5qPO0iQ7h2oVtpzGnLExE+Wn9AtytxIfltcS2b9KD8 github.com/hack-pad/safejs v0.1.1/go.mod h1:HdS+bKF1NrE72VoXZeWzxFOVQVUSqZJAG0xNCnb+Tio= github.com/hashicorp/go-bexpr v0.1.10 h1:9kuI5PFotCboP3dkDYFr/wi0gg0QVbSNz5oFRpxn4uE= github.com/hashicorp/go-bexpr v0.1.10/go.mod h1:oxlubA2vC/gFVfX1A6JGp7ls7uCDlfJn732ehYYg+g0= -github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= -github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= -github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= -github.com/hashicorp/go-hclog v1.2.0 h1:La19f8d7WIlm4ogzNHB0JGqs5AUDAZ2UfCY4sJXcJdM= -github.com/hashicorp/go-hclog v1.2.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= -github.com/hashicorp/go-retryablehttp v0.7.2 h1:AcYqCvkpalPnPF2pn0KamgwamS42TqUDDYFRKq/RAd0= -github.com/hashicorp/go-retryablehttp v0.7.2/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d h1:dg1dEPuWpEqDnvIw251EVy4zlP8gWbsGj4BsUKCRpYs= From ba69bd79af6b309f33a23bba202574ad34091d57 Mon Sep 17 00:00:00 2001 From: dabasov Date: Tue, 22 Oct 2024 21:54:20 +0300 Subject: [PATCH 214/228] updated gosdk --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 2f3a5b5b..20182749 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-RC3 + github.com/0chain/gosdk v1.18.0-RC4 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.13.1-0.20240926135437-61b88d39bbbd // indirect + github.com/0chain/common v1.18.0 // 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 77669f05..4f59d3b2 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.13.1-0.20240926135437-61b88d39bbbd h1:PDnzyJJA4rF2LBW+0OQJ5y9vIwsPYYjbbFwImvgiDdY= -github.com/0chain/common v1.13.1-0.20240926135437-61b88d39bbbd/go.mod h1:vHK9Q0/nz28PxmKsLSMLzEs5iK6QVgl1LxdDQdR7y6s= +github.com/0chain/common v1.18.0 h1:vCkD869DR0zTZS4CDl5MMN3qixxyfTNxDDcHp7cTRrc= +github.com/0chain/common v1.18.0/go.mod h1:vHK9Q0/nz28PxmKsLSMLzEs5iK6QVgl1LxdDQdR7y6s= 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-RC3 h1:62E+HIprNStAZA/BJw6rGI8pQa7iY0PyeKux9ot0duU= -github.com/0chain/gosdk v1.18.0-RC3/go.mod h1:OxXnxfqGJ9OIwX7WITV/A9ZctYorVMbaHuqkhERAImU= +github.com/0chain/gosdk v1.18.0-RC4 h1:0FoQA0+1Rz4ic1rZLUeKLeAe+zCSCst+5lYafrz2m7g= +github.com/0chain/gosdk v1.18.0-RC4/go.mod h1:BJQPX/J6ShHV5ViGjh5aCooQD/aOhvBfnfkBOuSIFfQ= 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= From 508438e96d855e41aa62004f4cb7de969adffabc Mon Sep 17 00:00:00 2001 From: Hitenjain14 Date: Wed, 30 Oct 2024 14:35:30 +0530 Subject: [PATCH 215/228] session key --- cmd/updateallocation.go | 9 ++++++--- go.mod | 4 ++-- go.sum | 8 ++++---- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/cmd/updateallocation.go b/cmd/updateallocation.go index af49b350..e99e1bc5 100755 --- a/cmd/updateallocation.go +++ b/cmd/updateallocation.go @@ -1,12 +1,13 @@ package cmd import ( - "github.com/0chain/gosdk/zboxcore/sdk" - "github.com/0chain/gosdk/zcncore" - "github.com/spf13/cobra" "log" "os" "sync" + + "github.com/0chain/gosdk/zboxcore/sdk" + "github.com/0chain/gosdk/zcncore" + "github.com/spf13/cobra" ) // updateAllocationCmd used to change allocation size and expiration @@ -135,6 +136,7 @@ var updateAllocationCmd = &cobra.Command{ addBlobberId, addBlobberAuthTicket, removeBlobberId, + "", setThirdPartyExtendable, &fileOptionParams, statusBar, @@ -157,6 +159,7 @@ var updateAllocationCmd = &cobra.Command{ addBlobberId, addBlobberAuthTicket, removeBlobberId, + "", setThirdPartyExtendable, &fileOptionParams, ) diff --git a/go.mod b/go.mod index 20182749..0d69a1bc 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-RC4 + github.com/0chain/gosdk v1.18.0-RC8.0.20241028155703-82a3092d4a0c 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.0 // indirect + github.com/0chain/common v1.18.1 // 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 4f59d3b2..1abeb1d6 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.0 h1:vCkD869DR0zTZS4CDl5MMN3qixxyfTNxDDcHp7cTRrc= -github.com/0chain/common v1.18.0/go.mod h1:vHK9Q0/nz28PxmKsLSMLzEs5iK6QVgl1LxdDQdR7y6s= +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/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-RC4 h1:0FoQA0+1Rz4ic1rZLUeKLeAe+zCSCst+5lYafrz2m7g= -github.com/0chain/gosdk v1.18.0-RC4/go.mod h1:BJQPX/J6ShHV5ViGjh5aCooQD/aOhvBfnfkBOuSIFfQ= +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/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= From 6f376edbafcc321262e80ff063cf4ae6388d5025 Mon Sep 17 00:00:00 2001 From: Jayash Satolia Date: Wed, 30 Oct 2024 15:14:31 +0530 Subject: [PATCH 216/228] Update zbox build --- .github/workflows/build-zbox.yaml | 6 +++--- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/distribute-zboxcli-apt.yml | 6 +++--- .github/workflows/release-zboxcli.yml | 6 +++--- .github/workflows/release.yml | 6 +++--- .github/workflows/tests.yml | 4 ++-- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build-zbox.yaml b/.github/workflows/build-zbox.yaml index 794bf13c..b6019c4e 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: | @@ -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 @@ -115,7 +115,7 @@ jobs: go-version: '1.21' - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install run: make install 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..b60d1a68 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: | @@ -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 @@ -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 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..f68076d3 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: | From 33295fb6f7bcf12d0cff302799b80e3bfa8b912f Mon Sep 17 00:00:00 2001 From: Jayash Satolia Date: Wed, 30 Oct 2024 15:16:00 +0530 Subject: [PATCH 217/228] Update zbox build --- .github/workflows/build-zbox.yaml | 6 +++--- .github/workflows/release-zboxcli.yml | 6 +++--- .github/workflows/tests.yml | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-zbox.yaml b/.github/workflows/build-zbox.yaml index b6019c4e..3e0e792c 100644 --- a/.github/workflows/build-zbox.yaml +++ b/.github/workflows/build-zbox.yaml @@ -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 @@ -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 @@ -121,7 +121,7 @@ jobs: 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/release-zboxcli.yml b/.github/workflows/release-zboxcli.yml index b60d1a68..e5badc50 100644 --- a/.github/workflows/release-zboxcli.yml +++ b/.github/workflows/release-zboxcli.yml @@ -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 @@ -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 @@ -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/tests.yml b/.github/workflows/tests.yml index f68076d3..71e06f68 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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 From 34313986bc3cde8452d6f8d53bc5c0207af18b33 Mon Sep 17 00:00:00 2001 From: Jayash Satolia Date: Wed, 30 Oct 2024 15:18:51 +0530 Subject: [PATCH 218/228] Fix build --- cmd/newallocation.go | 2 +- cmd/storage.go | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/cmd/newallocation.go b/cmd/newallocation.go index ba0a5969..8bcdf2a5 100755 --- a/cmd/newallocation.go +++ b/cmd/newallocation.go @@ -266,7 +266,7 @@ var newallocationCmd = &cobra.Command{ ThirdPartyExtendable: thirdPartyExtendable, Force: force, IsEnterprise: isEnterprise, - StorageVersion: storageVersion, + StorageVersion: int(storageVersion), } allocationID, _, _, err = sdk.CreateAllocationWith(options) if err != nil { diff --git a/cmd/storage.go b/cmd/storage.go index 9efedbfc..4eafcf31 100644 --- a/cmd/storage.go +++ b/cmd/storage.go @@ -2,6 +2,7 @@ package cmd import ( "fmt" + "github.com/0chain/gosdk/core/transaction" "log" "time" @@ -23,7 +24,7 @@ var scConfig = &cobra.Command{ Run: func(cmd *cobra.Command, args []string) { doJSON, _ := cmd.Flags().GetBool("json") - var conf, err = sdk.GetStorageSCConfig() + var conf, err = transaction.GetConfig("storage_sc_config") if err != nil { log.Fatalf("Failed to get storage SC configurations: %v", err) } @@ -315,10 +316,10 @@ var blobberUpdateCmd = &cobra.Command{ } var resetBlobberStatsCmd = &cobra.Command{ - Use: "reset-blobber-stats", - Short: "Reset blobber stats", - Long: `Reset blobber stats`, - Args: cobra.MinimumNArgs(0), + Use: "reset-blobber-stats", + Short: "Reset blobber stats", + Long: `Reset blobber stats`, + Args: cobra.MinimumNArgs(0), Hidden: true, Run: func(cmd *cobra.Command, args []string) { var ( From 54dc98ebca8340262a9b096faf12e1d78811bb78 Mon Sep 17 00:00:00 2001 From: Jayash Satolia Date: Wed, 30 Oct 2024 15:31:42 +0530 Subject: [PATCH 219/228] Update gosdk --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 20182749..14a7db34 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-RC4 + github.com/0chain/gosdk v1.18.0-RC8 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.0 // indirect + github.com/0chain/common v1.18.1 // 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 4f59d3b2..c89d02f3 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.0 h1:vCkD869DR0zTZS4CDl5MMN3qixxyfTNxDDcHp7cTRrc= -github.com/0chain/common v1.18.0/go.mod h1:vHK9Q0/nz28PxmKsLSMLzEs5iK6QVgl1LxdDQdR7y6s= +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/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-RC4 h1:0FoQA0+1Rz4ic1rZLUeKLeAe+zCSCst+5lYafrz2m7g= -github.com/0chain/gosdk v1.18.0-RC4/go.mod h1:BJQPX/J6ShHV5ViGjh5aCooQD/aOhvBfnfkBOuSIFfQ= +github.com/0chain/gosdk v1.18.0-RC8 h1:QT9AVC/kDaq9dhjmKBt5ZqmhHa/LoUlSCTKAIsQSrAw= +github.com/0chain/gosdk v1.18.0-RC8/go.mod h1:fw3TUzF7HWNBuksA2WZzLcHlMz+A1XA9as5i3KUBqXg= 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= From b6ac1fcf9a0ead70180bbd40b30abf9d161763b7 Mon Sep 17 00:00:00 2001 From: dabasov Date: Fri, 1 Nov 2024 20:11:49 +0200 Subject: [PATCH 220/228] updated gosdk --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 20182749..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-RC4 + 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.0 // 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 4f59d3b2..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.0 h1:vCkD869DR0zTZS4CDl5MMN3qixxyfTNxDDcHp7cTRrc= -github.com/0chain/common v1.18.0/go.mod h1:vHK9Q0/nz28PxmKsLSMLzEs5iK6QVgl1LxdDQdR7y6s= +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-RC4 h1:0FoQA0+1Rz4ic1rZLUeKLeAe+zCSCst+5lYafrz2m7g= -github.com/0chain/gosdk v1.18.0-RC4/go.mod h1:BJQPX/J6ShHV5ViGjh5aCooQD/aOhvBfnfkBOuSIFfQ= +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= From 47f98258058b7b43701217138e7f41b593183cbe Mon Sep 17 00:00:00 2001 From: Jayash Satolia Date: Sat, 2 Nov 2024 23:17:30 +0530 Subject: [PATCH 221/228] Update blobber version reset --- cmd/storage.go | 37 +++++++++++++++++++++++++++++++++++++ go.mod | 2 +- go.sum | 4 ++-- 3 files changed, 40 insertions(+), 3 deletions(-) diff --git a/cmd/storage.go b/cmd/storage.go index 4eafcf31..7f65222d 100644 --- a/cmd/storage.go +++ b/cmd/storage.go @@ -385,12 +385,45 @@ var resetBlobberStatsCmd = &cobra.Command{ }, } +var resetVersionCmd = &cobra.Command{ + Use: "reset-version", + Short: "Reset blobber version", + Long: `Reset blobber version`, + Args: cobra.MinimumNArgs(0), + Run: func(cmd *cobra.Command, args []string) { + var ( + flags = cmd.Flags() + + blobberID string + err error + ) + + if !flags.Changed("blobber_id") { + log.Fatal("missing required 'blobber_id' flag") + } + if blobberID, err = flags.GetString("blobber_id"); err != nil { + log.Fatal("error in 'blobber_id' flag: ", err) + } + + snv := sdk.StorageNodeVersion{ + Id: blobberID, + } + + _, _, err = sdk.ResetBlobberVersion(&snv) + if err != nil { + log.Fatal(err) + } + fmt.Println("reset blobber version successfully") + }, +} + func init() { rootCmd.AddCommand(scConfig) rootCmd.AddCommand(lsBlobers) rootCmd.AddCommand(blobberInfoCmd) rootCmd.AddCommand(blobberUpdateCmd) rootCmd.AddCommand(resetBlobberStatsCmd) + rootCmd.AddCommand(resetVersionCmd) scConfig.Flags().Bool("json", false, "(default false) pass this option to print response as json data") lsBlobers.Flags().Bool("json", false, "(default false) pass this option to print response as json data") @@ -429,4 +462,8 @@ func init() { resetBlobberStatsCmd.MarkFlagRequired("prev_saved_data") resetBlobberStatsCmd.MarkFlagRequired("new_allocated") resetBlobberStatsCmd.MarkFlagRequired("new_saved_data") + + resetVersionCmd.Flags().String("blobber_id", "", "blobber_id is required") + resetVersionCmd.MarkFlagRequired("blobber_id") + } diff --git a/go.mod b/go.mod index bda53c46..d90255a7 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-RC9 + github.com/0chain/gosdk v1.18.0-RC9.0.20241102174613-5e66d116bc76 github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 diff --git a/go.sum b/go.sum index c9083279..b119a4e4 100644 --- a/go.sum +++ b/go.sum @@ -40,8 +40,8 @@ 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-RC9 h1:vGkdZnt7uS+1OmgS1Qv/6wFPlZqUoJvqWuenf0tMffs= -github.com/0chain/gosdk v1.18.0-RC9/go.mod h1:q/zFTOMHU2hFGjFzIxCOZLonsmrSzYVP3ExCHHOmL6w= +github.com/0chain/gosdk v1.18.0-RC9.0.20241102174613-5e66d116bc76 h1:2QLTENTe36oXi8ZohLVRdxbXGcFaqLPMryKJpjmFmKU= +github.com/0chain/gosdk v1.18.0-RC9.0.20241102174613-5e66d116bc76/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= From 8a61a54b74b188ae21dee9a3b014fda86e164349 Mon Sep 17 00:00:00 2001 From: Jayash Satolia Date: Sun, 3 Nov 2024 04:50:36 +0530 Subject: [PATCH 222/228] Added insert killed ID cmd --- cmd/storage.go | 37 ++++++++++++++++++++++++++++++++++++- go.mod | 2 +- go.sum | 4 ++-- 3 files changed, 39 insertions(+), 4 deletions(-) diff --git a/cmd/storage.go b/cmd/storage.go index 7f65222d..f1b954e4 100644 --- a/cmd/storage.go +++ b/cmd/storage.go @@ -405,7 +405,7 @@ var resetVersionCmd = &cobra.Command{ log.Fatal("error in 'blobber_id' flag: ", err) } - snv := sdk.StorageNodeVersion{ + snv := sdk.StorageNodeIdField{ Id: blobberID, } @@ -417,6 +417,38 @@ var resetVersionCmd = &cobra.Command{ }, } +var insertKilledProviderId = &cobra.Command{ + Use: "insert-killed-provider-id", + Short: "Insert killed provider id", + Long: `Insert killed provider id`, + Args: cobra.MinimumNArgs(0), + Run: func(cmd *cobra.Command, args []string) { + var ( + flags = cmd.Flags() + + blobberID string + err error + ) + + if !flags.Changed("id") { + log.Fatal("missing required 'blobber_id' flag") + } + if blobberID, err = flags.GetString("id"); err != nil { + log.Fatal("error in 'id' flag: ", err) + } + + snv := sdk.StorageNodeIdField{ + Id: blobberID, + } + + _, _, err = sdk.InsertKilledProviderID(&snv) + if err != nil { + log.Fatal(err) + } + fmt.Println("insert killed id successfully") + }, +} + func init() { rootCmd.AddCommand(scConfig) rootCmd.AddCommand(lsBlobers) @@ -424,6 +456,7 @@ func init() { rootCmd.AddCommand(blobberUpdateCmd) rootCmd.AddCommand(resetBlobberStatsCmd) rootCmd.AddCommand(resetVersionCmd) + rootCmd.AddCommand(insertKilledProviderId) scConfig.Flags().Bool("json", false, "(default false) pass this option to print response as json data") lsBlobers.Flags().Bool("json", false, "(default false) pass this option to print response as json data") @@ -466,4 +499,6 @@ func init() { resetVersionCmd.Flags().String("blobber_id", "", "blobber_id is required") resetVersionCmd.MarkFlagRequired("blobber_id") + insertKilledProviderId.Flags().String("id", "", "blobber_id is required") + insertKilledProviderId.MarkFlagRequired("id") } diff --git a/go.mod b/go.mod index d90255a7..f3d9d3e5 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-RC9.0.20241102174613-5e66d116bc76 + github.com/0chain/gosdk v1.18.0-RC9.0.20241102231902-9c92d4dd209b github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 diff --git a/go.sum b/go.sum index b119a4e4..279d983c 100644 --- a/go.sum +++ b/go.sum @@ -40,8 +40,8 @@ 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-RC9.0.20241102174613-5e66d116bc76 h1:2QLTENTe36oXi8ZohLVRdxbXGcFaqLPMryKJpjmFmKU= -github.com/0chain/gosdk v1.18.0-RC9.0.20241102174613-5e66d116bc76/go.mod h1:q/zFTOMHU2hFGjFzIxCOZLonsmrSzYVP3ExCHHOmL6w= +github.com/0chain/gosdk v1.18.0-RC9.0.20241102231902-9c92d4dd209b h1:lqMdCKcKi+wVq7KeownBlYLrtqdkKopSnbALEti/SVs= +github.com/0chain/gosdk v1.18.0-RC9.0.20241102231902-9c92d4dd209b/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= From 8136b7d4f7aecd700e7dd4881be3bc2b11f407e5 Mon Sep 17 00:00:00 2001 From: dabasov Date: Wed, 13 Nov 2024 17:05:57 +0200 Subject: [PATCH 223/228] updated gosdk --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index f3d9d3e5..99113929 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-RC9.0.20241102231902-9c92d4dd209b + github.com/0chain/gosdk v1.18.0 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.2 // indirect + github.com/0chain/common v1.18.3 // 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 279d983c..9a0ddcc2 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.2 h1:VGWfd3Xqio9xbmebPFnUbuk5QN0pK0xzvifaUggJF5g= -github.com/0chain/common v1.18.2/go.mod h1:Lapu2Tj7z5Sm4r+X141e7vsz4NDODTEypeElYAP3iSw= +github.com/0chain/common v1.18.3 h1:42dYOv2KyMTSanuS67iDtfv+ErbSRqR8NJ3MG72MwaI= +github.com/0chain/common v1.18.3/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-RC9.0.20241102231902-9c92d4dd209b h1:lqMdCKcKi+wVq7KeownBlYLrtqdkKopSnbALEti/SVs= -github.com/0chain/gosdk v1.18.0-RC9.0.20241102231902-9c92d4dd209b/go.mod h1:q/zFTOMHU2hFGjFzIxCOZLonsmrSzYVP3ExCHHOmL6w= +github.com/0chain/gosdk v1.18.0 h1:6mSiUFb4liT50wdsx59tEWMHKWkKQUlZT91ouQAeKcc= +github.com/0chain/gosdk v1.18.0/go.mod h1:8unFy9Dx2YyPKMYPDGR3MFhUEymbAfQcRDm9bobVLGw= 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= From b91e834930a6865326670794fa20024e71ddcdc9 Mon Sep 17 00:00:00 2001 From: Jayash Satolia Date: Mon, 18 Nov 2024 05:22:26 +0530 Subject: [PATCH 224/228] Fix storage_version type --- cmd/storage.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/storage.go b/cmd/storage.go index f1b954e4..07e4adeb 100644 --- a/cmd/storage.go +++ b/cmd/storage.go @@ -471,7 +471,7 @@ func init() { buf := blobberUpdateCmd.Flags() buf.String("blobber_id", "", "blobber ID, required") buf.String("delegate_wallet", "", "delegate wallet, optional") - buf.Int64("storage_version", 0, "update storage version, optional") + buf.Int("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") From 92ff974364bdc0583e0438c5582dbce1e9105f43 Mon Sep 17 00:00:00 2001 From: storybehind Date: Wed, 20 Nov 2024 17:48:19 +0530 Subject: [PATCH 225/228] update go version --- .github/workflows/distribute-zboxcli-apt.yml | 1 - .github/workflows/distribute-zboxcli-choco.yml | 2 +- .github/workflows/release.yml | 3 ++- scripts/debian/Dockerfile.build | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/distribute-zboxcli-apt.yml b/.github/workflows/distribute-zboxcli-apt.yml index 6cc9bc9d..47ba6aa6 100644 --- a/.github/workflows/distribute-zboxcli-apt.yml +++ b/.github/workflows/distribute-zboxcli-apt.yml @@ -11,7 +11,6 @@ on: env: APP_NAME: zbox APP_VERSION: ${{ github.event.inputs.version }} - GO_VERSION: 1.21.0 REMOTE_SERVER: 5.9.151.246 REMOTE_USER: root diff --git a/.github/workflows/distribute-zboxcli-choco.yml b/.github/workflows/distribute-zboxcli-choco.yml index f6e6fc4a..a0adfeb7 100644 --- a/.github/workflows/distribute-zboxcli-choco.yml +++ b/.github/workflows/distribute-zboxcli-choco.yml @@ -12,7 +12,7 @@ env: APP_NAME: zbox PACKAGE_ID: zbox APP_VERSION: ${{ github.event.inputs.version }} - GO_VERSION: '1.21' + GO_VERSION: '1.22' jobs: build: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 38dd201a..22925d57 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,7 +23,7 @@ env: GITHUB_TOKEN: ${{ secrets.GOSDK }} VERSION: ${{ github.event.inputs.version }} APP_NAME: zbox - GO_VERSION: 1.21 + GO_VERSION: 1.22 jobs: create_release: @@ -74,6 +74,7 @@ jobs: docker buildx build \ --platform linux/amd64 \ --build-arg VERSION=${{ env.VERSION }} \ + --build-arg GO --tag ${{ env.APP_NAME }}-amd64 \ --load \ --output type=docker,dest=${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}-amd64.tar \ diff --git a/scripts/debian/Dockerfile.build b/scripts/debian/Dockerfile.build index 55951ffd..4ff29079 100644 --- a/scripts/debian/Dockerfile.build +++ b/scripts/debian/Dockerfile.build @@ -1,4 +1,4 @@ -FROM --platform=$TARGETPLATFORM golang:1.21 AS build +FROM --platform=$TARGETPLATFORM golang:1.22 AS build ARG VERSION WORKDIR /src COPY go.mod go.sum . From 89e7040f78718f5086c8597b281178ddd59760a1 Mon Sep 17 00:00:00 2001 From: storybehind Date: Wed, 20 Nov 2024 17:59:29 +0530 Subject: [PATCH 226/228] fix release yml --- .github/workflows/release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 22925d57..de45c3bc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -74,7 +74,6 @@ jobs: docker buildx build \ --platform linux/amd64 \ --build-arg VERSION=${{ env.VERSION }} \ - --build-arg GO --tag ${{ env.APP_NAME }}-amd64 \ --load \ --output type=docker,dest=${{ env.OUTPUT_DIR }}/${{ env.APP_NAME }}-amd64.tar \ From b7219272c6208af61f8f21946c9709ead4db60c8 Mon Sep 17 00:00:00 2001 From: Yaroslav Svitlytskyi Date: Fri, 6 Dec 2024 21:22:56 +0100 Subject: [PATCH 227/228] feature: added kms wallet detection --- cmd/root.go | 15 ++++++++++++--- go.mod | 2 +- go.sum | 2 ++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index bc3fef4f..66b1abfd 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -167,17 +167,26 @@ func initConfig() { //init the storage sdk with the known miners, sharders and client wallet info if err = client.InitSDK( - walletJSON, + "{}", cfg.BlockWorker, cfg.ChainID, cfg.SignatureScheme, - nonce, - false, true, + nonce, false, int(zcncore.ConvertToValue(txFee)), ); err != nil { fmt.Println("Error in sdk init", err) os.Exit(1) } + err = zcncore.SetGeneralWalletInfo(walletJSON, cfg.SignatureScheme) + if err != nil { + fmt.Println("Error in sdk init", err) + os.Exit(1) + } + + if client.GetClient().IsSplit { + zcncore.RegisterZauthServer(cfg.ZauthServer) + } + sdk.SetNumBlockDownloads(10) } diff --git a/go.mod b/go.mod index 99113929..e8aa1088 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 + github.com/0chain/gosdk v1.18.12-0.20241206200527-e3e37f887e16 github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 diff --git a/go.sum b/go.sum index 9a0ddcc2..bea4d1f4 100644 --- a/go.sum +++ b/go.sum @@ -42,6 +42,8 @@ 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 h1:6mSiUFb4liT50wdsx59tEWMHKWkKQUlZT91ouQAeKcc= github.com/0chain/gosdk v1.18.0/go.mod h1:8unFy9Dx2YyPKMYPDGR3MFhUEymbAfQcRDm9bobVLGw= +github.com/0chain/gosdk v1.18.12-0.20241206200527-e3e37f887e16 h1:UguPfAV0B/d/J1JWlxbkUlBKP3QlVmuATO8OaaHg/Qk= +github.com/0chain/gosdk v1.18.12-0.20241206200527-e3e37f887e16/go.mod h1:8unFy9Dx2YyPKMYPDGR3MFhUEymbAfQcRDm9bobVLGw= 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= From 11c2d11c5f78b1ecf8ad36b1a01ae9017cbd118c Mon Sep 17 00:00:00 2001 From: Hitenjain14 Date: Wed, 11 Dec 2024 18:53:30 +0700 Subject: [PATCH 228/228] update gosdk --- go.mod | 2 +- go.sum | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index e8aa1088..72c57694 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.12-0.20241206200527-e3e37f887e16 + github.com/0chain/gosdk v1.18.13 github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 diff --git a/go.sum b/go.sum index bea4d1f4..9a2983ea 100644 --- a/go.sum +++ b/go.sum @@ -40,10 +40,8 @@ github.com/0chain/common v1.18.3 h1:42dYOv2KyMTSanuS67iDtfv+ErbSRqR8NJ3MG72MwaI= github.com/0chain/common v1.18.3/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 h1:6mSiUFb4liT50wdsx59tEWMHKWkKQUlZT91ouQAeKcc= -github.com/0chain/gosdk v1.18.0/go.mod h1:8unFy9Dx2YyPKMYPDGR3MFhUEymbAfQcRDm9bobVLGw= -github.com/0chain/gosdk v1.18.12-0.20241206200527-e3e37f887e16 h1:UguPfAV0B/d/J1JWlxbkUlBKP3QlVmuATO8OaaHg/Qk= -github.com/0chain/gosdk v1.18.12-0.20241206200527-e3e37f887e16/go.mod h1:8unFy9Dx2YyPKMYPDGR3MFhUEymbAfQcRDm9bobVLGw= +github.com/0chain/gosdk v1.18.13 h1:yIq+BqhbvaIDZowerd62bp1BirJEYeg6JQ7GdFU2B90= +github.com/0chain/gosdk v1.18.13/go.mod h1:8unFy9Dx2YyPKMYPDGR3MFhUEymbAfQcRDm9bobVLGw= 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=