From 325d8a9cb46e69c630601ab523339ad89ab42e0a Mon Sep 17 00:00:00 2001 From: Matthias <5011972+fasmat@users.noreply.github.com> Date: Thu, 11 Jan 2024 16:18:49 +0000 Subject: [PATCH 1/9] Add docker image for postcli --- .github/workflows/docker.yml | 32 +++++++++++++++++++++ Dockerfile | 54 ++++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 .github/workflows/docker.yml create mode 100644 Dockerfile diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 000000000..139c79e6f --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,32 @@ +name: Docker Build and Push + +on: + workflow_dispatch: + release: + types: [published] + +jobs: + docker-build: + runs-on: ubuntu-latest + steps: + - name: Git Checkout + uses: actions/checkout@v4 + with: + submodules: true + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to DockerHub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + file: ./Dockerfile + push: true + tags: spacemeshos/postcli:latest, spacemeshos/postcli:${{ GITHUB.SHA }}, spacemeshos/postcli:${{ github.ref_name }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..87adadf17 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,54 @@ +FROM golang:1.21 as builder +RUN set -ex \ + && apt-get update --fix-missing \ + && apt-get install -qy --no-install-recommends \ + unzip sudo \ + ocl-icd-opencl-dev + +WORKDIR /src +COPY Makefile* . +RUN make get-postrs-lib + +# We want to populate the module cache based on the go.{mod,sum} files. +COPY go.mod . +COPY go.sum . + +RUN go mod download + +# Here we copy the rest of the source code +COPY . . + +# And compile the project +RUN --mount=type=cache,id=build,target=/root/.cache/go-build make build + +FROM ubuntu:22.04 AS postcli +ENV DEBIAN_FRONTEND noninteractive +ENV SHELL /bin/bash +ARG TZ=Etc/UTC +ENV TZ $TZ +USER root +RUN set -ex \ + && apt-get update --fix-missing \ + && apt-get install -qy --no-install-recommends \ + ca-certificates \ + tzdata \ + locales \ + procps \ + net-tools \ + file \ + ocl-icd-libopencl1 clinfo \ + pocl-opencl-icd libpocl2 \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* \ + && locale-gen en_US.UTF-8 \ + && update-locale LANG=en_US.UTF-8 \ + && echo "$TZ" > /etc/timezone +ENV LANG en_US.UTF-8 +ENV LANGUAGE en_US.UTF-8 +ENV LC_ALL en_US.UTF-8 + +# Finally we copy the statically compiled Go binary. +COPY --from=builder /src/build/postcli /bin/ +COPY --from=builder /src/build/libpost.so /bin/ + +ENTRYPOINT ["/bin/postcli"] From f82bf14c174373d1d0bf49eae40a57e26cae6fce Mon Sep 17 00:00:00 2001 From: Matthias <5011972+fasmat@users.noreply.github.com> Date: Thu, 11 Jan 2024 19:05:04 +0000 Subject: [PATCH 2/9] Allow setting Scrypt N value for initialization --- cmd/postcli/main.go | 91 +++++++++++++++++++++++++-------------------- 1 file changed, 50 insertions(+), 41 deletions(-) diff --git a/cmd/postcli/main.go b/cmd/postcli/main.go index aa45f5ed3..c04c5fae9 100644 --- a/cmd/postcli/main.go +++ b/cmd/postcli/main.go @@ -9,11 +9,9 @@ import ( "flag" "fmt" "log" - "math" "os" "os/signal" "path/filepath" - "strconv" "github.com/davecgh/go-spew/spew" "go.uber.org/zap" @@ -29,27 +27,6 @@ import ( const edKeyFileName = "key.bin" -type numUnitsFlag struct { - set bool - value uint32 -} - -func (nu *numUnitsFlag) Set(s string) error { - val, err := strconv.ParseUint(s, 10, 32) - if err != nil { - return err - } - *nu = numUnitsFlag{ - set: true, - value: uint32(val), - } - return nil -} - -func (nu *numUnitsFlag) String() string { - return fmt.Sprintf("%d", nu.value) -} - var ( cfg = config.MainnetConfig() opts = config.MainnetInitOpts() @@ -68,10 +45,13 @@ var ( commitmentAtxIdHex string commitmentAtxId []byte reset bool - numUnits numUnitsFlag + numUnits uint64 + yes bool logLevel zapcore.Level + flagSet = make(map[string]bool) + ErrKeyFileExists = errors.New("key file already exists") ) @@ -79,6 +59,7 @@ func parseFlags() { flag.BoolVar(&verifyPos, "verify", false, "verify initialized data") flag.Float64Var(&fraction, "fraction", 0.2, "how much % of POS data to verify. Sane values are < 1.0") + flag.BoolVar(&yes, "yes", false, "confirm potentially dangerous actions") flag.TextVar(&logLevel, "logLevel", zapcore.InfoLevel, "log level (debug, info, warn, error, dpanic, panic, fatal)") flag.BoolVar(&searchForNonce, "searchForNonce", false, "search for VRF nonce in already initialized files") @@ -90,46 +71,56 @@ func parseFlags() { flag.StringVar(&opts.DataDir, "datadir", opts.DataDir, "filesystem datadir path") flag.Uint64Var(&opts.MaxFileSize, "maxFileSize", opts.MaxFileSize, "max file size") var providerID uint64 - flag.Uint64Var(&providerID, "provider", math.MaxUint64, "compute provider id (required)") + flag.Uint64Var(&providerID, "provider", 0, "compute provider id (required)") flag.Uint64Var(&cfg.LabelsPerUnit, "labelsPerUnit", cfg.LabelsPerUnit, "the number of labels per unit") + flag.UintVar(&opts.Scrypt.N, "scryptN", opts.Scrypt.N, "scrypt N parameter") flag.BoolVar(&reset, "reset", false, "whether to reset the datadir before starting") flag.StringVar(&idHex, "id", "", "miner's id (public key), in hex (will be auto-generated if not provided)") flag.StringVar(&commitmentAtxIdHex, "commitmentAtxId", "", "commitment atx id, in hex (required)") - flag.Var(&numUnits, "numUnits", "number of units") + flag.Uint64Var(&numUnits, "numUnits", 0, "number of units (required)") flag.IntVar(&opts.FromFileIdx, "fromFile", 0, "index of the first file to init (inclusive)") var to int - flag.IntVar(&to, "toFile", math.MaxInt, "index of the last file to init (inclusive). Will init to the end of declared space if not provided.") + flag.IntVar(&to, "toFile", 0, "index of the last file to init (inclusive). Will init to the end of declared space if not provided.") flag.Parse() - // A workaround to simulate an optional value w/o a default ¯\_(ツ)_/¯ - // The default will be known later, after parsing the flags. - if to != math.MaxInt { + flag.Visit(func(f *flag.Flag) { + flagSet[f.Name] = true + }) + + if flagSet["toFile"] { opts.ToFileIdx = &to } - if providerID != math.MaxUint64 { - opts.ProviderID = new(uint32) - *opts.ProviderID = uint32(providerID) - } - if numUnits.set { - opts.NumUnits = numUnits.value - } + opts.ProviderID = new(uint32) + *opts.ProviderID = uint32(providerID) + opts.NumUnits = uint32(numUnits) } func processFlags() error { - // we require the user to explicitly pass numunits to avoid erasing existing data - if !numUnits.set { + // we require the user to explicitly pass numUnits to avoid erasing existing data + if !flagSet["numUnits"] { return fmt.Errorf("-numUnits must be specified to perform initialization. to use the default value, "+ "run with -numUnits %d. note: if there's more than this amount of data on disk, "+ "THIS WILL ERASE EXISTING DATA. MAKE ABSOLUTELY SURE YOU SPECIFY THE CORRECT VALUE", opts.NumUnits) } - if opts.ProviderID == nil { + if flagSet["numUnits"] && (numUnits < uint64(cfg.MinNumUnits) || numUnits > uint64(cfg.MaxNumUnits)) { + fmt.Println("WARNING: numUnits is outside of range valid for mainnet (min:", + cfg.MinNumUnits, "max:", cfg.MaxNumUnits, ")") + if !yes { + fmt.Println("If you're sure you want to continue, please run with -yes") + os.Exit(1) + } + cfg.MinNumUnits = uint32(numUnits) + cfg.MaxNumUnits = uint32(numUnits) + } + + if !flagSet["provider"] { return errors.New("-provider flag is required") } - if commitmentAtxIdHex == "" { + if !flagSet["commitmentAtxId"] { return errors.New("-commitmentAtxId flag is required") } var err error @@ -138,6 +129,24 @@ func processFlags() error { return fmt.Errorf("invalid commitmentAtxId: %w", err) } + if flagSet["labelsPerUnit"] && (cfg.LabelsPerUnit != config.MainnetConfig().LabelsPerUnit) { + fmt.Println("WARNING: labelsPerUnit is set to a non-default value. This makes the initialization incompatible " + + "with mainnet. If you're trying to initialize for mainnet, please remove the -labelsPerUnit flag") + if !yes { + fmt.Println("If you're sure you want to continue, please run with -yes") + os.Exit(1) + } + } + + if flagSet["scryptN"] { + fmt.Println("WARNING: scryptN is set to a non-default value. This makes the initialization incompatible " + + "with mainnet. If you're trying to initialize for mainnet, please remove the -scryptN flag") + if !yes { + fmt.Println("If you're sure you want to continue, please run with -yes") + os.Exit(1) + } + } + if (opts.FromFileIdx != 0 || opts.ToFileIdx != nil) && idHex == "" { return errors.New("-id flag is required when using -fromFile or -toFile") } From 9c7ec56411961c5a0380ea63c329bd7b1ba04b73 Mon Sep 17 00:00:00 2001 From: Matthias <5011972+fasmat@users.noreply.github.com> Date: Fri, 12 Jan 2024 13:06:29 +0000 Subject: [PATCH 3/9] Review feedback --- cmd/postcli/main.go | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/cmd/postcli/main.go b/cmd/postcli/main.go index c04c5fae9..9fee1b7ca 100644 --- a/cmd/postcli/main.go +++ b/cmd/postcli/main.go @@ -97,6 +97,21 @@ func parseFlags() { opts.NumUnits = uint32(numUnits) } +func askForConfirmation() { + if yes { + return + } + + fmt.Println("Are you sure you want to continue (y/N)?") + + var answer string + _, err := fmt.Scanln(&answer) + if err != nil || (answer != "y" && answer != "Y") { + fmt.Println("Aborting") + os.Exit(1) + } +} + func processFlags() error { // we require the user to explicitly pass numUnits to avoid erasing existing data if !flagSet["numUnits"] { @@ -108,10 +123,7 @@ func processFlags() error { if flagSet["numUnits"] && (numUnits < uint64(cfg.MinNumUnits) || numUnits > uint64(cfg.MaxNumUnits)) { fmt.Println("WARNING: numUnits is outside of range valid for mainnet (min:", cfg.MinNumUnits, "max:", cfg.MaxNumUnits, ")") - if !yes { - fmt.Println("If you're sure you want to continue, please run with -yes") - os.Exit(1) - } + askForConfirmation() cfg.MinNumUnits = uint32(numUnits) cfg.MaxNumUnits = uint32(numUnits) } @@ -132,19 +144,13 @@ func processFlags() error { if flagSet["labelsPerUnit"] && (cfg.LabelsPerUnit != config.MainnetConfig().LabelsPerUnit) { fmt.Println("WARNING: labelsPerUnit is set to a non-default value. This makes the initialization incompatible " + "with mainnet. If you're trying to initialize for mainnet, please remove the -labelsPerUnit flag") - if !yes { - fmt.Println("If you're sure you want to continue, please run with -yes") - os.Exit(1) - } + askForConfirmation() } if flagSet["scryptN"] { fmt.Println("WARNING: scryptN is set to a non-default value. This makes the initialization incompatible " + "with mainnet. If you're trying to initialize for mainnet, please remove the -scryptN flag") - if !yes { - fmt.Println("If you're sure you want to continue, please run with -yes") - os.Exit(1) - } + askForConfirmation() } if (opts.FromFileIdx != 0 || opts.ToFileIdx != nil) && idHex == "" { From 7f5e2a9b73072a4f68fbc2a5af01d38fa18708dc Mon Sep 17 00:00:00 2001 From: Matthias <5011972+fasmat@users.noreply.github.com> Date: Fri, 12 Jan 2024 13:18:29 +0000 Subject: [PATCH 4/9] Update dockerfile and readme --- Dockerfile | 10 +----- cmd/postcli/README.md | 73 ++++++++++++++++++++++++++++++------------- 2 files changed, 52 insertions(+), 31 deletions(-) diff --git a/Dockerfile b/Dockerfile index 87adadf17..ad311b9e5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,25 +24,17 @@ RUN --mount=type=cache,id=build,target=/root/.cache/go-build make build FROM ubuntu:22.04 AS postcli ENV DEBIAN_FRONTEND noninteractive ENV SHELL /bin/bash -ARG TZ=Etc/UTC -ENV TZ $TZ USER root RUN set -ex \ && apt-get update --fix-missing \ && apt-get install -qy --no-install-recommends \ - ca-certificates \ - tzdata \ locales \ - procps \ - net-tools \ - file \ ocl-icd-libopencl1 clinfo \ pocl-opencl-icd libpocl2 \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* \ && locale-gen en_US.UTF-8 \ - && update-locale LANG=en_US.UTF-8 \ - && echo "$TZ" > /etc/timezone + && update-locale LANG=en_US.UTF-8 ENV LANG en_US.UTF-8 ENV LANGUAGE en_US.UTF-8 ENV LC_ALL en_US.UTF-8 diff --git a/cmd/postcli/README.md b/cmd/postcli/README.md index 2588211b9..091a39f36 100644 --- a/cmd/postcli/README.md +++ b/cmd/postcli/README.md @@ -4,7 +4,8 @@ CLI tool for PoST initialization ## Getting it -Go to the and take the most recent release for your platform. In case if you want to build it from source, follow the instructions below. +Go to the and take the most recent release for your platform. In case if +you want to build it from source, follow the instructions below. ```bash git clone https://github.com/spacemeshos/post @@ -12,6 +13,16 @@ cd post make postcli ``` +Alternatively you can use the `postcli` docker image: + +```bash +docker pull spacemeshos/postcli:v0.6.5 +``` + +Replace the version with the latest version. You can find the latest version on the +[releases page](https://github.com/spacemeshos/post/releases). Do not use the `latest` tag since it can be +unstable/untested. + ## Usage ```bash @@ -20,7 +31,8 @@ make postcli ## Get OpenCL working -You need to have OpenCL support on your system. OpenCL usually comes with your graphics drivers. On Windows it should work out of the box on linux you will need to install them separately. +You need to have OpenCL support on your system. OpenCL usually comes with your graphics drivers. On Windows it should +work out of the box on linux you will need to install them separately. You can always list the providers by using @@ -28,7 +40,8 @@ You can always list the providers by using clinfo -l ``` -That's separate command NOT shipped with post implementation. Please refer to your system installation manual of clinfo for installation instructions. +That's separate command NOT shipped with post implementation. Please refer to your system installation manual of clinfo +for installation instructions. ### Nvidia @@ -68,30 +81,34 @@ apt install nvidia-opencl-icd Example ```bash -./postcli -provider=2 -id=c230c51669d1fcd35860131e438e234726b2bd5f9adbbd91bd88a718e7e98ecb -commitmentAtxId=c230c51669d1fcd35860131e438e234726b2bd5f9adbbd91bd88a718e7e98ecb -genproof +./postcli -provider=2 -id=c230c51669d1fcd35860131e438e234726b2bd5f9adbbd91bd88a718e7e98ecb \ + -commitmentAtxId=c230c51669d1fcd35860131e438e234726b2bd5f9adbbd91bd88a718e7e98ecb -genproof ``` ### Remarks * Both `-id` and `-commitmentAtxId` are needed to generate the PoST data. -* If `-id` isn't provided a new identity will be auto-generated. Its private key will be stored in `key.bin` in `-datadir` -with the PoST data. This file then **must** to be copied/moved with the PoST data to run a node with this generated identity. +* If `-id` isn't provided a new identity will be auto-generated. Its private key will be stored in `key.bin` in +`-datadir` with the PoST data. This file then **must** to be copied/moved with the PoST data to run a node with this +generated identity. **NOTE:** The generated PoST data is ONLY valid for this identity! -If a public key is provided with the `-id` flag, the `key.bin` file will be NOT created. Make sure that the key file that belongs -to the identity provided to `postcli` is available in the PoST directory **before** running a node with it. +If a public key is provided with the `-id` flag, the `key.bin` file will be NOT created. Make sure that the key file +that belongs to the identity provided to `postcli` is available in the PoST directory **before** running a node with it. * `-commitmentAtxId`: it is recommended to look up the highest ATX by querying it from a synced node with `grpcurl -plaintext -d '' 0.0.0.0:9093 spacemesh.v1.ActivationService.Highest | jq -r '.atx.id.id' | base64 -d | xxd -p -c 64`. The node can be operated in "non-smeshing" mode during synchronization and when querying the highest ATX. -* The `-reset` flag can be used to clean up a previous initialization. **Careful**: This will delete data that won't be recoverable. +* The `-reset` flag can be used to clean up a previous initialization. **Careful**: This will delete data that won't be +recoverable. ## Initializing a subset of PoST data -It is possible to initialize only subset of the files. This feature is intended to be used to split initialization between many machines. +It is possible to initialize only subset of the files. This feature is intended to be used to split initialization +between many machines. ### Example - split initialization between 2 machines -For this example we initialize 100 units and split the process of initialization into two chunks. This command shows the number of files -that would be created during initialization: +For this example we initialize 100 units and split the process of initialization into two chunks. This command shows +the number of files that would be created during initialization: ```bash ./postcli -numUnits 100 -printNumFiles @@ -156,36 +173,48 @@ in each `post_metadata.json` of every subset. Given two files: "NonceValue": "0000488e171389cce69344d68b66f6b4" ``` -The nonce in the second file (please see the `NonceValue` not `Nonce` field) is the global minimum since its value is smaller than the first one. The operator is **required** to find the -smallest VRF nonce by hand and ensure that its index and value are in the `postdata_metadata.json` of the merged directory on the target machine. +The nonce in the second file (please see the `NonceValue` not `Nonce` field) is the global minimum since its value is +smaller than the first one. The operator is **required** to find the smallest VRF nonce by hand and ensure that its +index and value are in the `postdata_metadata.json` of the merged directory on the target machine. -Not every chunk will contain a VRF nonce in its `postdata_metadata.json`, but at least one should. If for the very unlikely case that no VRF nonce -was found in any chunk the operator can run `postcli` again **after merging the data** without `-fromFile` and `-toFile` flags to find a VRF nonce. +Not every chunk will contain a VRF nonce in its `postdata_metadata.json`, but at least one should. If for the very +unlikely case that no VRF nonce was found in any chunk the operator can run `postcli` again **after merging the data** +without `-fromFile` and `-toFile` flags to find a VRF nonce. ## Verifying initialized POS data -The `postcli` allows verifying an already initialized POS data. Verification samples a small fraction of labels from every file and compares them to labels generated with the same algorithm executed on CPU. Please note that generating labels on CPU is slow compared to GPU. Hence it is not possible to verify all the data (it would essentially mean re-initialization on CPU). If the GPU failed during initialization, the created PoST data will contain some or all invalid labels after that point. This method will only sample the PoST and might not detect a small amount of corrupted data. +The `postcli` allows verifying an already initialized POS data. Verification samples a small fraction of labels from +every file and compares them to labels generated with the same algorithm executed on CPU. Please note that generating +labels on CPU is slow compared to GPU. Hence it is not possible to verify all the data (it would essentially mean +re-initialization on CPU). If the GPU failed during initialization, the created PoST data will contain some or all +invalid labels after that point. This method will only sample the PoST and might not detect a small amount of corrupted +data. -Depending on PoST size and CPU speed a reasonable *fraction* (%) parameter needs to be picked that gives enough confidence but still completes verification in a reasonable time. Suggested values are <1%, closer to 0.1%. +Depending on PoST size and CPU speed a reasonable *fraction* (%) parameter needs to be picked that gives enough +confidence but still completes verification in a reasonable time. Suggested values are <1%, closer to 0.1%. To verify POS data: 1. locate the directory of the POS data. It should contain postdata_metadata.json and postdata_N.bin files. 2. run `postcli -verify -datadir -fraction <% of data to verify>`. -For example, `postcli -verify -datadir ~/post/data -fraction 0.1` will verify 0.1% of data. No additional arguments (i.e `-id`) are required. The postcli will read all required information from postdata_metadata.json +For example, `postcli -verify -datadir ~/post/data -fraction 0.1` will verify 0.1% of data. No additional arguments +(i.e `-id`) are required. The postcli will read all required information from postdata_metadata.json -If the POS data is found to be invalid, `postcli` will exit with status 1 and print the index of file and offset of the label found to be invalid. If verification completes successfully, `postcli` exits with 0. +If the POS data is found to be invalid, `postcli` will exit with status 1 and print the index of file and offset of the +label found to be invalid. If verification completes successfully, `postcli` exits with 0. ## Troubleshooting ### Searching for a lost VRF nonce -In case you lost a VRF nonce after merging initialized subsets, you can use postcli to recover it without re-initializing the data. Postcli will need to **read** the entire POS data and find the nonce. +In case you lost a VRF nonce after merging initialized subsets, you can use postcli to recover it without +re-initializing the data. Postcli will need to **read** the entire POS data and find the nonce. To find a lost nonce: 1. locate the directory of the POS data. It should contain postdata_metadata.json and postdata_N.bin files. 2. run `postcli -searchForNonce -datadir `. -The postcli will read the metadata from postdata_metadata.json and then look for the nonce in all postdata_N.bin files one by one. If the nonce is found it will update the metadata file. +The postcli will read the metadata from postdata_metadata.json and then look for the nonce in all postdata_N.bin files +one by one. If the nonce is found it will update the metadata file. From 2c3c55c7e71ccf79cb65c168aedca4ef56dc8158 Mon Sep 17 00:00:00 2001 From: Matthias <5011972+fasmat@users.noreply.github.com> Date: Fri, 12 Jan 2024 13:31:47 +0000 Subject: [PATCH 5/9] Update version in README.md --- cmd/postcli/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/postcli/README.md b/cmd/postcli/README.md index 091a39f36..56336da2f 100644 --- a/cmd/postcli/README.md +++ b/cmd/postcli/README.md @@ -16,11 +16,11 @@ make postcli Alternatively you can use the `postcli` docker image: ```bash -docker pull spacemeshos/postcli:v0.6.5 +docker pull spacemeshos/postcli:v0.10.4 ``` Replace the version with the latest version. You can find the latest version on the -[releases page](https://github.com/spacemeshos/post/releases). Do not use the `latest` tag since it can be +[releases page](https://github.com/spacemeshos/post/releases). Avoid using the `latest` tag since it can be unstable/untested. ## Usage From f61185f0fce041daf621ca9bdc84e790b43d6ce3 Mon Sep 17 00:00:00 2001 From: Matthias <5011972+fasmat@users.noreply.github.com> Date: Fri, 12 Jan 2024 13:32:15 +0000 Subject: [PATCH 6/9] Use unspecified version as tag --- cmd/postcli/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/postcli/README.md b/cmd/postcli/README.md index 56336da2f..334061d1b 100644 --- a/cmd/postcli/README.md +++ b/cmd/postcli/README.md @@ -16,7 +16,7 @@ make postcli Alternatively you can use the `postcli` docker image: ```bash -docker pull spacemeshos/postcli:v0.10.4 +docker pull spacemeshos/postcli: ``` Replace the version with the latest version. You can find the latest version on the From 587b76baa929ff394a105d663ea51908adbc4c48 Mon Sep 17 00:00:00 2001 From: Matthias <5011972+fasmat@users.noreply.github.com> Date: Fri, 12 Jan 2024 13:34:25 +0000 Subject: [PATCH 7/9] Make if easier to parse for humans --- cmd/postcli/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/postcli/main.go b/cmd/postcli/main.go index 9fee1b7ca..acc4ce3c0 100644 --- a/cmd/postcli/main.go +++ b/cmd/postcli/main.go @@ -106,7 +106,7 @@ func askForConfirmation() { var answer string _, err := fmt.Scanln(&answer) - if err != nil || (answer != "y" && answer != "Y") { + if err != nil || !(answer == "y" || answer == "Y") { fmt.Println("Aborting") os.Exit(1) } From ac6f915fd28a106f9ec135cce5e2265b0aa9f322 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20R=C3=B3=C5=BCa=C5=84ski?= Date: Wed, 24 Jan 2024 09:04:57 +0100 Subject: [PATCH 8/9] [postcli] Pass scrypt params to verify proof --- cmd/postcli/main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/postcli/main.go b/cmd/postcli/main.go index acc4ce3c0..b9e898289 100644 --- a/cmd/postcli/main.go +++ b/cmd/postcli/main.go @@ -302,7 +302,8 @@ func main() { log.Fatalln("failed to create verifier", err) } defer verifier.Close() - if err := verifier.Verify(proof, proofMetadata, cfg, logger); err != nil { + err = verifier.Verify(proof, proofMetadata, cfg, logger, verifying.WithLabelScryptParams(opts.Scrypt)) + if err != nil { log.Fatalln("failed to verify test proof", err) } From 2e0a139f3bafa7420c8329750bc04565034216ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20R=C3=B3=C5=BCa=C5=84ski?= Date: Wed, 24 Jan 2024 12:32:08 +0100 Subject: [PATCH 9/9] Bump post-rs to v0.6.6 --- Makefile.Inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.Inc b/Makefile.Inc index 68406a327..b63a3de96 100644 --- a/Makefile.Inc +++ b/Makefile.Inc @@ -51,7 +51,7 @@ else endif # Also update 'SUPPORTED_VERSION' in internal/postrs/version_check.go -POSTRS_SETUP_REV = 0.6.5 +POSTRS_SETUP_REV = 0.6.6 POSTRS_SETUP_ZIP = libpost-$(platform)-v$(POSTRS_SETUP_REV).zip POSTRS_SETUP_URL_ZIP ?= https://github.com/spacemeshos/post-rs/releases/download/v$(POSTRS_SETUP_REV)/$(POSTRS_SETUP_ZIP) ifeq ($(platform), windows)